private void InsertData(GridViewRow gRow) { DropDownList cmbSaleman = (DropDownList)gRow.Cells[2].FindControl("cmbSaleman"); TextBox txtQty = (TextBox)gRow.Cells[3].FindControl("txtQty"); PlanOrderSaleData data = new PlanOrderSaleData(); data.QTY = Convert.ToDouble(txtQty.Text == "" ? "0" : txtQty.Text); data.SALEMAN = Convert.ToDouble(cmbSaleman.SelectedItem.Value); data.SALENAME = cmbSaleman.SelectedItem.Text; if (ItemObj.InsertPlanOrderSale(data)) { SetGrvItem(this.lblStatus.Text); } else Appz.ClientAlert(this, ItemObj.ErrorMessage); }
private ArrayList GetData() { ArrayList arr = new ArrayList(); int month = Convert.ToInt16(Request["month"] == null ? "0" : Request["month"]); foreach (GridViewRow gRow in this.grvPlanOrderSale.Rows) { if (gRow.RowType == DataControlRowType.DataRow) { TextBox txtQty=(TextBox)gRow.Cells[3].FindControl("txtQtyEdit"); PlanOrderSaleData data = new PlanOrderSaleData(); data.MONTH = month; data.QTY = Convert.ToDouble(txtQty.Text == "" ? "0" : txtQty.Text); data.SALEMAN = Convert.ToDouble(gRow.Cells[4].Text); if (data.QTY == 0) Appz.ClientAlert(this, "¡ÃسÒÃкبӹǹÊÑè§"); arr.Add(data); } } return arr; }
public bool InsertPlanOrderSale(PlanOrderSaleData data) { bool ret = true; ret = VerifyData(data); if (ret) { DataTable dt = (DataTable)System.Web.HttpContext.Current.Session[sessionName]; if (dt != null) { ReOrder(dt); DataRow dRow = dt.NewRow(); dRow["RANK"] = Convert.ToDouble(dt.Rows.Count) + 1; dRow["SALEMAN"] = Convert.ToDouble(data.SALEMAN); dRow["QTY"] = Convert.ToDouble(data.QTY); dRow["SALENAME"] = data.SALENAME; dt.Rows.Add(dRow); System.Web.HttpContext.Current.Session[sessionName] = dt; } } return ret; }
private bool VerifyData(PlanOrderSaleData data) { bool ret = true; if (data.SALEMAN == 0) { ret = false; _error = "¡ÃسÒàÅ×Í¡¼Ùé¢ÒÂ"; } else if (data.QTY == 0) { ret = false; _error = "¡ÃسÒÃкبӹǹ"; } else if (IsDuplicate(data)) { ret = false; _error = "¼Ùé¢Ò«éÓ"; } return ret; }
private bool IsDuplicate(PlanOrderSaleData data) { bool ret = false; DataTable dt = (DataTable)System.Web.HttpContext.Current.Session[sessionName]; if (dt != null) { DataRow[] dRow = dt.Select("SALEMAN = " + data.SALEMAN.ToString() + " AND RANK <> " + data.LOID.ToString()); if (dRow != null) { ret = (dRow.Length > 0); } } return ret; }