/// <summary> /// 根据模型ID查询报警推送人员配置信息 /// </summary> /// <param name="jC_AlarmNotificationPersonnelrequest"></param> /// <returns>报警配置相关的人员信息</returns> public BasicResponse <List <JC_AlarmNotificationPersonnelInfo> > GetAlarmNotificationPersonnelByAnalysisModelId(AlarmNotificationPersonnelGetListByAlarmConfigIdRequest jC_AlarmNotificationPersonnelListByAlarmConfigIdRequest) { DataTable dataTable = _Repository.QueryTable("global_AlarmNotificationPersonnelService_GetAlarmNotificationPersonnelByAnalysisModelId", jC_AlarmNotificationPersonnelListByAlarmConfigIdRequest.AnalysisModelId); List <JC_AlarmNotificationPersonnelInfo> listResult = new List <JC_AlarmNotificationPersonnelInfo>(); List <UserInfo> UserInfolist = ObjectConverter.CopyList <UserModel, UserInfo>(_userRepository.GetUserList()).ToList(); if (UserInfolist != null && UserInfolist.Count > 0) { foreach (var item in UserInfolist) { JC_AlarmNotificationPersonnelInfo JC_AlarmNotificationPersonnelInfo = new JC_AlarmNotificationPersonnelInfo(); bool stateCheck = false; if (dataTable == null || dataTable.Rows.Count == 0) { stateCheck = false; } else { for (int i = 0; i < dataTable.Rows.Count; i++) { if (dataTable.Rows[i]["UserID"].ToString() == item.UserID) { stateCheck = true; break; } } } JC_AlarmNotificationPersonnelInfo.UserID = item.UserID; JC_AlarmNotificationPersonnelInfo.UserCode = item.UserCode; JC_AlarmNotificationPersonnelInfo.UserName = item.UserName; JC_AlarmNotificationPersonnelInfo.IsCheck = stateCheck; listResult.Add(JC_AlarmNotificationPersonnelInfo); } } var jC_AnalyticalExpressionresponse = new BasicResponse <List <JC_AlarmNotificationPersonnelInfo> >(); jC_AnalyticalExpressionresponse.Data = listResult; return(jC_AnalyticalExpressionresponse); }
/// <summary> /// 保存数据 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void simpleBtnSave_Click(object sender, EventArgs e) { //1.数据验证 string strError = ValidateData(); if (strError != "100") { XtraMessageBox.Show(strError, "消息"); return; } AlarmNotificationPersonnelConfigBusinessModel alarmNotificationPersonnelConfigBusinessModel = new AlarmNotificationPersonnelConfigBusinessModel(); var addParms = new List <JC_AlarmNotificationPersonnelConfigInfo>(); if (dataType == "add") { int[] selectedModels = searchLookUpEdit1View.GetSelectedRows(); for (int i = 0; i < selectedModels.Length; i++) { string analysisModelId = searchLookUpEdit1View.GetRowCellValue(selectedModels[i], "Id").ToString(); var addAlarmConfig = new JC_AlarmNotificationPersonnelConfigInfo(); addAlarmConfig.AlarmColor = colorPickEdit.Color.ToArgb().ToString(); addAlarmConfig.AlarmType = checkedCBEAlarm.EditValue.ToString(); addAlarmConfig.AnalysisModelId = analysisModelId; addAlarmConfig.CreatorId = UserID; addAlarmConfig.CreatorName = UserName; addParms.Add(addAlarmConfig); } alarmNotificationPersonnelConfigBusinessModel.AlarmNotificationPersonnelConfigInfoList = addParms; if (alarmNotificationPersonnelConfigBusinessModel.AlarmNotificationPersonnelInfoList == null) { alarmNotificationPersonnelConfigBusinessModel.AlarmNotificationPersonnelInfoList = new List <JC_AlarmNotificationPersonnelInfo>(); } int[] selectedRows = this.gridViewModule.GetSelectedRows(); for (int j = 0; j < selectedRows.Length; j++) { string personId = this.gridViewModule.GetRowCellValue(selectedRows[j], "UserID").ToString(); JC_AlarmNotificationPersonnelInfo alarmNotificationPersonnelInfo = new JC_AlarmNotificationPersonnelInfo(); alarmNotificationPersonnelInfo.PersonId = personId; alarmNotificationPersonnelConfigBusinessModel.AlarmNotificationPersonnelInfoList.Add(alarmNotificationPersonnelInfo); } } else { var updateAlarmConfig = alarmNotificationPersonnelBusiness.GetAlarmNotificationPersonnelByanalysisModelId(this.lookUpAnalysisModels.EditValue.ToString()).AlarmNotificationPersonnelConfigInfo; updateAlarmConfig.AlarmColor = colorPickEdit.Color.ToArgb().ToString(); updateAlarmConfig.AlarmType = checkedCBEAlarm.EditValue.ToString(); updateAlarmConfig.AnalysisModelId = this.lookUpAnalysisModels.EditValue.ToString(); updateAlarmConfig.CreatorId = UserID; updateAlarmConfig.CreatorName = UserName; List <JC_AlarmNotificationPersonnelInfo> alarmNotificationPersonnelInfoList = new List <JC_AlarmNotificationPersonnelInfo>(); int[] selectedRows = this.gridViewModule.GetSelectedRows(); for (int j = 0; j < selectedRows.Length; j++) { string personId = this.gridViewModule.GetRowCellValue(selectedRows[j], "UserID").ToString(); JC_AlarmNotificationPersonnelInfo alarmNotificationPersonnelInfo = new JC_AlarmNotificationPersonnelInfo(); //alarmNotificationPersonnelInfo.Id = Guid.NewGuid().ToString(); alarmNotificationPersonnelInfo.Id = IdHelper.CreateLongId().ToString(); alarmNotificationPersonnelInfo.AlarmConfigId = updateAlarmConfig.Id; alarmNotificationPersonnelInfo.PersonId = personId; alarmNotificationPersonnelInfoList.Add(alarmNotificationPersonnelInfo); } alarmNotificationPersonnelConfigBusinessModel.AlarmNotificationPersonnelConfigInfo = updateAlarmConfig; alarmNotificationPersonnelConfigBusinessModel.AlarmNotificationPersonnelInfoList = alarmNotificationPersonnelInfoList; } string reError = alarmNotificationPersonnelBusiness.AddAlarmNotificationPersonnelConfig(alarmNotificationPersonnelConfigBusinessModel, dataType); if (reError == "100") { XtraMessageBox.Show("保存成功", "消息"); if (dataType == "add") { OperateLogHelper.InsertOperateLog(16, "报警推送-新增【" + lookUpAnalysisModels.Text + "】," + string.Format("内容:{0}", JSONHelper.ToJSONString(alarmNotificationPersonnelConfigBusinessModel)), "报警推送-新增"); } else { OperateLogHelper.InsertOperateLog(16, "报警推送-修改【" + lookUpAnalysisModels.Text + "】," + string.Format("内容:{0}", JSONHelper.ToJSONString(alarmNotificationPersonnelConfigBusinessModel)), "报警推送-修改"); } this.Close(); } else { XtraMessageBox.Show(reError, "消息"); } }