public void SaveMemberContact(int MemberID, ContactModel model) { Member member = FindMemberWithProfile(MemberID); DB_Service.Attach<Member>(member); Member_Profile mp = new Member_Profile(); if (member.Member_Profile != null) { mp = member.Member_Profile; } mp.MemberID = member.MemberID; mp.Address = model.Address; mp.Phone = model.Phone; mp.Mobile = model.Mobile; mp.MSN = model.MSN; mp.QQ = model.QQ; if (model.Position.IndexOf("|") != -1) { mp.Lat = Convert.ToDouble(model.Position.Split('|')[0]); mp.Lng = Convert.ToDouble(model.Position.Split('|')[1]); } member.Member_Profile = mp; DB_Service.Commit(); }
public ActionResult Contact() { ViewBag.MenuItem = "contact"; var memberID = Convert.ToInt32(CookieHelper.UID); Member member = memberService.FindMemberWithProfile(memberID); if (member.Member_Profile == null) { member.Member_Profile = new Member_Profile(); } ContactModel cm = new ContactModel() { MemberID = member.MemberID, Address = member.Member_Profile.Address, Email = member.Email, Mobile = member.Member_Profile.Mobile, Phone = member.Member_Profile.Phone, MSN = member.Member_Profile.MSN, Position = member.Member_Profile.Lat + "|" + member.Member_Profile.Lng, QQ = member.Member_Profile.QQ }; return View(cm); }
public ActionResult Contact(ContactModel model) { ViewBag.MenuItem = "contact"; ServiceResult result = new ServiceResult(); if (ModelState.IsValid) { try { var memberID = Convert.ToInt32(CookieHelper.UID); memberService.SaveMemberContact(memberID, model); result.Message = "联系信息保存成功!"; TempData["Service_Result"] = result; } catch (Exception ex) { result.Message = Utilities.GetInnerMostException(ex); result.AddServiceError(result.Message); } } else { result.Message = "表单输入有误!"; result.AddServiceError("表单输入有误!"); } return View(model); }
public ActionResult RegBiz(RegBizModel model) { if (ModelState.IsValid) { #region 注册用户并登录 try { RegisterModel rm = new RegisterModel() { Email = model.Email, NickName = model.NickName, Password = model.Password }; Member mb = memberService.Create(rm); memberService.SetLoginCookie(mb); ProfileModel pm = new ProfileModel() { CityCode = model.CityCode, Borthday = DateTime.Now, NickName = mb.NickName, RealName = model.LinkMan, Sex = model.Sex }; memberService.SaveMemberBaseInfo(mb.MemberID, pm); ContactModel cm = new ContactModel() { Address = model.Address, Email = model.Email, Mobile = model.Mobile, Phone = model.Phone, Position = model.Position }; memberService.SaveMemberContact(mb.MemberID, cm); CompanyReg cr = new CompanyReg() { Address = model.Address, BussinessCode = model.BussinessCode, CityCode = model.CityCode, Description = model.Description, FundCode = model.FundCode, LinkMan = model.LinkMan, Mobile = model.Mobile, Name = model.Name, Phone = model.Phone, Position = model.Position, ScaleCode = model.ScaleCode, Sex = model.Sex }; companyService.SaveBasInfo(mb.MemberID, cr); member_MoneySerivce.AddMoney(mb.MemberID, 4, "0006"); //memberService.SetLoginCookie(mb); return Redirect(Url.Action("regauth")); } catch (Exception ex) { throw ex; } #endregion } else { return View(model); } }