using System; using System.Collections.Generic; using System.ComponentModel.DataAnnotations.Schema; using System.Linq; using System.Text; using System.Threading.Tasks; namespace StandardDomeNewApp.BLL { [NotMapped] public class ControlPLCAddress:Model.TControlPlcAddress { public Model.TControlPlcAddress Query() { using (Model.SQLModel SQLModel = new Model.SQLModel()) { Model.TControlPlcAddress controlPLC = new Model.TControlPlcAddress(); controlPLC = SQLModel.TControlPlcAddress.Where( item => item.ControlName==ControlName).FirstOrDefault(); return controlPLC; } } public bool Update() { using (Model.SQLModel SQLModel = new Model.SQLModel()) { bool flag = false; var controlPLCInfo = SQLModel.TControlPlcAddress .Where(item => item.ControlName == ControlName).FirstOrDefault(); controlPLCInfo.Description = Description; controlPLCInfo.PlcFilterKey = PlcFilterKey; controlPLCInfo.Address = Address; controlPLCInfo.Offset = Offset; controlPLCInfo.Multiplier = Multiplier; controlPLCInfo.OperationPara = OperationPara; controlPLCInfo.Uom = Uom; //cancelbywang2022-09-21 数据库没有这个字段 //controlPLCInfo.RoomCode = RoomCode; SQLModel.SaveChanges(); flag = true; return flag; } } } }