Beispiel #1
0
        public ActionResult OpenBiz(OpenBizModel model)
        {
            if (ModelState.IsValid)
            {
                #region 企业入驻
                try
                {
                    Member member = memberService.Find(CookieHelper.MemberID);

                    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.IncludeFind(member.MemberID);

                            if (company == null)
                            {
                                CompanyReg reg = 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,
                                    CompanyImg = model.CompanyImg,
                                    LinManImg = model.LinManImg,
                                    Logo = model.Logo
                                };
                                companyService.Create(reg);
                            }
                            else
                            {
                                CompanyReg reg = 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,
                                    CompanyImg = model.CompanyImg,
                                    LinManImg = model.LinManImg,
                                    Logo = model.Logo,
                                    Fax = company.Fax,
                                    MSN = company.MSN,
                                    QQ = company.QQ
                                };

                                companyService.Update(reg);
                            }
                        }
                    }

                    //memberService.SetLoginCookie(mb);
                    return Redirect(Url.Action("bizOk"));

                }
                catch (Exception ex)
                {
                    throw ex;
                }

                #endregion
            }
            else
            {
                return View(model);
            }
        }
Beispiel #2
0
        public ActionResult OpenBiz()
        {
            var member = memberService.Find(CookieHelper.MemberID);
            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.IncludeFind(member.MemberID);

                    if (company == null)
                    {
                        return View(new OpenBizModel());
                    }
                    else
                    {

                        var model = new OpenBizModel()
                         {
                             Address = company.Address,
                             BussinessCode = company.BussinessCode,
                             CityCode = company.CityCode,
                             Description = company.Description,
                             FundCode = company.FundCode,
                             LinkMan = company.LinkMan,
                             Mobile = company.Mobile,
                             Name = company.Name,
                             Phone = company.Phone,
                             Position = company.Lat + "|" + company.Lng,
                             ScaleCode = company.ScaleCode,
                             Sex = company.Sex

                         };
                        if (company.LinkManImg != null)
                        {
                            model.LinManImg = company.LinkManImg.ImgUrls;
                        }
                        if (company.CompanyImg != null)
                        {
                            model.CompanyImg = company.CompanyImg.ImgUrls;
                        }
                        if (company.CompanyLogoImg != null)
                        {
                            model.Logo = company.CompanyLogoImg.FocusImgUrl;
                        }
                        return View(model);
                    }
                }
            }
        }