예제 #1
0
        public Company Create(CompanyReg model)
        {
            var MemberID = Convert.ToInt32(CookieHelper.UID);
            Company company = new Company();
            company.AddIP = HttpHelper.IP;
            company.Address = model.Address;
            company.AddTime = DateTime.Now;
            company.BussinessCode = model.BussinessCode;
            company.CityCode = model.CityCode;
            company.Description = model.Description;

            company.Fax = model.Fax;
            company.FundCode = model.FundCode;
            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.ScaleCode = model.ScaleCode;
            company.Sex = model.Sex;
            DB_Service.Add<Company>(company);
            DB_Service.Commit();

            DB_Service.Attach<Company>(company);
            CompanyImg cimg = new CompanyImg()
            {
                FocusImgUrl = model.CompanyImg.Split(',')[0],
                ImgUrls = model.CompanyImg,
                MemberID = MemberID,
                CompanyID = company.CompanyID
            };
            company.CompanyImg = cimg;

            LinkManImg limg = new LinkManImg()
            {
                FocusImgUrl = model.LinManImg.Split(',')[0],
                ImgUrls = model.LinManImg,
                MemberID = MemberID,
                CompanyID = company.CompanyID
            };
            company.LinkManImg = limg;

            DB_Service.Commit();

            return company;
        }
예제 #2
0
        public ActionResult Details(int id)
        {
            Company cpy = companyService.IncludeFindByCompanyID(id);

            CompanyReg cpr = new CompanyReg()
            {
                Address = cpy.Address,
                BussinessCode = cpy.BussinessCode,
                CityCode = cpy.CityCode,
                CompanyImg = cpy.CompanyImg.ImgUrls,
                Description = cpy.Description,
                Fax = cpy.Fax,
                FundCode = cpy.FundCode,
                LinkMan = cpy.LinkMan,
                LinManImg = cpy.LinkManImg.ImgUrls,
                Mobile = cpy.Mobile,
                MSN = cpy.MSN,
                Name = cpy.Name,
                Phone = cpy.Phone,
                Position = cpy.Lat + "|" + cpy.Lng,
                QQ = cpy.QQ,
                ScaleCode = cpy.ScaleCode,
                Sex = cpy.Sex

            };
            return View(cpr);
        }
예제 #3
0
        public ActionResult Index()
        {
            int MemberID = Convert.ToInt32(CookieHelper.UID);
            var UserStatus = Convert.ToInt32(CookieHelper.Status);
            ViewBag.UserStatus = UserStatus;
            ViewBag.MenuItem = "company";

            if (UserStatus < (int)CoreHelper.Enum.MemberStatus.EmailActived)
            {
                return View(new CompanyReg());
            }
            else if (UserStatus == (int)CoreHelper.Enum.MemberStatus.EmailActived)
            {
                return View(new CompanyReg());
            }
            else if (UserStatus == (int)CoreHelper.Enum.MemberStatus.CompanyApply || UserStatus == (int)CoreHelper.Enum.MemberStatus.CompanyAuth)
            {
                Company cpy = companyService.Find(MemberID);
                CompanyReg cpr = new CompanyReg()
                {
                    Address = cpy.Address,
                    BussinessCode = cpy.BussinessCode,
                    CityCode = cpy.CityCode,
                    CompanyImg = cpy.CompanyImg.ImgUrls,
                    Description = cpy.Description,
                    Fax = cpy.Fax,
                    FundCode = cpy.FundCode,
                    LinkMan = cpy.LinkMan,
                    LinManImg = cpy.LinkManImg.ImgUrls,
                    Mobile = cpy.Mobile,
                    MSN = cpy.MSN,
                    Name = cpy.Name,
                    Phone = cpy.Phone,
                    Position = cpy.Lat + "|" + cpy.Lng,
                    QQ = cpy.QQ,
                    ScaleCode = cpy.ScaleCode,
                    Sex = cpy.Sex

                };
                return View(cpr);
            }
            else
            {
                return View(new CompanyReg());
            }
        }
예제 #4
0
        public ActionResult Index(CompanyReg model)
        {
            ViewBag.MenuItem = "company";
            if (ModelState.IsValid)
            {
                try
                {
                    var memberID = Convert.ToInt32(CookieHelper.UID);

                    companyService.Create(model);

                    if (member_ActionService.HasAction(MemberActionType.CompanyApply))
                    {
                        member_ActionService.Create(MemberActionType.CompanyReApply);
                    }
                    else
                    {
                        member_ActionService.Create(MemberActionType.CompanyApply);
                    }
                    memberService.SaveMemberStatus(memberID, MemberStatus.CompanyApply);
                    return RedirectToAction("index");
                }
                catch (DbEntityValidationException ex)
                {
                    ViewBag.Error = ex.Message;
                    return View(model);
                }
            }
            else
            {
                return View(model);
            }
        }