Ejemplo n.º 1
0
 public Company Create(CompanyRegViewModel model)
 {
     var MemberID = CookieHelper.MemberID;
     Company company = new Company();
     company.AddIP = HttpHelper.IP;
     company.Address = model.Address;
     company.AddTime = DateTime.Now;
     company.CityCodeValue = model.CityCode;
     company.CityCode = Utilities.GetCascadingId(model.CityCode);
     company.Description = model.Description;
     company.Fax = model.Fax;
     company.LastIP = HttpHelper.IP;
     company.LastTime = DateTime.Now;
     company.Lat = Convert.ToSingle(model.Position.Split('|')[0]);
     company.Lng = Convert.ToSingle(model.Position.Split('|')[1]);
     company.LinkMan = model.LinkMan;
     company.MemberID = MemberID;
     company.Mobile = model.Mobile;
     company.MSN = model.MSN;
     company.Name = model.Name;
     company.Phone = model.Phone;
     company.QQ = model.QQ;
     company.Sex = model.Sex;
     company.Status = (int)CompanyStatus.CompanyApply;
     company.IdentityCard = model.IdentityCard;
     company.CredentialsImg = model.CredentialsImg;
     company.LinkManImg = model.LinkManImg;
     company.LogoImg = model.LogoImg;
     db.Add<Company>(company);
     db.Commit();
     return company;
 }
Ejemplo n.º 2
0
 public ActionResult RegBiz(RegBizViewModel model)
 {
     if (ModelState.IsValid)
     {
         #region 注册用户并登录
         try
         {
             RegViewModel rm = new RegViewModel()
             {
                 Email = model.Email,
                 NickName = model.NickName,
                 Password = model.Password,
                 Mobile = model.Mobile,
                 MemberType = 2
             };
             Member mb = MemberService.Create(rm);
             MemberService.SetLoginCookie(mb);
             ProfileViewModel pm = new ProfileViewModel()
             {
                 CityCode = model.CityCode,
                 Borthday = DateTime.Now,
                 NickName = mb.NickName,
                 RealName = model.LinkMan,
                 Sex = model.Sex
             };
             MemberService.SaveMemberProfile(mb.MemberID, pm);
             ContactViewModel cm = new ContactViewModel()
             {
                 Address = model.Address,
                 Email = model.Email,
                 Mobile = model.Mobile,
                 //Phone = model.Phone,
                 Position = model.Position
             };
             MemberService.SaveMemberContact(mb.MemberID, cm);
             CompanyRegViewModel cr = new CompanyRegViewModel()
             {
                 Address = model.Address,
                 CityCode = model.CityCode,
                 Description = model.Description,
                 LinkMan = model.LinkMan,
                 Mobile = model.Mobile,
                 Name = model.Name,
                 //Phone = model.Phone,
                 Position = model.Position,
                 Sex = model.Sex
             };
             CompanyService.SaveBasInfo(mb.MemberID, cr);
             return Redirect(Url.Action("regauth"));
         }
         catch (Exception ex)
         {
             LogHelper.WriteLog("用户:" + model.Email + "企业注册失败!", ex);
             TempData["FormError"] = true;
             return View(model);
         }
         #endregion
     }
     else
     {
         TempData["FormError"] = true;
         return View(model);
     }
 }
Ejemplo n.º 3
0
        public ActionResult OpenBiz(OpenBizViewModel model)
        {
            Member member = MemberService.Find(CookieHelper.MemberID);
            if (ModelState.IsValid)
            {

                try
                {
                    if (member.Status < (int)MemberStatus.EmailActived)
                    {
                        return Content("<script>alert('您的邮箱还未绑定,请先绑定邮箱再进行企业认证!');window.top.location='" + Url.Action("activeemail") + "';</script>");
                    }
                    else
                    {
                        if (member.Status >= (int)MemberStatus.CompanyAuth)
                        {
                            return Content("<script>alert('您的企业已经认证通过了!');window.top.location='" + Url.Action("index", "personal") + "';</script>");
                        }
                        else
                        {
                            var company = CompanyService.Find(member.MemberID);

                            if (company == null)
                            {
                                CompanyRegViewModel reg = new CompanyRegViewModel()
                                {
                                    Address = model.Address,
                                    CityCode = model.CityCode,
                                    Description = model.Description,
                                    LinkMan = model.LinkMan,
                                    Mobile = member.Mobile,
                                    Name = model.Name,
                                    //Phone = model.Phone,
                                    Position = model.Position,
                                    Sex = model.Sex,
                                    LinkManImg = model.LinkManImg,
                                    CredentialsImg = model.CredentialsImg,
                                    LogoImg = model.LogoImg,
                                    IdentityCard = model.IdentityCard
                                };
                                CompanyService.Create(reg);
                            }
                            else
                            {
                                CompanyRegViewModel reg = new CompanyRegViewModel()
                                {
                                    Address = model.Address,
                                    CityCode = model.CityCode,
                                    Description = model.Description,
                                    LinkMan = model.LinkMan,
                                    Mobile = member.Mobile,
                                    Name = model.Name,
                                    //Phone = model.Phone,
                                    Position = model.Position,
                                    Sex = model.Sex,
                                    LinkManImg = model.LinkManImg,
                                    CredentialsImg = model.CredentialsImg,
                                    LogoImg = model.LogoImg,
                                    IdentityCard = model.IdentityCard,
                                    Fax = company.Fax,
                                    MSN = company.MSN,
                                    QQ = company.QQ
                                };
                                CompanyService.Update(reg);
                            }
                        }
                    }
                    return Redirect(Url.Action("bizOk"));

                }
                catch (Exception ex)
                {
                    LogHelper.WriteLog("用户:" + member.MemberID + "开通企业注册失败!", ex);
                    TempData["FormError"] = true;
                    return View(model);
                }
            }
            else
            {
                TempData["FormError"] = true;
                return View(model);
            }
        }
Ejemplo n.º 4
0
 public Company SaveBasInfo(int MemberID, CompanyRegViewModel model)
 {
     Company company = new Company();
     company.AddIP = HttpHelper.IP;
     company.Address = model.Address;
     company.AddTime = DateTime.Now;
     company.Description = model.Description;
     company.Fax = model.Fax;
     company.LastIP = HttpHelper.IP;
     company.LastTime = DateTime.Now;
     company.Lat = Convert.ToSingle(model.Position.Split('|')[0]);
     company.Lng = Convert.ToSingle(model.Position.Split('|')[1]);
     company.LinkMan = model.LinkMan;
     company.MemberID = MemberID;
     company.Mobile = model.Mobile;
     company.MSN = model.MSN;
     company.Name = model.Name;
     company.Phone = model.Phone;
     company.QQ = model.QQ;
     company.Sex = model.Sex;
     company.CityCodeValue = model.CityCode;
     company.CityCode = Utilities.GetCascadingId(model.CityCode);
     db.Add<Company>(company);
     db.Commit();
     return company;
 }
Ejemplo n.º 5
0
        public ActionResult Details(int id)
        {
            Company cpy = CompanyService.Find(id);
            CompanyRegViewModel cpr = new CompanyRegViewModel()
            {
                Address = cpy.Address,

                CityCode = cpy.CityCodeValue,
                CredentialsImg = cpy.CredentialsImg,
                IdentityCard = cpy.IdentityCard,
                LinkManImg = cpy.LinkManImg,
                LogoImg = cpy.LogoImg,
                Description = cpy.Description,
                Fax = cpy.Fax,
                LinkMan = cpy.LinkMan,
                Mobile = cpy.Mobile,
                MSN = cpy.MSN,
                Name = cpy.Name,
                Phone = cpy.Phone,
                Position = cpy.Lat + "|" + cpy.Lng,
                QQ = cpy.QQ,
                Sex = cpy.Sex
            };
            var cityIds = cpy.CityCodeValue.Split(',').Select(x => Convert.ToInt32(x)).ToList();
            var cityValues = CityCateService.GetALL().Where(x => cityIds.Contains(x.ID)).Select(x => x.CateName).ToList();
            ViewBag.Data_CityCode = cityValues;

            return View(cpr);
        }