Example #1
0
        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);
        }
 public BasicResponse <JC_AlarmNotificationPersonnelConfigInfo> AddJC_AlarmNotificationPersonnelConfig(AlarmNotificationPersonnelConfigAddRequest jC_Alarmnotificationpersonnelconfigrequest)
 {
     return(_AlarmNotificationPersonnelConfigService.AddJC_AlarmNotificationPersonnelConfig(jC_Alarmnotificationpersonnelconfigrequest));
 }
        public BasicResponse <JC_AlarmNotificationPersonnelConfigInfo> AddJC_AlarmNotificationPersonnelConfig(AlarmNotificationPersonnelConfigAddRequest jC_Alarmnotificationpersonnelconfigrequest)
        {
            var responseStr = HttpClientHelper.Post(Webapi + "/v1/AlarmNotificationPersonnelConfig/AddJC_AlarmNotificationPersonnelConfig?token=" + Token, JSONHelper.ToJSONString(jC_Alarmnotificationpersonnelconfigrequest));

            return(JSONHelper.ParseJSONString <BasicResponse <JC_AlarmNotificationPersonnelConfigInfo> >(responseStr));
        }