private void btnAdd_Click(object sender, EventArgs e) { DispatchNoteList objRemove = new DispatchNoteList(); DispatchNoteList obj = new DispatchNoteList(); if ((txtDiaptchNote.Text != "") && (cmbProductCode.SelectedValue != null) && (txtIssuedQty.Text != "")) { if (DataValidation.IsNumericNumber(txtIssuedQty.Text)) { if (txtBatchID.Text != "") { obj.BatchNo = txtBatchID.Text; } else { obj.BatchNo = "No"; } obj.DispatchID = txtDiaptchNote.Text; obj.FinishProduct = Convert.ToString(cmbProductCode.SelectedValue); obj.Qty = Convert.ToUInt32(txtIssuedQty.Text); obj.ProductName = objFinishProduct_DL.Get(obj.FinishProduct).FinishProductDescription; objCollec.Add(obj); } else { MessageBox.Show(this, "please enter valid quantity", "MRP System", MessageBoxButtons.OK); } } else { MessageBox.Show("Please Fill All Fields"); } gvProductList.AutoGenerateColumns = false; objSource.DataSource = objCollec; gvProductList.DataSource = objSource; objSource.ResetBindings(true); }
public int Add(DispatchNoteList obj, string StoreID) { try { SqlParameter[] paramList = new SqlParameter[] { new SqlParameter("@DispatchID", obj.DispatchID), new SqlParameter("@FinishProduct", obj.FinishProduct), new SqlParameter("@BatchNo", obj.BatchNo), new SqlParameter("@Qty", obj.Qty), new SqlParameter("@StoreID", StoreID) }; return(Execute.RunSP_RowsEffected(Connection, "SPADD_DispatchNoteList", paramList)); } catch (Exception ex) { throw new Exception(ex.Message, ex); } }