/// <summary> /// 批量新增 /// </summary> /// <param name="jC_AlarmNotificationPersonnelrequest"></param> /// <returns></returns> public BasicResponse <List <JC_AlarmNotificationPersonnelInfo> > AddJC_AlarmNotificationPersonnelList(AlarmNotificationPersonnelAddRequest jC_AlarmNotificationPersonnelrequest) { DataTable dataTable = _Repository.QueryTable("global_AlarmNotificationPersonnelService_GetAlarmNotificationPersonnelListByAnalysisModelId", jC_AlarmNotificationPersonnelrequest.AnalysisModelId); List <JC_AlarmNotificationPersonnelModel> listResult = ObjectConverter.Copy <JC_AlarmNotificationPersonnelModel>(dataTable); var _jC_AlarmNotificationPersonnel = ObjectConverter.CopyList <JC_AlarmNotificationPersonnelInfo, JC_AlarmNotificationPersonnelModel> (jC_AlarmNotificationPersonnelrequest.JC_AlarmNotificationPersonnelInfoList); try { TransactionsManager.BeginTransaction(() => { _Repository.DeleteJC_AlarmNotificationPersonnelList(listResult); _Repository.AddJC_AlarmNotificationPersonnelList(_jC_AlarmNotificationPersonnel.ToList()); }); } catch { } var jC_AlarmNotificationPersonnelresponse = new BasicResponse <List <JC_AlarmNotificationPersonnelInfo> >(); jC_AlarmNotificationPersonnelresponse.Data = jC_AlarmNotificationPersonnelrequest.JC_AlarmNotificationPersonnelInfoList; return(jC_AlarmNotificationPersonnelresponse); }
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); }