public JsonResult Edit(ShopModel shop) { var service = _iShopService; var nowShop = service.GetShop(shop.Id); //验证修改的店铺等级是否通过 if (!CheckShopGrade(shop.Id, Convert.ToInt64(shop.ShopGrade))) { throw new HimallException("该店铺已使用空间数或已添加商品数大于该套餐"); } if (service.ExistShop(shop.Name, shop.Id)) { throw new HimallException("该店铺已存在"); } if (ShopApplication.ExistBusinessLicenceNumber(shop.BusinessLicenceNumber, shop.Id)) { throw new HimallException("营业执照号已存在"); } bool isExpired = false; if (ModelState.IsValid) { isExpired = Convert.ToDateTime(shop.EndDate) < DateTime.Now.AddDays(1).Date; nowShop.CompanyName = shop.CompanyName; nowShop.CompanyAddress = shop.CompanyAddress; nowShop.CompanyEmployeeCount = shop.CompanyEmployeeCount; nowShop.ShopName = shop.Name; nowShop.GradeId = Convert.ToInt64(shop.ShopGrade); nowShop.EndDate = Convert.ToDateTime(shop.EndDate); nowShop.CompanyRegionId = shop.CompanyRegionId; nowShop.ShopStatus = (Entities.ShopInfo.ShopAuditStatus)(Convert.ToInt32(shop.Status)); nowShop.BusinessLicenseCert = Request.Form["BusinessLicenseCert"]; nowShop.ProductCert = Request.Form["ProductCert"]; nowShop.OtherCert = Request.Form["OtherCert"]; nowShop.BusinessLicenceNumber = shop.BusinessLicenceNumber; nowShop.BusinessSphere = shop.BusinessSphere; nowShop.BusinessLicenceNumberPhoto = shop.BusinessLicenceNumberPhoto == null ? "" : shop.BusinessLicenceNumberPhoto; nowShop.OrganizationCode = shop.OrganizationCode; nowShop.OrganizationCodePhoto = shop.OrganizationCodePhoto; nowShop.GeneralTaxpayerPhot = shop.GeneralTaxpayerPhot; if (nowShop.EndDate > DateTime.Now) { nowShop.ShopStatus = Entities.ShopInfo.ShopAuditStatus.Open; } if (nowShop.EndDate < DateTime.Now) { nowShop.ShopStatus = ShopInfo.ShopAuditStatus.HasExpired; } _iShopService.UpdateShop(nowShop); Task.Factory.StartNew(() => { _iSearchProductService.UpdateShop(shop.Id, shop.Name); if (isExpired) { _iSearchProductService.UpdateSearchStatusByShop(shop.Id); } }); _iOperationLogService.AddPlatformOperationLog(new Entities.LogInfo { Date = DateTime.Now, Description = "修改店铺信息,Id=" + shop.Id, IPAddress = Request.UserHostAddress, PageUrl = "/Shop/Edit/" + shop.Id, UserName = CurrentManager.UserName, ShopId = 0 }); return(Json(new Result { success = true, msg = "保存成功!" })); } else { List <string> sb = new List <string>(); //获取所有错误的Key List <string> Keys = ModelState.Keys.ToList(); //获取每一个key对应的ModelStateDictionary foreach (var key in Keys) { var errors = ModelState[key].Errors.ToList(); //将错误描述添加到sb中 foreach (var error in errors) { sb.Add(error.ErrorMessage); } } return(Json(new Result { success = false, msg = sb[0].ToString() })); } }
public JsonResult EditProfile1(ShopProfileStep1 shopProfileStep1) { if (ShopApplication.ExistCompanyName(shopProfileStep1.CompanyName, CurrentSellerManager.ShopId)) { return(Json(new { success = false, msg = "该公司名已存在!" })); } if (ShopApplication.ExistBusinessLicenceNumber(shopProfileStep1.BusinessLicenceNumber, CurrentSellerManager.ShopId)) { return(Json(new { success = false, msg = "该营业执照号已存在!" })); } //公司信息 Mall.DTO.Shop shopInfo = ShopApplication.GetShop(CurrentSellerManager.ShopId); shopInfo.Id = CurrentSellerManager.ShopId; shopInfo.CompanyName = shopProfileStep1.CompanyName; shopInfo.CompanyAddress = shopProfileStep1.Address; shopInfo.CompanyRegionId = shopProfileStep1.CityRegionId; shopInfo.CompanyRegionAddress = shopProfileStep1.Address; shopInfo.CompanyPhone = shopProfileStep1.Phone; shopInfo.CompanyEmployeeCount = shopProfileStep1.EmployeeCount; shopInfo.CompanyRegisteredCapital = shopProfileStep1.RegisterMoney; shopInfo.ContactsName = shopProfileStep1.ContactName; shopInfo.ContactsPhone = shopProfileStep1.ContactPhone; shopInfo.ContactsEmail = shopProfileStep1.Email; shopInfo.BusinessLicenceNumber = shopProfileStep1.BusinessLicenceNumber; shopInfo.BusinessLicenceRegionId = shopProfileStep1.BusinessLicenceArea; shopInfo.BusinessLicenceStart = shopProfileStep1.BusinessLicenceValidStart; shopInfo.BusinessLicenceEnd = shopProfileStep1.BusinessLicenceValidEnd; shopInfo.BusinessSphere = shopProfileStep1.BusinessSphere; shopInfo.BusinessLicenceNumberPhoto = shopProfileStep1.BusinessLicenceNumberPhoto; shopInfo.OrganizationCode = shopProfileStep1.OrganizationCode; shopInfo.OrganizationCodePhoto = shopProfileStep1.OrganizationCodePhoto; shopInfo.GeneralTaxpayerPhot = shopProfileStep1.GeneralTaxpayerPhoto; shopInfo.Stage = Entities.ShopInfo.ShopStage.CompanyInfo; shopInfo.BusinessLicenseCert = Request.Form["BusinessLicenseCert"]; shopInfo.ProductCert = Request.Form["ProductCert"]; shopInfo.OtherCert = Request.Form["OtherCert"]; shopInfo.legalPerson = shopProfileStep1.legalPerson; shopInfo.CompanyFoundingDate = shopProfileStep1.CompanyFoundingDate; ShopApplication.UpdateShop(shopInfo); //管理员信息 long uid = ShopApplication.GetShopManagers(CurrentSellerManager.ShopId); var mTheme = ShopApplication.GetSettled(); var model = MemberApplication.GetMemberAccountSafety(uid); if (!mTheme.CompanyVerificationType.Equals(VerificationType.VerifyEmail) && shopProfileStep1.MemberPhone.Equals("")) { return(Json(new { success = false, msg = "必须认证手机!" })); } if (!mTheme.CompanyVerificationType.Equals(Mall.CommonModel.VerificationType.VerifyPhone) && shopProfileStep1.MemberEmail.Equals("")) { return(Json(new { success = false, msg = "必须认证邮箱!" })); } //修改真实姓名 var member = MemberApplication.GetMembers(uid); member.RealName = shopProfileStep1.RealName; MemberApplication.UpdateMember(member); //手机认证 if (!shopProfileStep1.MemberPhone.Equals(model.Phone)) { string pluginId = "Mall.Plugin.Message.SMS"; int result = MemberApplication.CheckMemberCode(pluginId, shopProfileStep1.PhoneCode, shopProfileStep1.MemberPhone, uid); string strMsg = ""; switch (result) { case 0: strMsg = "手机验证码错误!"; break; case -1: strMsg = "此手机号已绑定!"; break; } if (!strMsg.Equals("")) { return(Json(new { success = false, msg = strMsg })); } } //邮箱认证 if (!shopProfileStep1.MemberEmail.Equals(model.Email)) { string pluginId = "Mall.Plugin.Message.Email"; int result = MemberApplication.CheckMemberCode(pluginId, shopProfileStep1.EmailCode, shopProfileStep1.MemberEmail, uid); string strMsg = ""; switch (result) { case 0: strMsg = "邮箱验证码错误!"; break; case -1: strMsg = "此邮箱已绑定!"; break; } if (!strMsg.Equals("")) { return(Json(new { success = false, msg = strMsg })); } } ShopApplication.SetShopStage(Entities.ShopInfo.ShopStage.FinancialInfo, CurrentSellerManager.ShopId);//设置成功,则才是进入财务信息 return(Json(new { success = true, msg = "成功!" })); }
public JsonResult CheckBusinessLicenceNumbers(string BusinessLicenceNumber) { var exist = ShopApplication.ExistBusinessLicenceNumber(BusinessLicenceNumber.Trim(), CurrentSellerManager.ShopId); return(Json(!exist, JsonRequestBehavior.AllowGet)); }
public JsonResult CheckBusinessLicenceNumber(string BusinessLicenceNumberT) { var exist = ShopApplication.ExistBusinessLicenceNumber(BusinessLicenceNumberT.Trim(), CurrentSellerManager.ShopId); return(Json(!exist)); }