Exemplo n.º 1
0
        /// <summary>
        /// 获取配置信息
        /// </summary>
        /// <param name="condition"></param>
        /// <returns></returns>
        public ActionResult List(NotifyInterfaceSettingCondition condition)
        {
            NotifyInterfaceSettingBusiness business = new NotifyInterfaceSettingBusiness();
            var rows = business.GetList(condition);
            var json = JsonConvert.SerializeObject(new
            {
                rows  = rows,
                total = condition.RecordCount
            }, JsonConvertHelper.IsoDateTimeConverter);

            return(Content(json));
        }
Exemplo n.º 2
0
        public ActionResult Save(NotifyInterfaceSettingModel model, int OptType)
        {
            var message = new ReturnMessage {
                Success = false, Msg = "操作失败!"
            };

            try
            {
                NotifyInterfaceSettingBusiness business = new NotifyInterfaceSettingBusiness();
                if (OptType == 2)       //新增
                {
                    var settingList = business.GetList();
                    if (settingList.Where(t => t.AppId == model.AppId && t.MessageType == model.MessageType &&
                                          t.Address.Equals(model.Address)).Count() > 0)
                    {
                        message.Msg = "配置重复!";
                        return(Content(JsonConvert.SerializeObject(message)));
                    }
                    model.CreateTime     = DateTime.Now;
                    model.LastModifyTime = model.CreateTime;
                    model.Status         = 2;
                    message.Success      = business.SaveNotifySetting(model);
                }
                else
                {                  //修改
                    var setting = business.GetNoCache(model.SettingId);
                    if (setting == null)
                    {
                        message.Msg = "配置不存在!";
                        return(Content(JsonConvert.SerializeObject(message)));
                    }
                    model.Status = setting.Status;
                    if (OptType == 3)    //删除
                    {
                        model        = setting;
                        model.Status = 3;
                    }
                    model.LastModifyTime = DateTime.Now;
                    message.Success      = business.UpdateNotifySetting(model);
                }
            }
            catch (Exception)
            {
            }
            return(Content(JsonConvert.SerializeObject(message)));
        }