Beispiel #1
0
 public ActionResult Contact()
 {
     ViewBag.MenuItem = "company-contact";
     var member = MemberService.Find(CookieHelper.MemberID);
     if (member.Status < (int)MemberStatus.CompanyAuth)
     {
         return Redirect(Url.Action("openbiz", "reg"));
     }
     else
     {
         var company = CompanyService.Find(CookieHelper.MemberID);
         var model = new CompanyContactInfoViewModel()
         {
             Fax = company.Fax,
             LinkMan = company.LinkMan,
             Mobile = company.Mobile,
             MSN = company.MSN,
             Phone = company.Phone,
             QQ = company.QQ,
             Sex = company.Sex
         };
         return View(model);
     }
 }
Beispiel #2
0
        public ActionResult Contact(CompanyContactInfoViewModel model)
        {
            ViewBag.MenuItem = "company-contact";
            var member = MemberService.Find(CookieHelper.MemberID);
            if (member.Status < (int)MemberStatus.CompanyAuth)
            {
                return Redirect(Url.Action("openbiz", "reg"));
            }
            ServiceResult result = new ServiceResult();
            TempData["Service_Result"] = result;
            if (ModelState.IsValid)
            {
                try
                {
                    CompanyService.UpdateContactInfo(CookieHelper.MemberID, model);
                    result.Message = "联系信息保存成功!";
                    return RedirectToAction("Contact");
                }
                catch (Exception ex)
                {
                    result.Message = "联系信息保存失败!";
                    result.AddServiceError(Utilities.GetInnerMostException(ex));
                    LogHelper.WriteLog("用户:" + CookieHelper.MemberID + "联系信息保存失败!", ex);
                    return View(model);
                }
            }
            else
            {
                result.Message = "表单输入有误,请仔细填写表单!";
                result.AddServiceError("表单输入有误,请仔细填写表单!");
            }

            return View(model);
        }
Beispiel #3
0
 public void UpdateContactInfo(int MemberID, CompanyContactInfoViewModel model)
 {
     var company = Find(MemberID);
     db.Attach<Company>(company);
     company.LinkMan = model.LinkMan;
     company.Fax = model.Fax;
     company.Mobile = model.Mobile;
     company.MSN = model.MSN;
     company.Phone = model.Phone;
     company.QQ = model.QQ;
     company.Sex = model.Sex;
     db.Commit();
 }