示例#1
0
        public Company Update(CompanyReg model)
        {
            var MemberID = Convert.ToInt32(CookieHelper.UID);

            Company company = IncludeFind(MemberID);
            DB_Service.Attach<Company>(company);
            company.LastIP = HttpHelper.IP;
            company.Address = model.Address;
            company.LastTime = DateTime.Now;
            company.BussinessCode = model.BussinessCode;
            company.CityCode = model.CityCode;
            company.Description = model.Description;

            company.Fax = model.Fax;
            company.FundCode = model.FundCode;
            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;

            company.Status = (int)CompanyStatus.CompanyApply;
            if (company.CompanyImg == null)
            {
                CompanyImg cimg = new CompanyImg()
                {
                    FocusImgUrl = model.CompanyImg.Split(',')[0],
                    ImgUrls = model.CompanyImg,
                    MemberID = MemberID,
                    CompanyID = company.CompanyID
                };
                company.CompanyImg = cimg;
            }
            else
            {
                company.CompanyImg.FocusImgUrl = model.CompanyImg.Split(',')[0];
                company.CompanyImg.ImgUrls = model.CompanyImg;
            }

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

            if (company.CompanyLogoImg == null)
            {

                CompanyLogoImg logoimg = new CompanyLogoImg()
                {
                    FocusImgUrl = model.Logo,
                    ImgUrls = model.Logo,
                    CompanyID = company.CompanyID,
                    MemberID = MemberID
                };

                company.CompanyLogoImg = logoimg;
            }
            else
            {
                company.CompanyLogoImg.FocusImgUrl = model.Logo;
                company.CompanyLogoImg.ImgUrls = model.Logo;
            }

            DB_Service.Commit();

            return company;
        }
示例#2
0
        public ServiceResult CreateCompanyAuthInfo(int MemberID, BizAuthModel model)
        {
            ServiceResult result = new ServiceResult();
            try
            {
                var company = Find(MemberID);

                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;

                CompanyLogoImg logoimg = new CompanyLogoImg()
                {
                    FocusImgUrl = model.Logo,
                    ImgUrls = model.Logo,
                    CompanyID = company.CompanyID,
                    MemberID = MemberID
                };

                company.CompanyLogoImg = logoimg;

                company.Status = (int)CompanyStatus.CompanyApply;

                DB_Service.Commit();
            }
            catch (DbEntityValidationException ex)
            {
                result.AddServiceError(Utilities.GetInnerMostException(ex));
            }
            return result;
        }