private void btnFinishAdd_Click(object sender, EventArgs e) { FormulaFinishProduct objFormulaFinishProduct = new FormulaFinishProduct(); try { if (cmbBasicProducts.Items.Count > 0) { objFormulaFinishProduct.FinishProduct = objFinishProductDL.Get(cmbFinishProducts.SelectedValue.ToString()); objFormulaFinishProduct.Formula = objFormula; objFormulaFinishProduct.FormulaPart = cmbFinishPart.SelectedItem.ToString(); objFormulaFinishProduct.FormulaProductQty = Convert.ToDecimal(txtFinishProductQty.Text); objFormulaFinishProductDL.Add(objFormulaFinishProduct, CurrentUser.UserEmp); bindFinishProduct.DataSource = objFormulaFinishProductDL.GetDataView_FormulaID(objFormula.FormulaID); bindItemList.DataSource = objFormulaDL.GetDataView_Items(objFormula.FormulaID); } } catch (FormatException fex) { MessageBox.Show(this, "Quantity should be a Numaric value", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } catch (Exception ex) { MessageBox.Show(this, ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } finally { objFormulaFinishProduct = null; } }
public int Update(FormulaFinishProduct obj) { try { SqlParameter[] paramList = new SqlParameter[] { new SqlParameter("@FormulaPart", obj.FormulaPart), new SqlParameter("@FormulaQty", obj.FormulaProductQty), new SqlParameter("@Original_FormulaID", obj.Formula.FormulaID), new SqlParameter("@Original_FormulaFinishProductCode", obj.FinishProduct.FinishProductCode)}; return Execute.RunSP_RowsEffected(Connection, "SPUPDATE_FormulaFinishProduct", paramList); } catch (Exception ex) { throw new Exception(ex.Message, ex); } }
private void cmbFinishPart_SelectedIndexChanged(object sender, EventArgs e) { FormulaFinishProduct objFormulaFinishProduct = new FormulaFinishProduct(); try { if (cmbFinishPart.SelectedIndex != -1) { txtFinishProductQty.Text = "0.00"; lblFinishUnit.Text = ""; SelectFinish = false; if (cmbFinishProducts.Items.Count > 0 && cmbFinishProducts.SelectedItem != null) { FinishProduct objFinishProduct = objFinishProductDL.Get(cmbFinishProducts.SelectedValue.ToString()); lblFinishUnit.Text = objFinishProduct.FinishProductPackingType.PackingTitle; if (objFormula.FormulaID != 0) { objFormulaFinishProduct = objFormulaFinishProductDL.Get(objFormula.FormulaID, objFinishProduct.FinishProductCode, cmbFinishPart.SelectedItem.ToString()); if (objFormulaFinishProduct.Formula != null) { txtFinishProductQty.Text = objFormulaFinishProduct.FormulaProductQty.ToString(); //cmbFinishPart.SelectedItem = objFormulaFinishProduct.FormulaPart.Trim(); SelectFinish = true; } } } } } catch (Exception ex) { MessageBox.Show(this, ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } finally { objFormulaFinishProduct = null; } }
public int Add(FormulaFinishProduct obj,Employee objEmployee) { try { SqlParameter[] paramList = new SqlParameter[] { new SqlParameter("@FormulaID", obj.Formula.FormulaID), new SqlParameter("@FormulaFinishProductCode", obj.FinishProduct.FinishProductCode), new SqlParameter("@FormulaPart", obj.FormulaPart), new SqlParameter("@FormulaProductQty", obj.FormulaProductQty), new SqlParameter("@FormulaInstructedBy", objEmployee.EmployeeID)}; return Execute.RunSP_RowsEffected(Connection, "SPADD_FormulaBasicProduct", paramList); } catch (Exception ex) { throw new Exception(ex.Message, ex); } }
public FormulaFinishProduct Get(long FormulaID, String FinishProductCode , String FormulaPart) { try { SqlParameter[] paramList = new SqlParameter[] { new SqlParameter("@FormulaID", FormulaID), new SqlParameter("@FinishProductID", FinishProductCode), new SqlParameter("@FormulaPart", FormulaPart)}; DataTable dt = Execute.RunSP_DataTable(Connection, "SPGET_FormulaFinishProductByID", paramList); FormulaFinishProduct objFormulaFinishProduct = new FormulaFinishProduct(); objFormulaFinishProduct.FinishProduct = objFinishProduct_DL.Get(Convert.ToString(dt.Rows[0]["FinishProductID"])); objFormulaFinishProduct.Formula = objFormula_DL.Get(Convert.ToInt32(dt.Rows[0]["FormulaID"])); objFormulaFinishProduct.FormulaPart = Convert.ToString(dt.Rows[0]["FormulaPart"]); objFormulaFinishProduct.FormulaProductQty = Convert.ToDecimal(dt.Rows[0]["FormulaProductQty"]); return objFormulaFinishProduct; } catch (Exception ex) { throw new Exception(ex.Message, ex); } }