/* * Op=1 Insert Data * Op=2 Delete Data * Op=3 Read All Data * Op=4 Clear Data * Op=5 Update Data */ //ID, UserID, Particular, CurrentStock, Quantity, Remarks, Op public DataSet TempIndentItems(clsTempIndentItems obj) { try { connect(); SqlParameter[] param = new SqlParameter[8]; param[0] = new SqlParameter("@ID", obj._ID); param[1] = new SqlParameter("@UserID", obj._UserID); param[2] = new SqlParameter("@PartNo", obj._PartNo); param[3] = new SqlParameter("@Particular", obj._Particular); param[4] = new SqlParameter("@CurrentStock", obj._CurrentStock); param[5] = new SqlParameter("@Quantity", obj._Quantity); param[6] = new SqlParameter("@Remarks", obj._Remarks); param[7] = new SqlParameter("@Op", obj._Op); DataSet ds = SqlHelper.ExecuteDataset(co, "procTempIndentItems", param); return(ds); } catch { return(null); } finally { co.Close(); } }
void ClearTemp() { clsTempIndentItems obj = new clsTempIndentItems(); obj.UserID = Convert.ToInt32(Request.Cookies["User"].Value); obj.Op = 4; obj.TempIndentItems(obj); pnlIndentItems.Visible = true; }
protected void grdIndentItems_RowDeleting(object sender, GridViewDeleteEventArgs e) { clsTempIndentItems obj = new clsTempIndentItems(); obj.Op = 2; HiddenField hdID = (HiddenField)grdIndentItems.Rows[e.RowIndex].FindControl("hdID"); obj.ID = Convert.ToInt32(hdID.Value); obj.TempIndentItems(obj); LoadTempItems(); }
protected void grdIndentItems_RowUpdating(object sender, GridViewUpdateEventArgs e) { HiddenField hdEID = (HiddenField)grdIndentItems.Rows[e.RowIndex].FindControl("hdEID"); TextBox txtEEQuantity = (TextBox)grdIndentItems.Rows[e.RowIndex].FindControl("txtEEQuantity"); TextBox txtERemarks = (TextBox)grdIndentItems.Rows[e.RowIndex].FindControl("txtERemarks"); clsTempIndentItems obj = new clsTempIndentItems(); obj.Op = 5; obj.ID = Convert.ToInt32(hdEID.Value); obj.Quantity = Convert.ToInt32(txtEEQuantity.Text); obj.Remarks = txtERemarks.Text; obj.TempIndentItems(obj); grdIndentItems.EditIndex = -1; LoadTempItems(); }
void AddTempItemsToIndent(int IndentID) { clsTempIndentItems obj = new clsTempIndentItems(); obj.UserID = Convert.ToInt32(Request.Cookies["User"].Value); obj.Op = 3; DataTable dt = obj.TempIndentItems(obj).Tables[0]; foreach (DataRow dr in dt.Rows) { clsIndentItems objItems = new clsIndentItems(); objItems.Op = 1; objItems.IndentID = IndentID; objItems.PartNo = dr[2].ToString(); objItems.Particular = dr[3].ToString(); objItems.CurrentStock = Convert.ToInt32(dr[4]); objItems.Quantity = Convert.ToInt32(dr[5]); objItems.Remarks = dr[6].ToString(); objItems.IndentItemMaster(objItems); } }
protected void btnAdd_Click(object sender, EventArgs e) { if (lblPartNo.Text.Trim() != "" && txtCurrentStock.Text.Trim() != "" && txtQuantity.Text.Trim() != "") { clsTempIndentItems obj = new clsTempIndentItems(); obj.Op = 1; obj.UserID = Convert.ToInt32(Request.Cookies["User"].Value); //UserID, Particular, CurrentStock, Quantity, Remarks, Op obj.PartNo = txtPartNo.Text; obj.Particular = txtDetail.Text; obj.CurrentStock = Convert.ToInt32(txtCurrentStock.Text); obj.Quantity = Convert.ToInt32(txtQuantity.Text); obj.Remarks = txtRemarks.Text; obj.TempIndentItems(obj); LoadTempItems(); txtPartNo.Text = ""; txtDetail.Text = ""; txtCurrentStock.Text = ""; txtQuantity.Text = ""; } }
void LoadTempItems() { clsTempIndentItems obj = new clsTempIndentItems(); obj.UserID = Convert.ToInt32(Request.Cookies["User"].Value); obj.Op = 3; DataTable dt = obj.TempIndentItems(obj).Tables[0]; grdIndentItems.DataSource = dt; grdIndentItems.DataBind(); if (dt.Rows.Count > 0) { pnlIndentItems.Visible = false; btnSave.Visible = true; btnNew.Visible = true; } else { pnlIndentItems.Visible = true; btnSave.Visible = false; btnNew.Visible = false; } }