Example #1
0
        public ActionResult Edit(BaseInfo model)
        {
            Load();
            BaseInfo eventInfo = null;

            if (!string.IsNullOrWhiteSpace(model.Key))
            {
                eventInfo = BSPConfig.BaseConfig.BaseList.Find(x => x.Key == model.Key);
            }

            if (eventInfo == null)
            {
                return(PromptView("基础信息不存在"));
            }


            //eventInfo.Key = model.Key.Trim().ToLower(),
            eventInfo.Key         = model.Key.Trim();
            eventInfo.Name        = model.Name;
            eventInfo.Account     = model.Account;
            eventInfo.Bank        = model.Bank;
            eventInfo.BankAddress = model.BankAddress;
            eventInfo.Image       = model.Image;
            BSPConfig.SaveBaseConfig(BSPConfig.BaseConfig);
            return(PromptView("保存成功"));
        }
Example #2
0
        /// <summary>
        /// 修改试用时间及状态
        /// </summary>
        /// <returns></returns>
        public ActionResult SysTimeChange()
        {
            int    type        = WebHelper.GetQueryInt("type");
            string expiredtime = WebHelper.GetQueryString("time", "");

            try
            {
                if (type == 1)
                {
                    BSPConfig.ShopConfig.OnlineTimeSpan = 1;
                    BSPConfig.SaveShopConfig(BSPConfig.ShopConfig);
                    return(APIResult("success", "更新成功"));
                }
                else if (type == 2)
                {
                    //修改状态 系统为试用阶段  时间延迟一个月
                    BSPConfig.ShopConfig.OnlineTimeSpan = 0;
                    BSPConfig.SaveShopConfig(BSPConfig.ShopConfig);

                    string   time      = expiredtime == "" ? DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") : DateTime.Parse(expiredtime).ToString("yyyy-MM-dd HH:mm:ss");
                    BaseInfo base_info = BSPConfig.BaseConfig.BaseList.Find(x => x.Key == "试用");
                    if (base_info != null)
                    {
                        base_info.Account = time;

                        BSPConfig.SaveBaseConfig(BSPConfig.BaseConfig);
                    }
                    else
                    {
                        base_info = new BaseInfo {
                            Key = "试用", Name = "有效期", Account = time
                        };
                        BSPConfig.BaseConfig.BaseList.Add(base_info);
                        BSPConfig.SaveBaseConfig(BSPConfig.BaseConfig);
                    }

                    return(APIResult("success", "更新成功"));
                }
                return(APIResult("error", "更新失败"));
            }
            catch (Exception er)
            {
                return(APIResult("error", "更新失败," + er.Message));
            }
        }
Example #3
0
        public ActionResult Add(BaseInfo model)
        {
            Load();
            if (!string.IsNullOrWhiteSpace(model.Key) && BSPConfig.BaseConfig.BaseList.Find(x => x.Key == model.Key.Trim().ToLower()) != null)
            {
                ModelState.AddModelError("Key", "键已经存在");
            }


            BaseInfo eventInfo = new BaseInfo()
            {
                Key         = model.Key,
                Account     = model.Account,
                Name        = model.Name,
                Bank        = model.Bank,
                BankAddress = model.BankAddress
            };

            BSPConfig.BaseConfig.BaseList.Add(eventInfo);
            BSPConfig.SaveBaseConfig(BSPConfig.BaseConfig);

            return(PromptView("添加成功"));
        }