public frmAssignPrice(SalesFinishProducts obj, int type) { InitializeComponent(); txt_ProductID.Text = obj.finishProductCode; txt_Name.Text = obj.finishProductName; txt_Price.Text = obj.price.ToString(); cmb_Sate.SelectedIndex = obj.isSellable; this.type = type; }
private void btn_save_Click(object sender, EventArgs e) { if (txt_Name.Text.Trim().ToString() == "" && txt_Price.Text.Trim().ToString() == "") { MessageBox.Show("Please fill all the details to continue...!", "Fill Details", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } if (txt_Name.Text.Trim().ToString() == "") { MessageBox.Show("Please fill Name to continue...!", "Fill Details", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } if (txt_Price.Text.Trim().ToString() == "") { MessageBox.Show("Please fill Price to continue...!", "Fill Details", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } if (!IsValidPrice(txt_Price.Text.Trim().ToString())) { MessageBox.Show("Please fill Price as a valid number to continue...!", "Numbers Only", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } SalesFinishProducts obj = new SalesFinishProducts(); obj.finishProductCode = txt_ProductID.Text.Trim().ToString(); obj.finishProductName = txt_Name.Text.Trim().ToString(); obj.isSellable = cmb_Sate.SelectedIndex; obj.price = double.Parse(txt_Price.Text.Trim().ToString()); long rows = 0; if (type == 0) { rows = sfp.UpdateSalesFinishProduct(obj); } else { rows = sfp.AddSalesFinishProduct(obj); } if (rows > 0) { this.Close(); return; } else { MessageBox.Show("Recode is not added. Please try again...!", "Change Details", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } }
private void grid_add_price_CellClick(object sender, DataGridViewCellEventArgs e) { if (e.ColumnIndex == 0) { SalesFinishProducts obj = new SalesFinishProducts(); obj.finishProductCode = grid_add_price.Rows[e.RowIndex].Cells[e.ColumnIndex + 1].Value.ToString(); obj.finishProductName = grid_add_price.Rows[e.RowIndex].Cells[e.ColumnIndex + 2].Value.ToString(); obj.price = 0.00; obj.isSellable = 0; frmAssignPrice frm = new frmAssignPrice(obj, 1); frm.ShowDialog(); grid_change_price.DataSource = sfp.GetSalesFinishProduct(); grid_add_price.DataSource = sfp.GetSalesFinishProduct_NOTSET(); } }
public long UpdateSalesFinishProduct(SalesFinishProducts obj) { try { SqlParameter[] paramList = new SqlParameter[] { new SqlParameter("@FinishProductCode", obj.finishProductCode), new SqlParameter("@FinishedProductName ", obj.finishProductName), new SqlParameter("@IsSellable", obj.isSellable), new SqlParameter("@MRP", obj.price) }; return(Execute.RunSP_RowsEffected(Connection, "SPUPDATE_SalesFinishProduct", paramList)); } catch (Exception ex) { throw new Exception(ex.Message, ex); } }
private void grid_change_price_CellClick(object sender, DataGridViewCellEventArgs e) { if (e.ColumnIndex == 0) { SalesFinishProducts obj = new SalesFinishProducts(); obj.finishProductCode = grid_change_price.Rows[e.RowIndex].Cells[e.ColumnIndex + 1].Value.ToString(); obj.finishProductName = grid_change_price.Rows[e.RowIndex].Cells[e.ColumnIndex + 2].Value.ToString(); string state = grid_change_price.Rows[e.RowIndex].Cells[e.ColumnIndex + 3].Value.ToString(); obj.price = double.Parse(grid_change_price.Rows[e.RowIndex].Cells[e.ColumnIndex + 4].Value.ToString()); obj.isSellable = 0; if (state != "Non Selling Item") { obj.isSellable = 1; } frmAssignPrice frm = new frmAssignPrice(obj, 0); frm.ShowDialog(); grid_change_price.DataSource = sfp.GetSalesFinishProduct(); grid_add_price.DataSource = sfp.GetSalesFinishProduct_NOTSET(); } }