首次提交:添加src文件夹代码
This commit is contained in:
92
src/StandardDomeNewApp/BLL/OperationDetail.cs
Normal file
92
src/StandardDomeNewApp/BLL/OperationDetail.cs
Normal file
@@ -0,0 +1,92 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using System.Data;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StandardDomeNewApp.BLL
|
||||
{
|
||||
[NotMapped]
|
||||
public class OperationDetail : Model.TOperationDetail
|
||||
{
|
||||
public bool Add()
|
||||
{
|
||||
using (Model.SQLModel SQLModel = new Model.SQLModel())
|
||||
{
|
||||
try
|
||||
{
|
||||
Model.TOperationDetail operationDetail = new Model.TOperationDetail();
|
||||
operationDetail.OperationCode = OperationCode;
|
||||
operationDetail.CreateDatetime = DateTime.Now;
|
||||
SQLModel.OperationDetail.Add(operationDetail);
|
||||
SQLModel.SaveChanges();
|
||||
return true;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Util.CommonHelper.Fatal("OperationDetail","Error 1"+ex.ToString());
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public bool Delete()
|
||||
{
|
||||
using (Model.SQLModel SQLModel = new Model.SQLModel())
|
||||
{
|
||||
var operationDetailList = SQLModel.OperationDetail.Where(
|
||||
item => item.OperationCode == OperationCode).ToList();
|
||||
foreach (var item in operationDetailList)
|
||||
{
|
||||
SQLModel.OperationDetail.Remove(item);
|
||||
}
|
||||
SQLModel.SaveChanges();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
public List<OperationCodes> GetDistinctOperationTable()
|
||||
{
|
||||
using (Model.SQLModel SQLModel = new Model.SQLModel())
|
||||
{
|
||||
var distinctOperationCodeList = (
|
||||
from item in SQLModel.OperationDetail
|
||||
select new OperationCodes
|
||||
{
|
||||
Operation = item.OperationCode
|
||||
}
|
||||
).ToList().OrderBy(item => item.Operation).ToList();
|
||||
return distinctOperationCodeList;
|
||||
}
|
||||
}
|
||||
public class OperationCodes
|
||||
{
|
||||
public string Operation { get; set; }
|
||||
}
|
||||
public bool Update()
|
||||
{
|
||||
using (Model.SQLModel SQLModel = new Model.SQLModel())
|
||||
{
|
||||
var operationDetail = SQLModel.OperationDetail
|
||||
.Where(item => item.OperationCode == OperationCode)
|
||||
.FirstOrDefault();
|
||||
operationDetail.OperationCode = OperationCode;
|
||||
SQLModel.SaveChanges();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
public List<Model.TOperationDetail> Query()
|
||||
{
|
||||
using (Model.SQLModel SQLModel = new Model.SQLModel())
|
||||
{
|
||||
List<Model.TOperationDetail> operationDetailList = new List<Model.TOperationDetail>();
|
||||
operationDetailList = SQLModel.OperationDetail.Where(
|
||||
item => item.OperationCode.Contains(OperationCode))
|
||||
.OrderByDescending(item=>item.Id).Take(300).ToList();
|
||||
return operationDetailList;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user