Exemple #1
0
 public Help_Info CreateHelpInfo(Help_Info newInfo)
 {
     using (chargebitEntities db = new chargebitEntities())
     {
         if(!string.IsNullOrEmpty(newInfo.About) && !string.IsNullOrEmpty(newInfo.AdminHelp) && !string.IsNullOrEmpty(newInfo.AgentHelp) && !string.IsNullOrEmpty(newInfo.Contact))
         {
             if(newInfo.UpdateTime<=0)
             {
                 newInfo.UpdateTime = DateTimeUtil.ConvertDateTimeToInt(DateTime.Now);
             }
             if (newInfo.UpdateUser <= 0)
             {
                 newInfo.UpdateUser = CurrentLoginUser.User.Id;
             }
         }else
         {
             throw new KMBitException("所有字段都不能为空");
         }
         newInfo.IsCurrent = true;
         db.Database.ExecuteSqlCommand("Update Help_Info set IsCurrent=0");
         db.Help_Info.Add(newInfo);
         db.SaveChanges();
     }
     return newInfo;
 }
Exemple #2
0
        public ActionResult SiteInfo(Help_Info model)
        {
            SiteManagement siteMgr = new SiteManagement(User.Identity.GetUserId<int>());            
            try
            {
                siteMgr.CreateHelpInfo(model);
            }
            catch(KMBitException ex)
            {
                ViewBag.Message = ex.Message;
            }

            return View();
        }
Exemple #3
0
 public ActionResult SiteInfo()
 {
     SiteManagement siteMgr = new SiteManagement(User.Identity.GetUserId<int>());
     Help_Info info = siteMgr.GetHelpInfo();
     if(info==null)
     {
         info = new Help_Info() { About = "", AdminHelp = "", AgentHelp = "", Contact = "" };
     }
     return View(info);
 }