public BasicResponse DeleteJC_AlarmNotificationPersonnelConfig(AlarmNotificationPersonnelConfigDeleteRequest jC_Alarmnotificationpersonnelconfigrequest) { TransactionsManager.BeginTransaction(() => { if (!string.IsNullOrWhiteSpace(jC_Alarmnotificationpersonnelconfigrequest.Id)) { //删除报警推送信息的时候将存在的报警处理记录填上EndTime JC_AlarmnotificationpersonnelconfigModel alarmnotificationpersonnelconfigModel = _Repository.GetJC_AlarmNotificationPersonnelConfigById(jC_Alarmnotificationpersonnelconfigrequest.Id); _AlarmHandleService.CloseUnclosedAlarmHandleByAnalysisModelId(new Sys.Safety.Request.AlarmHandle.AlarmHandleGetByAnalysisModelIdRequest() { AnalysisModelId = alarmnotificationpersonnelconfigModel.AnalysisModelId }); _Repository.DeleteJC_AlarmNotificationPersonnelConfig(jC_Alarmnotificationpersonnelconfigrequest.Id); _AlarmNotificationPersonnelRepository.DeleteJC_AlarmNotificationPersonnelByAlarmConfigId(jC_Alarmnotificationpersonnelconfigrequest.Id); } else { foreach (var item in jC_Alarmnotificationpersonnelconfigrequest.ids) { //删除报警推送信息的时候将存在的报警处理记录填上EndTime JC_AlarmnotificationpersonnelconfigModel alarmnotificationpersonnelconfigModel = _Repository.GetJC_AlarmNotificationPersonnelConfigById(item); _AlarmHandleService.CloseUnclosedAlarmHandleByAnalysisModelId(new Sys.Safety.Request.AlarmHandle.AlarmHandleGetByAnalysisModelIdRequest() { AnalysisModelId = alarmnotificationpersonnelconfigModel.AnalysisModelId }); _Repository.DeleteJC_AlarmNotificationPersonnelConfig(item); _AlarmNotificationPersonnelRepository.DeleteJC_AlarmNotificationPersonnelByAlarmConfigId(item); } } }); if (Basic.Framework.Data.PlatRuntime.Items.ContainsKey(DataContract.UserRoleAuthorize.KeyConst.AlarmNotificationChangedKey)) { Basic.Framework.Data.PlatRuntime.Items[DataContract.UserRoleAuthorize.KeyConst.AlarmNotificationChangedKey] = DateTime.Now; } else { Basic.Framework.Data.PlatRuntime.Items.Add(DataContract.UserRoleAuthorize.KeyConst.AlarmNotificationChangedKey, DateTime.Now); } var jC_Alarmnotificationpersonnelconfigresponse = new BasicResponse(); return(jC_Alarmnotificationpersonnelconfigresponse); }
public BasicResponse <JC_AlarmNotificationPersonnelConfigInfo> AddJC_AlarmNotificationPersonnelConfig(AlarmNotificationPersonnelConfigAddRequest jC_Alarmnotificationpersonnelconfigrequest) { var _jC_AlarmNotificationPersonnel = ObjectConverter.CopyList <JC_AlarmNotificationPersonnelInfo, JC_AlarmNotificationPersonnelModel> (jC_Alarmnotificationpersonnelconfigrequest.JC_AlarmNotificationPersonnelInfoList); var _jC_Alarmnotificationpersonnelconfig = ObjectConverter.Copy <JC_AlarmNotificationPersonnelConfigInfo, JC_AlarmnotificationpersonnelconfigModel>( jC_Alarmnotificationpersonnelconfigrequest.JC_AlarmNotificationPersonnelConfigInfo ); IList <JC_AlarmnotificationpersonnelconfigModel> alarmConfig = _Repository.GetAlarmNotificationPersonnelConfigByAnalysisModelId(_jC_Alarmnotificationpersonnelconfig.AnalysisModelId); if (alarmConfig != null && alarmConfig.ToList().Count > 0) { return new BasicResponse <JC_AlarmNotificationPersonnelConfigInfo>() { Message = "分析模型已配置报警通知!", Code = -100, Data = jC_Alarmnotificationpersonnelconfigrequest.JC_AlarmNotificationPersonnelConfigInfo } } ; JC_AlarmnotificationpersonnelconfigModel addedAlarmnotificationpersonnelconfigModel = null; TransactionsManager.BeginTransaction(() => { addedAlarmnotificationpersonnelconfigModel = _Repository.AddJC_AlarmNotificationPersonnelConfig(_jC_Alarmnotificationpersonnelconfig); if (jC_Alarmnotificationpersonnelconfigrequest.JC_AlarmNotificationPersonnelInfoList != null) { _AlarmNotificationPersonnelRepository.AddJC_AlarmNotificationPersonnelList(_jC_AlarmNotificationPersonnel.ToList()); } }); if (Basic.Framework.Data.PlatRuntime.Items.ContainsKey(DataContract.UserRoleAuthorize.KeyConst.AlarmNotificationChangedKey)) { Basic.Framework.Data.PlatRuntime.Items[DataContract.UserRoleAuthorize.KeyConst.AlarmNotificationChangedKey] = DateTime.Now; } else { Basic.Framework.Data.PlatRuntime.Items.Add(DataContract.UserRoleAuthorize.KeyConst.AlarmNotificationChangedKey, DateTime.Now); } var jC_Alarmnotificationpersonnelconfigresponse = new BasicResponse <JC_AlarmNotificationPersonnelConfigInfo>(); jC_Alarmnotificationpersonnelconfigresponse.Data = jC_Alarmnotificationpersonnelconfigrequest.JC_AlarmNotificationPersonnelConfigInfo; return(jC_Alarmnotificationpersonnelconfigresponse); }