public ModifyDevice(SheetDevice device) { InitializeComponent(); IsEdit = true; Source = device; Text = "修改设备"; ComboCompany.Text = Source.Device.DeviceCompany; Comment.Text = Source.Device.Comment; RemoteCode1.Text = Source.Device.RemoteCode1; RemoteCode2.Text = Source.Device.RemoteCode2; MachineCode.Text = Source.Device.MachineCode; Electro.Checked = Source.Device.IsDYSF; Universal.Checked = Source.Device.DeviceType == DeviceTypeEnum.Universal; Pressure.Checked = Source.Device.DeviceType == DeviceTypeEnum.Pressure; IsActive.Checked = Source.Device.IsActive; Quantum.Text = Source.Device.Quantum.ToString(); SetTreeValues(new Prjsct() { PrjsctCode = device.SectionCode, PrjsctName = device.SectionName }, new Orginfo() { DepCode = device.UnitCode, DepName = device.UnitName }, new PrjFolder() { FolderName = device.TestRoomName, FolderCode = device.TestRoomCode }); }
private List <SheetDevice> ConvertSource(DataTable table) { var result = new List <SheetDevice>(); foreach (DataRow row in table.Rows) { var device = new Sys_Device() { ID = new Guid(row["ID"].ToString()), ClientConfig = row["ClientConfig"] as string, DeviceType = (DeviceTypeEnum)Convert.ToInt32(row["DeviceType"]), IsDYSF = Convert.ToBoolean(row["IsDYSF"]), Comment = row["Comment"] as string, ConfigStatus = Convert.IsDBNull(row["ConfigStatus"]) ? 0 : Convert.ToInt32(row["ConfigStatus"].ToString()), ConfigUpdateTime = Convert.IsDBNull(row["ConfigUpdateTime"]) ? DateTime.MinValue : Convert.ToDateTime(row["ConfigUpdateTime"]), CreateBy = row["CreateBy"] as string, CreateTime = Convert.ToDateTime(row["CreateTime"]), DeviceCompany = row["DeviceCompany"] as string, IsActive = Convert.ToBoolean(row["IsActive"]), LastEditBy = row["LastEditBy"] as string, LastEditTime = Convert.ToDateTime(row["LastEditTime"]), MachineCode = row["MachineCode"] as string, RemoteCode1 = row["RemoteCode1"] as string, RemoteCode2 = row["RemoteCode2"] as string, TestRoomCode = row["TestRoomCode"] as string }; var sheet = new SheetDevice() { Device = device, SectionName = row["标段名称"] as string, UnitName = row["单位名称"] as string, TestRoomName = row["试验室名称"] as string, SectionCode = row["标段编码"] as string, TestRoomCode = row["试验室编码"] as string, UnitCode = row["单位编码"] as string }; result.Add(sheet); } return(result); }
public DeviceDetail(SheetDevice device) { InitializeComponent(); Source = device; }