public JsonResult Apply(BrandApplyModel brand) { var shopId = CurrentSellerManager.ShopId; ShopBrandApplysInfo model = new ShopBrandApplysInfo(); model.BrandId = brand.BrandId; model.ApplyMode = brand.BrandMode == 1 ? (int)Himall.Model.ShopBrandApplysInfo.BrandApplyMode.Exist : (int)Himall.Model.ShopBrandApplysInfo.BrandApplyMode.New; if (brand.BrandMode == 1) { var m = _iBrandService.GetBrand(brand.BrandId); if (m == null) { throw new Himall.Core.HimallException("品牌不存在,请刷新页面重新申请"); } model.BrandName = m.Name; model.Logo = m.Logo; model.Description = m.Description; } else { if (brand.BrandDesc.Length > 200) { return(Json(new Result() { success = false, msg = "简介过长!" })); } model.BrandId = null; model.BrandName = brand.BrandName.Trim(); model.Logo = brand.BrandLogo; model.Description = brand.BrandDesc; } model.Remark = brand.Remark; model.AuthCertificate = brand.BrandAuthPic; model.ShopId = shopId; model.ApplyTime = DateTime.Now; bool flag = _iBrandService.IsExistApply(shopId, model.BrandName); if (flag == false) { _iBrandService.ApplyBrand(model); return(Json(new Result() { success = true, msg = "申请成功!" })); } else { return(Json(new Result() { success = false, msg = "您已经申请了该品牌!" })); } }
public JsonResult Apply(BrandApplyModel brand) { long shopId = base.CurrentSellerManager.ShopId; ShopBrandApplysInfo shopBrandApplysInfo = new ShopBrandApplysInfo() { BrandId = new long?(brand.BrandId), ApplyMode = (brand.BrandMode == 1 ? 1 : 2) }; if (brand.BrandMode != 1) { shopBrandApplysInfo.BrandId = null; shopBrandApplysInfo.BrandName = brand.BrandName.Trim(); shopBrandApplysInfo.Logo = brand.BrandLogo; shopBrandApplysInfo.Description = brand.BrandDesc; } else { BrandInfo brandInfo = ServiceHelper.Create <IBrandService>().GetBrand(brand.BrandId); if (brandInfo != null) { shopBrandApplysInfo.BrandName = brandInfo.Name; shopBrandApplysInfo.Logo = brandInfo.Logo; shopBrandApplysInfo.Description = brandInfo.Description; } } shopBrandApplysInfo.Remark = brand.Remark; shopBrandApplysInfo.AuthCertificate = brand.BrandAuthPic; shopBrandApplysInfo.ShopId = shopId; shopBrandApplysInfo.ApplyTime = DateTime.Now; if (ServiceHelper.Create <IBrandService>().IsExistApply(shopId, shopBrandApplysInfo.BrandName)) { Result result = new Result() { success = false, msg = "您已经申请了该品牌!" }; return(Json(result)); } ServiceHelper.Create <IBrandService>().ApplyBrand(shopBrandApplysInfo); Result result1 = new Result() { success = true, msg = "申请成功!" }; return(Json(result1)); }
public JsonResult EditApply(BrandApplyModel brand) { var shopId = CurrentSellerManager.ShopId; Entities.ShopBrandApplyInfo model = _iBrandService.GetBrandApply(brand.Id); if (model == null) { throw new Himall.Core.HimallException("该品牌审核不通过,请重新编辑"); } if (model.ApplyMode == 1) { var m = _iBrandService.GetBrand(brand.BrandId); if (m == null) { throw new Himall.Core.HimallException("品牌不存在"); } model.BrandName = m.Name; model.Logo = m.Logo; model.Description = m.Description; model.BrandId = brand.BrandId; } else { if (brand.BrandDesc.Length > 200) { return(Json(new Result() { success = false, msg = "简介过长!" })); } model.BrandId = 0; model.BrandName = brand.BrandName.Trim(); model.Logo = brand.BrandLogo; model.Description = brand.BrandDesc; } model.Remark = brand.Remark; model.AuthCertificate = brand.BrandAuthPic; model.ShopId = shopId; model.ApplyTime = DateTime.Now; var oldapply = _iBrandService.GetExistApply(shopId, model.BrandName); if (oldapply == null) { model.AuditStatus = 0; _iBrandService.UpdateApplyBrand(model); } else { Entities.BrandInfo orderband = null; if (oldapply.BrandId > 0) { orderband = _iBrandService.GetBrand(oldapply.BrandId); } if (orderband != null && orderband.IsDeleted) { model.Id = oldapply.Id; } else { if (oldapply.AuditStatus == (int)ShopBrandApplyInfo.BrandAuditStatus.Audited || oldapply.AuditStatus == (int)ShopBrandApplyInfo.BrandAuditStatus.UnAudit) { throw new Himall.Core.HimallException("该品牌申请已存在,请选择申请其他品牌"); } model.AuditStatus = 0; _iBrandService.UpdateApplyBrand(model); } } return(Json(new Result() { success = true, msg = "重新编辑品牌申请成功!" })); }
public JsonResult Apply(BrandApplyModel brand) { var shopId = CurrentSellerManager.ShopId; var model = new Entities.ShopBrandApplyInfo(); model.BrandId = brand.BrandId; model.ApplyMode = brand.BrandMode == 1 ? (int)Himall.Entities.ShopBrandApplyInfo.BrandApplyMode.Exist : (int)Himall.Entities.ShopBrandApplyInfo.BrandApplyMode.New; if (brand.BrandMode == 1) { var m = _iBrandService.GetBrand(brand.BrandId); if (m == null) { throw new Himall.Core.HimallException("品牌不存在,请刷新页面重新申请"); } model.BrandName = m.Name; model.Logo = m.Logo; model.Description = m.Description; } else { if (brand.BrandDesc.Length > 200) { return(Json(new Result() { success = false, msg = "简介过长!" })); } model.BrandId = 0; model.BrandName = brand.BrandName.Trim(); model.Logo = brand.BrandLogo; model.Description = brand.BrandDesc; } model.Remark = brand.Remark; model.AuthCertificate = brand.BrandAuthPic; model.ShopId = shopId; model.ApplyTime = DateTime.Now; var oldapply = _iBrandService.GetExistApply(shopId, model.BrandName); if (oldapply == null) { _iBrandService.ApplyBrand(model); return(Json(new Result() { success = true, msg = "申请成功!" })); } else { var oBrand = BrandApplication.GetBrand(oldapply.BrandId); if (oBrand != null && oBrand.IsDeleted) { model.Id = oldapply.Id; } else { if (oldapply.AuditStatus == (int)Entities.ShopBrandApplyInfo.BrandAuditStatus.UnAudit) { return(Json(new Result() { success = false, msg = "该品牌正在审核中!" })); } else if (oldapply.AuditStatus == (int)Entities.ShopBrandApplyInfo.BrandAuditStatus.Audited) { return(Json(new Result() { success = false, msg = "该品牌已存在,请选择申请已有品牌!" })); } } model.AuditStatus = 0; _iBrandService.UpdateApplyBrand(model); return(Json(new Result() { success = true, msg = "申请成功!" })); } }