/// <summary> /// 新增配置区域断电 /// </summary> /// <param name="data"></param> /// <returns></returns> public string AddRegionOutageConfig(RegionOutageBusinessModel data) { try { string error = ""; //2.新增 RegionOutageConfigListAddRequest regionOutageConfigListRequest = new RegionOutageConfigListAddRequest(); regionOutageConfigListRequest.JC_RegionOutageConfigInfoList = data.RegionOutageConfigInfoList; regionOutageConfigListRequest.AnalysisModelId = data.AnalysisModelId; //调用接口 Basic.Framework.Web.BasicResponse <List <JC_RegionOutageConfigInfo> > analysisTemplateResult = regionOutageConfigService.AddJC_RegionOutageConfigList(regionOutageConfigListRequest); if (analysisTemplateResult.IsSuccess == false) { error = analysisTemplateResult.Message; } else { if (analysisTemplateResult.Code != 100) { error = analysisTemplateResult.Message; } else { error = "100"; } } return(error); } catch (Exception ex) { return("-100"); } }
/// <summary> /// 保存报警设置 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void simpleBtnSave_Click(object sender, EventArgs e) { try { DataTable dt = CdgControl.DataSource as DataTable; DataTable dtRemove = gridControlFalse.DataSource as DataTable; if (CheckData(dt, dtRemove) == false) { return; } RegionOutageBusinessModel newRegionOutageBusinessModel = new RegionOutageBusinessModel(); List <JC_RegionOutageConfigInfo> regionOutageConfigInfoList = new List <JC_RegionOutageConfigInfo>(); string daID = this.gridLookUpEdit.EditValue.ToString(); //是ookUpEdit.Properties.ValueMember的值 for (int i = 0; i < dt.Rows.Count; i++) { JC_RegionOutageConfigInfo regionOutageConfigInfo = new JC_RegionOutageConfigInfo(); //regionOutageConfigInfo.Id = Guid.NewGuid().ToString(); regionOutageConfigInfo.Id = IdHelper.CreateLongId().ToString(); regionOutageConfigInfo.AnalysisModelId = daID; regionOutageConfigInfo.PointId = dt.Rows[i]["PointId"].ToString(); regionOutageConfigInfo.Point = dt.Rows[i]["Point"].ToString(); regionOutageConfigInfo.ControlStatus = 1; regionOutageConfigInfo.CreatorId = UserID; regionOutageConfigInfo.CreatorName = UserName; regionOutageConfigInfo.IsRemoveControl = checkEditRemoveControl.Checked ? 1 : 0; regionOutageConfigInfoList.Add(regionOutageConfigInfo); } //解除控制 DataTable dtDeControlItem = gridControlFalse.DataSource as DataTable; List <DeControlItem> dtFalsh = new List <DeControlItem>(); if (dtDeControlItem == null && dtDeControlItem.Rows.Count == 0) { dtFalsh = new List <DeControlItem>(); } else { dtFalsh = ToListDeControlItem(dtDeControlItem); } if (dtFalsh != null && dtFalsh.Count > 0) { for (int i = 0; i < dtFalsh.Count; i++) { JC_RegionOutageConfigInfo regionOutageConfigInfo = new JC_RegionOutageConfigInfo(); //regionOutageConfigInfo.Id = Guid.NewGuid().ToString(); regionOutageConfigInfo.Id = IdHelper.CreateLongId().ToString(); regionOutageConfigInfo.AnalysisModelId = daID; regionOutageConfigInfo.PointId = dtFalsh[i].PointId; regionOutageConfigInfo.Point = dtFalsh[i].Point; regionOutageConfigInfo.RemoveModelId = dtFalsh[i].RemoveModelId; regionOutageConfigInfo.ControlStatus = 0; regionOutageConfigInfo.IsRemoveControl = 0; regionOutageConfigInfo.CreatorId = UserID; regionOutageConfigInfo.CreatorName = UserName; regionOutageConfigInfoList.Add(regionOutageConfigInfo); } } newRegionOutageBusinessModel.RegionOutageConfigInfoList = regionOutageConfigInfoList; newRegionOutageBusinessModel.AnalysisModelId = daID; string error = regionOutageBusiness.AddRegionOutageConfig(newRegionOutageBusinessModel); if (error == "100") { XtraMessageBox.Show("保存成功", "消息"); OperateLogHelper.InsertOperateLog(16, "区域断电配置-更新【" + this.gridLookUpEdit.Text + "】," + string.Format("内容:{0}", JSONHelper.ToJSONString(newRegionOutageBusinessModel)), "区域断电配置-更新"); this.Close(); } else { XtraMessageBox.Show(error, "消息"); } } catch { } }