private void btnUpdateLine_Click(object sender, System.EventArgs e) { int num = 0; string text = base.Request.Form["CheckBoxGroup"]; if (string.IsNullOrEmpty(text)) { this.ShowMsg("请先选择要转移的商品", false); return; } SendMessageHelper.SendMessageToDistributors(text + "|" + this.dropProductLines.SelectedItem.Text, 6); string[] array = text.Split(new char[] { ',' }); string[] array2 = array; for (int i = 0; i < array2.Length; i++) { string s = array2[i]; if (ProductLineHelper.UpdateProductLine(System.Convert.ToInt32(this.hdProductLine.Value), int.Parse(s))) { num++; } } if (num > 0) { this.BindProducts(); this.ShowMsg(string.Format("成功转移了{0}件商品", num), true); return; } this.ShowMsg("转移商品失败", false); }
private void btnSave_Click(object sender, EventArgs e) { ProductLineInfo target = new ProductLineInfo(); target.LineId = lineId; target.Name = txtProductLineName.Text.Trim(); target.SupplierName = (dropSuppliers.SelectedValue.Length > 0) ? dropSuppliers.SelectedValue : null; ValidationResults results = Hishop.Components.Validation.Validation.Validate <ProductLineInfo>(target, new string[] { "ValProductLine" }); string msg = string.Empty; if (!results.IsValid) { foreach (ValidationResult result in (IEnumerable <ValidationResult>)results) { msg = msg + Formatter.FormatErrorMessage(result.Message); } ShowMsg(msg, false); } else if (ProductLineHelper.UpdateProductLine(target)) { ShowMsg("已经成功修改当前产品线信息", true); } else { ShowMsg("修改产品线失败", false); } }
private void btnUpdateLine_Click(object sender, EventArgs e) { int num = 0; string str = base.Request.Form["CheckBoxGroup"]; if (string.IsNullOrEmpty(str)) { this.ShowMsg("请先选择要转移的商品", false); } else { SendMessageHelper.SendMessageToDistributors(str + "|" + this.dropProductLines.SelectedItem.Text, 6); foreach (string str2 in str.Split(new char[] { ',' })) { if (ProductLineHelper.UpdateProductLine(Convert.ToInt32(this.hdProductLine.Value), int.Parse(str2))) { num++; } } if (num > 0) { this.BindProducts(); this.ShowMsg(string.Format("成功转移了{0}件商品", num), true); } else { this.ShowMsg("转移商品失败", false); } } }
private void btnCreate_Click(object sender, System.EventArgs e) { ProductLineInfo productLineInfo = new ProductLineInfo { Name = this.txtProductLineName.Text.Trim(), SupplierName = (this.dropSuppliers.SelectedValue.Length > 0) ? this.dropSuppliers.SelectedValue : null }; ValidationResults validationResults = Validation.Validate <ProductLineInfo>(productLineInfo, new string[] { "ValProductLine" }); string text = string.Empty; if (!validationResults.IsValid) { foreach (ValidationResult current in (System.Collections.Generic.IEnumerable <ValidationResult>)validationResults) { text += Formatter.FormatErrorMessage(current.Message); } this.ShowMsg(text, false); return; } if (ProductLineHelper.AddProductLine(productLineInfo)) { this.Reset(); this.ShowMsg("成功的添加了一条产品线", true); return; } this.ShowMsg("添加产品线失败", false); }
protected void btnSaveCategory_Click(object sender, EventArgs e) { if (!this.dropProductLineFrom.SelectedValue.HasValue || !this.dropProductLineFromTo.SelectedValue.HasValue) { this.ShowMsg("请选择需要替换的产品线或需要替换至的产品线", false); } else if (this.dropProductLineFrom.SelectedValue.Value == this.dropProductLineFromTo.SelectedValue.Value) { this.ShowMsg("请选择不同的产品进行替换", false); } else { string text = this.dropProductLineFrom.SelectedItem.Text; string str2 = this.dropProductLineFromTo.SelectedItem.Text; string str3 = this.dropProductLineFrom.SelectedValue.ToString(); SendMessageHelper.SendMessageToDistributors(str3 + "|" + text + "|" + str2, 4); if (!ProductLineHelper.ReplaceProductLine(Convert.ToInt32(str3), Convert.ToInt32(this.dropProductLineFromTo.SelectedValue))) { this.ShowMsg("产品线批量转移商品失败", false); } else { this.ShowMsg("产品线批量转移商品成功", true); } } }
protected void btnSaveCategory_Click(object sender, System.EventArgs e) { if (!this.dropProductLineFrom.SelectedValue.HasValue || !this.dropProductLineFromTo.SelectedValue.HasValue) { this.ShowMsg("请选择需要替换的产品线或需要替换至的产品线", false); return; } if (this.dropProductLineFrom.SelectedValue.Value == this.dropProductLineFromTo.SelectedValue.Value) { this.ShowMsg("请选择不同的产品进行替换", false); return; } string text = this.dropProductLineFrom.SelectedItem.Text; string text2 = this.dropProductLineFromTo.SelectedItem.Text; string text3 = this.dropProductLineFrom.SelectedValue.ToString(); SendMessageHelper.SendMessageToDistributors(string.Concat(new string[] { text3, "|", text, "|", text2 }), 4); if (!ProductLineHelper.ReplaceProductLine(System.Convert.ToInt32(text3), System.Convert.ToInt32(this.dropProductLineFromTo.SelectedValue))) { this.ShowMsg("产品线批量转移商品失败", false); return; } this.ShowMsg("产品线批量转移商品成功", true); }
private void btnCreate_Click(object sender, EventArgs e) { ProductLineInfo info2 = new ProductLineInfo(); info2.Name = this.txtProductLineName.Text.Trim(); info2.SupplierName = (this.dropSuppliers.SelectedValue.Length > 0) ? this.dropSuppliers.SelectedValue : null; ProductLineInfo target = info2; ValidationResults results = Hishop.Components.Validation.Validation.Validate <ProductLineInfo>(target, new string[] { "ValProductLine" }); string msg = string.Empty; if (!results.IsValid) { foreach (ValidationResult result in (IEnumerable <ValidationResult>)results) { msg = msg + Formatter.FormatErrorMessage(result.Message); } this.ShowMsg(msg, false); } else if (ProductLineHelper.AddProductLine(target)) { this.Reset(); this.ShowMsg("成功的添加了一条产品线", true); } else { this.ShowMsg("添加产品线失败", false); } }
public override void DataBind() { this.Items.Clear(); foreach (ProductLineInfo info in ProductLineHelper.GetProductLineList()) { this.Items.Add(new ListItem(Globals.HtmlDecode(info.Name), info.LineId.ToString())); } }
public override void DataBind() { this.Items.Clear(); IList <ProductLineInfo> productLineList = ProductLineHelper.GetProductLineList(); foreach (ProductLineInfo current in productLineList) { this.Items.Add(new ListItem(Globals.HtmlDecode(current.Name), current.LineId.ToString())); } }
private void grdProductLine_RowDeleting(object sender, System.Web.UI.WebControls.GridViewDeleteEventArgs e) { int lineId = (int)this.grdProductLine.DataKeys[e.RowIndex].Value; if (ProductLineHelper.DeleteProductLine(lineId)) { this.BindData(); this.ShowMsg("成功删除了已选定的产品线", true); return; } this.ShowMsg("不能删除有商品的产品线或最后一个产品线", false); }
protected void Page_Load(object sender, EventArgs e) { this.btnCreate.Click += new EventHandler(this.btnCreate_Click); if (!this.Page.IsPostBack) { this.dropSuppliers.Items.Add(new ListItem("-请选择-", "")); foreach (string str in ProductLineHelper.GetSuppliers()) { this.dropSuppliers.Items.Add(new ListItem(str, str)); } } }
private void BindSuppliers() { Pagination page = new Pagination(); page.PageIndex = pager.PageIndex; page.PageSize = hrefPageSize.SelectedSize; DbQueryResult suppliers = ProductLineHelper.GetSuppliers(page); grdSuppliers.DataSource = suppliers.Data; grdSuppliers.DataBind(); pager1.TotalRecords = pager.TotalRecords = suppliers.TotalRecords; }
protected void btnOK_Click(object sender, EventArgs e) { IList <int> selectedProducts = SelectedProducts; try { int num = 0; if (selectedProducts.Count > 0) { if (!dropProductLine2.SelectedValue.HasValue) { ShowMsg("请选择要移动商品的产品线", false); } else { string str = ""; foreach (int num2 in selectedProducts) { str = str + num2.ToString() + ","; } if (str != "") { str = str.Substring(0, str.Length - 1); } AdminPage.SendMessageToDistributors(str + "|" + dropProductLine2.SelectedItem.Text, 6); foreach (int num3 in selectedProducts) { if (ProductLineHelper.UpdateProductLine(Convert.ToInt32(dropProductLine2.SelectedValue), num3)) { num++; } } if (num > 0) { BindProducts(); ShowMsg(string.Format("成功转移了{0}件商品", num), true); } else { ShowMsg("转移商品失败", false); } } } else { ShowMsg("请选择要转移的商品", false); } } catch (Exception) { ShowMsg("未知错误", false); } }
private void LoadControl() { ProductLineInfo productLine = ProductLineHelper.GetProductLine(this.lineId); if (productLine == null) { base.GotoResourceNotFound(); return; } Globals.EntityCoding(productLine, false); this.txtProductLineName.Text = productLine.Name; this.dropSuppliers.SelectedValue = productLine.SupplierName; }
private void DeleteSelected() { if (string.IsNullOrEmpty(base.Request.Form["CheckBoxGroup"])) { ShowMsg("请先勾选要删除的供货商!", false); } else { foreach (string str in base.Request.Form["CheckBoxGroup"].Split(new char[] { ',' })) { ProductLineHelper.DeleteSupplier(Globals.HtmlEncode(str)); } } }
private void grdProductLine_RowDeleting(object sender, GridViewDeleteEventArgs e) { int lineId = (int)grdProductLine.DataKeys[e.RowIndex].Value; if (ProductLineHelper.DeleteProductLine(lineId)) { BindData(); ShowMsg("成功删除了已选定的产品线", true); } else { ShowMsg("不能删除有商品的产品线或最后一个产品线", false); } }
private void BindSuppliers() { Pagination page = new Pagination { PageIndex = this.pager.PageIndex, PageSize = this.hrefPageSize.SelectedSize }; DbQueryResult suppliers = ProductLineHelper.GetSuppliers(page); this.grdSuppliers.DataSource = suppliers.Data; this.grdSuppliers.DataBind(); Pager arg_67_0 = this.pager1; int totalRecords; this.pager.TotalRecords = totalRecords = suppliers.TotalRecords; arg_67_0.TotalRecords = totalRecords; }
private void DeleteSelected() { if (string.IsNullOrEmpty(base.Request.Form["CheckBoxGroup"])) { this.ShowMsg("请先勾选要删除的供货商!", false); return; } string[] array = base.Request.Form["CheckBoxGroup"].Split(new char[] { ',' }); string[] array2 = array; for (int i = 0; i < array2.Length; i++) { string textToFormat = array2[i]; ProductLineHelper.DeleteSupplier(Globals.HtmlEncode(textToFormat)); } }
protected void Page_Load(object sender, EventArgs e) { if (!int.TryParse(Page.Request.QueryString["LineId"], out lineId)) { base.GotoResourceNotFound(); } else { btnSave.Click += new EventHandler(btnSave_Click); if (!base.IsPostBack) { dropSuppliers.Items.Add(new ListItem("-请选择-", "")); foreach (string str in ProductLineHelper.GetSuppliers()) { dropSuppliers.Items.Add(new ListItem(str, str)); } LoadControl(); } } }
private void btnOk_Click(object sender, System.EventArgs e) { if (!this.CheckValues()) { return; } bool flag; if (this.chkAddFlag.Checked) { flag = ProductLineHelper.AddSupplier(Globals.HtmlEncode(this.txtSupplierName.Text.Replace(',', ' ')), Globals.HtmlEncode(this.txtSupplierDescription.Text)); } else { flag = ProductLineHelper.UpdateSupplier(Globals.HtmlEncode(this.txtOldSupplierName.Text), Globals.HtmlEncode(this.txtSupplierName.Text.Replace(',', ' ')), Globals.HtmlEncode(this.txtSupplierDescription.Text)); } if (!flag) { this.ShowMsg("操作失败,供货商名称不能重复!", false); return; } this.BindSuppliers(); }
private void btnOk_Click(object sender, EventArgs e) { if (CheckValues()) { bool flag; if (chkAddFlag.Checked) { flag = ProductLineHelper.AddSupplier(Globals.HtmlEncode(txtSupplierName.Text), Globals.HtmlEncode(txtSupplierDescription.Text)); } else { flag = ProductLineHelper.UpdateSupplier(Globals.HtmlEncode(txtOldSupplierName.Text), Globals.HtmlEncode(txtSupplierName.Text), Globals.HtmlEncode(txtSupplierDescription.Text)); } if (!flag) { ShowMsg("操作失败,供货商名称不能重复!", false); } else { BindSuppliers(); } } }
private void BindData() { grdProductLine.DataSource = ProductLineHelper.GetProductLines(); grdProductLine.DataBind(); }