private void btnAdd_Click(object sender, EventArgs e) { string address = Globals.StripAllTags(this.txtAddress.Text); string text = this.txtTel.Text; string text2 = this.txtContactMan.Text; ManagerInfo manager = HiContext.Current.Manager; SupplierInfo supplierById = SupplierHelper.GetSupplierById(manager.StoreId); if (!this.dropRegion.GetSelectedRegionId().HasValue) { this.ShowMsg("请选择供应商所在区域!", false); } else if (text2.Length > 8 || text2.Length < 2) { this.ShowMsg("请输入联系人,联系人长度必须是2-8位!", false); } else if (text == "" || !DataHelper.IsTel(text)) { this.ShowMsg("请输入正确的联系电话(手机或者固定电话)!", false); } else { supplierById.RegionId = this.dropRegion.GetSelectedRegionId().Value; supplierById.Tel = text; supplierById.Address = address; supplierById.ContactMan = text2; supplierById.WXOpenId = Globals.StripAllTags(this.txtWxOpenId.Text); supplierById.FullRegionPath = RegionHelper.GetFullPath(supplierById.RegionId, true); supplierById.Introduce = this.editDescription.Text; SupplierHelper.UpdateSupplier(supplierById); this.ShowMsg("保存成功", true); } }
private void btnEditShipper_Click(object sender, System.EventArgs e) { SupplierInfo supplierInfo = new SupplierInfo(); supplierInfo.SupplierId = supplierId; supplierInfo.SupplierName = this.txtSupplierName.Text.Trim(); supplierInfo.ShopName = this.txtShopName.Text.Trim(); supplierInfo.SupplierCode = this.txtSupplierCode.Text.Trim(); supplierInfo.ShipWarehouseName = this.txtWarehouseName.Text.Trim(); if (!this.ddlReggion.GetSelectedRegionId().HasValue) { this.ShowMsg("请选择地区", false); return; } supplierInfo.County = this.ddlReggion.GetSelectedRegionId().Value; supplierInfo.Address = this.txtAddress.Text.Trim(); supplierInfo.Phone = this.txtPhone.Text.Trim(); supplierInfo.Mobile = this.txtMobile.Text.Trim(); supplierInfo.Description = this.txtDescription.Text.Trim(); supplierInfo.ApproveKey = this.ckbApproveKey.Checked; supplierInfo.ShopOwner = this.txtSupplierOwnerName.Text.Trim(); supplierInfo.Logo = this.fmSrc1.Value; supplierInfo.PCImage = this.fmSrc2.Value; supplierInfo.MobileImage = this.fmSrc3.Value; this.littlepic1.Src = supplierInfo.Logo; this.littlepic2.Src = supplierInfo.PCImage; this.littlepic3.Src = supplierInfo.MobileImage; supplierInfo.Contact = txtContact.Text.Trim(); supplierInfo.Email = txtEmail.Text.Trim(); supplierInfo.Fax = txtFax.Text.Trim(); supplierInfo.Category = txtCategory.Text.Trim(); supplierInfo.BeneficiaryName = txtBeneficiaryName.Text.Trim(); supplierInfo.SwiftCode = txtSwiftCode.Text.Trim(); supplierInfo.BankAccount = txtBankAccount.Text.Trim(); supplierInfo.BankName = txtBankName.Text.Trim(); supplierInfo.BankAddress = txtBankAddress.Text.Trim(); supplierInfo.IBAN = txtIBAN.Text.Trim(); supplierInfo.Remark = TtxtRemark.Text.Trim(); if (string.IsNullOrEmpty(supplierInfo.Phone) && string.IsNullOrEmpty(supplierInfo.Mobile)) { this.ShowMsg("手机号码和电话号码必填其一", false); return; } if (SupplierHelper.UpdateSupplier(supplierInfo)) { this.ShowMsg("修改成功", true); return; } this.ShowMsg("修改失败", false); }
private void UpdateSupplier() { SupplierInfo supplierById = SupplierHelper.GetSupplierById(this.supplierId); ManagerInfo managerInfo = ManagerHelper.FindManagerByStoreId(this.supplierId, SystemRoles.SupplierAdmin); if (managerInfo == null || supplierById == null) { base.Response.Redirect("SupplierList.aspx"); } string supplierName = Globals.StripAllTags(this.txtSupplierName.Text.Trim()); string text = Globals.StripAllTags(this.txtAddress.Text); string text2 = this.txtTel.Text; string text3 = Globals.StripAllTags(this.txtContactMan.Text); if (SupplierHelper.ExistSupplierName(this.supplierId, supplierName)) { this.ShowMsg("供应商名称已经存在,请重新输入!", false); } else if (!this.dropRegion.GetSelectedRegionId().HasValue) { this.ShowMsg("请选择供应商所在区域!", false); } else if (text3.Length > 8 || text3.Length < 2) { this.ShowMsg("请输入联系人,联系人长度必须是2-8位!", false); } else if (text.Length > 50 || text.Length < 2) { this.ShowMsg("请输入地址,长度必须为2-50个字符!", false); } else if (text2 == "" || !DataHelper.IsTel(text2)) { this.ShowMsg("请输入正确的联系电话(手机或者固定电话)!", false); } else { int value = this.dropRegion.GetSelectedRegionId().Value; supplierById.SupplierName = supplierName; supplierById.Picture = this.UploadImage(); supplierById.Tel = text2; supplierById.Address = text; supplierById.ContactMan = text3; supplierById.RegionId = value; supplierById.FullRegionPath = RegionHelper.GetFullPath(value, true); supplierById.Introduce = this.editDescription.Text; SupplierHelper.UpdateSupplier(supplierById); } }
private void btnSaveTradePass_Click(object sender, EventArgs e) { ManagerInfo manager = HiContext.Current.Manager; SupplierInfo supplierById = SupplierHelper.GetSupplierById(manager.StoreId); if (manager == null || supplierById == null) { this.ShowMsg("参数错误,请找管理员处理!", false); } else { if (!string.IsNullOrEmpty(supplierById.TradePassword)) { string strA = Users.EncodePassword(this.txtoldTradePassword.Text, supplierById.TradePasswordSalt); if (string.Compare(strA, supplierById.TradePassword) != 0) { this.ShowMsg("输入的当前交易密码与原始交易密码不一致,请正确输入!", false); return; } } if (this.txtTradePassword.Text.Length < 6 || this.txtTradePassword.Text.Length > 20) { this.ShowMsg("交易密码长度必须为6-20个字符!", false); } else if (string.Compare(this.txtTradePassword.Text, this.txtTradePasswordConfirm.Text) != 0) { this.ShowMsg("请确保两次输入的密码相同", false); } else { string text = Globals.RndStr(128, true); string text3 = supplierById.TradePassword = Users.EncodePassword(this.txtTradePassword.Text, text); supplierById.TradePasswordSalt = text; if (SupplierHelper.UpdateSupplier(supplierById)) { this.ShowMsg("修改交易密码成功", true, "PassWordManage.aspx"); } else { this.ShowMsg("修改交易密码失败", true); } } } }
private void EmptySupplierTransactionPass(HttpContext context) { int num = context.Request["supplierId"].ToInt(0); string empty = string.Empty; if (num <= 0) { empty = "{\"success\":\"false\",\"msg\":\"参数错误,请勿操作!\"}"; this.ResponseEnd(empty); } SupplierInfo supplierById = SupplierHelper.GetSupplierById(num); if (supplierById == null || supplierById.SupplierId <= 0) { empty = "{\"success\":\"false\",\"msg\":\"供应商已不存在,请重新加载列表进行操作!!\"}"; this.ResponseEnd(empty); } supplierById.TradePassword = ""; supplierById.TradePasswordSalt = ""; empty = ((!SupplierHelper.UpdateSupplier(supplierById)) ? "{\"success\":\"false\",\"msg\":\"清空交易密码失败!!\"}" : "{\"success\":\"true\",\"msg\":\"清空成功,请去供应商后台重新设置交易密码!\"}"); this.ResponseEnd(empty); }