private void Frm_CheckAddressType_Load(object sender, EventArgs e) { pointDefineService = ServiceFactory.Create <IPointDefineService>(); AddressTypeService = ServiceFactory.Create <IKJ_AddresstypeService>(); AddresstyperuleService = ServiceFactory.Create <IKJ_AddresstyperuleService>(); IniTable(); LoadAddressType(); }
private void Frm_AddressTypeDefine_Load(object sender, EventArgs e) { deviceDefineService = ServiceFactory.Create <IDeviceDefineService>(); addressTypeService = ServiceFactory.Create <IKJ_AddresstypeService>(); addresstyperuleService = ServiceFactory.Create <IKJ_AddresstyperuleService>(); AddressTypeRuleList = new DataTable(); AddressTypeRuleList.Columns.Add("ID"); AddressTypeRuleList.Columns.Add("Addresstypeid"); AddressTypeRuleList.Columns.Add("Devid"); AddressTypeRuleList.Columns.Add("Devname"); AddressTypeRuleList.Columns.Add("UpAlarmValue"); AddressTypeRuleList.Columns.Add("UpPoweroffValue"); AddressTypeRuleList.Columns.Add("LowAlarmValue"); AddressTypeRuleList.Columns.Add("LowPoweroffValue"); gridControl1.DataSource = AddressTypeRuleList; //加载人员报警设置 20171128 if (type == 1) { AddressType = GetAddressTypeByAddressTypeID(AddressTypeid); if (AddressType != null) { txt_AddressTypeName.Text = AddressType.Addresstypename; List <KJ_AddresstyperuleInfo> AddressTypeRuleItems = addresstyperuleService.GetKJ_AddresstyperuleListByAddressTypeId(new Request.KJ_Addresstyperule.KJ_AddresstyperuleGetListRequest() { Id = AddressTypeid }).Data; Jc_DevInfo devInfo; //加载已有规则信息 devItems = deviceDefineService.GetAllDeviceDefineCache().Data.OrderBy(a => a.Devid).ToList(); foreach (KJ_AddresstyperuleInfo item in AddressTypeRuleItems) { devInfo = devItems.FirstOrDefault(a => a.Devid.ToString() == item.Devid); AddGridData(item.ID, item.Addresstypeid, item.Devid, devInfo == null ? "未知" : devInfo.Name, Math.Round(item.UpAlarmLowValue, 2) + "~" + Math.Round(item.UpAlarmHighValue, 2), Math.Round(item.UpPoweroffLowValue, 2) + "~" + Math.Round(item.UpPoweroffHighValue, 2), Math.Round(item.LowAlarmLowValue, 2) + "~" + Math.Round(item.LowAlarmHighValue, 2), Math.Round(item.LowPoweroffLowValue, 2) + "~" + Math.Round(item.LowPoweroffHighValue, 2)); } } } else { AddressType = null; } LoadDev(); }