private void btnSaveInfo_Click(object sender, System.EventArgs e) { System.Data.DataTable dataTable = new System.Data.DataTable(); dataTable.Columns.Add("ProductId"); dataTable.Columns.Add("ShowSaleCounts"); if (this.grdSelectedProducts.Rows.Count > 0) { int num = 0; foreach (System.Web.UI.WebControls.GridViewRow gridViewRow in this.grdSelectedProducts.Rows) { int num2 = (int)this.grdSelectedProducts.DataKeys[gridViewRow.RowIndex].Value; System.Web.UI.WebControls.TextBox textBox = gridViewRow.FindControl("txtShowSaleCounts") as System.Web.UI.WebControls.TextBox; if (int.TryParse(textBox.Text.Trim(), out num) && num >= 0) { System.Data.DataRow dataRow = dataTable.NewRow(); dataRow["ProductId"] = num2; dataRow["ShowSaleCounts"] = num; dataTable.Rows.Add(dataRow); } } if (SubSiteProducthelper.UpdateShowSaleCounts(dataTable)) { this.ShowMsg("成功调整了前台显示的销售数量", true); } else { this.ShowMsg("调整前台显示的销售数量失败", false); } this.BindProduct(); } }
private void btnSaveInfo_Click(object sender, EventArgs e) { DataTable dt = new DataTable(); dt.Columns.Add("ProductId"); dt.Columns.Add("ShowSaleCounts"); if (this.grdSelectedProducts.Rows.Count > 0) { int result = 0; foreach (GridViewRow row in this.grdSelectedProducts.Rows) { int num = (int)this.grdSelectedProducts.DataKeys[row.RowIndex].Value; TextBox box = row.FindControl("txtShowSaleCounts") as TextBox; if (int.TryParse(box.Text.Trim(), out result) && (result >= 0)) { DataRow row2 = dt.NewRow(); row2["ProductId"] = num; row2["ShowSaleCounts"] = result; dt.Rows.Add(row2); } } if (SubSiteProducthelper.UpdateShowSaleCounts(dt)) { this.ShowMsg("成功调整了前台显示的销售数量", true); } else { this.ShowMsg("调整前台显示的销售数量失败", false); } this.BindProduct(); } }
private void btnOperationOK_Click(object sender, System.EventArgs e) { int num = 0; if (int.TryParse(this.txtOperationSaleCounts.Text.Trim(), out num) && num >= 0) { if (SubSiteProducthelper.UpdateShowSaleCounts(this.productIds, num, this.ddlOperation.SelectedValue)) { this.ShowMsg("成功调整了前台显示的销售数量", true); } else { this.ShowMsg("调整前台显示的销售数量失败", false); } this.BindProduct(); return; } this.ShowMsg("销售数量只能是正整数,请输入正确的销售数量", false); }
private void btnOperationOK_Click(object sender, EventArgs e) { int result = 0; if (!int.TryParse(this.txtOperationSaleCounts.Text.Trim(), out result) || (result < 0)) { this.ShowMsg("销售数量只能是正整数,请输入正确的销售数量", false); } else { if (SubSiteProducthelper.UpdateShowSaleCounts(this.productIds, result, this.ddlOperation.SelectedValue)) { this.ShowMsg("成功调整了前台显示的销售数量", true); } else { this.ShowMsg("调整前台显示的销售数量失败", false); } this.BindProduct(); } }