/// <summary> /// Function for new row added for Bom /// </summary> public void NewRowAddedForBom() { try { BomInfo infoBom = new BomInfo(); BomSP spBom = new BomSP(); for (int inI = 0; inI < dtblFromBomForUpdate.Rows.Count; inI++) { if (Convert.ToDecimal(dtblFromBomForUpdate.Rows[inI]["bomId"]) == 0) { infoBom.RowmaterialId = Convert.ToDecimal(dtblFromBomForUpdate.Rows[inI]["dgvcmbRawMaterial"]); infoBom.UnitId = Convert.ToDecimal(dtblFromBomForUpdate.Rows[inI]["dgvtxtUnitId"]); infoBom.Quantity = Convert.ToDecimal(dtblFromBomForUpdate.Rows[inI]["dgvtxtQty"]); infoBom.Extra1 = dtblFromBomForUpdate.Rows[inI]["extra1"].ToString(); infoBom.Extra2 = dtblFromBomForUpdate.Rows[inI]["extra2"].ToString(); infoBom.ExtraDate = Convert.ToDateTime(dtblFromBomForUpdate.Rows[inI]["extraDate"]); spBom.BomFromDatatable(infoBom, decProductIdForEdit); } } } catch (Exception ex) { MessageBox.Show("PC:78" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// Function to add data to tbl_Bom /// </summary> public void BomTableFill() { try { BomInfo infoBom = new BomInfo(); BomSP spBom = new BomSP(); decimal decProductId; if (btnSave.Text == "Update") { decProductId = decProductIdForEdit; } else { decProductId = decSaveProduct; } for (int i = 0; i < dtblBom.Rows.Count; i++) { infoBom.RowmaterialId = Convert.ToDecimal(dtblBom.Rows[i]["dgvcmbRawMaterial"]); infoBom.UnitId = Convert.ToDecimal(dtblBom.Rows[i]["dgvtxtUnitId"]); infoBom.Quantity = Convert.ToDecimal(dtblBom.Rows[i]["dgvtxtQty"]); infoBom.Extra1 = dtblBom.Rows[i]["extra1"].ToString(); infoBom.Extra2 = dtblBom.Rows[i]["extra2"].ToString(); infoBom.ExtraDate = Convert.ToDateTime(dtblBom.Rows[i]["extraDate"]); spBom.BomFromDatatable(infoBom, decProductId); } } catch (Exception ex) { MessageBox.Show("PC:2" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }