/// <summary>
 /// Function to Edit tbl_Bom
 /// </summary>
 public void BomTableForUpdate()
 {
     try
     {
         ProductBomBll BllProductBom = new ProductBomBll();
         List<DataTable> listBom = new List<DataTable>();
         listBom = BllProductBom.ProduBomForEdit(decProductIdForEdit);
         dtblBomForEdit = listBom[0];
     }
     catch (Exception ex)
     {
         MessageBox.Show("PC:20" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
 /// <summary>
 /// Function to Edit tbl_Bom
 /// </summary>
 public void BomTableEditFill()
 {
     try
     {
         BomInfo infoBom = new BomInfo();
         ProductBomBll BllProductBom = new ProductBomBll();
         for (int i = 0; i < dtblFromBomForUpdate.Rows.Count; i++)
         {
             infoBom.RowmaterialId = Convert.ToDecimal(dtblFromBomForUpdate.Rows[i]["dgvcmbRawMaterial"]);
             infoBom.UnitId = Convert.ToDecimal(dtblFromBomForUpdate.Rows[i]["dgvtxtUnitId"]);
             infoBom.Quantity = Convert.ToDecimal(dtblFromBomForUpdate.Rows[i]["dgvtxtQty"]);
             infoBom.Extra1 = dtblFromBomForUpdate.Rows[i]["extra1"].ToString();
             infoBom.Extra2 = dtblFromBomForUpdate.Rows[i]["extra2"].ToString();
             infoBom.ExtraDate = Convert.ToDateTime(dtblFromBomForUpdate.Rows[i]["extraDate"]);
             infoBom.BomId = Convert.ToDecimal(dtblFromBomForUpdate.Rows[i]["bomId"]);
             infoBom.ProductId = decProductIdForEdit;
             BllProductBom.UpdateBom(infoBom);
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("PC:10" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
 /// <summary>
 /// Function to add data to tbl_Bom
 /// </summary>
 public void BomTableFill()
 {
     try
     {
         BomInfo infoBom = new BomInfo();
         ProductBomBll BllProductBom = new ProductBomBll();
         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"]);
             BllProductBom.BomFromDatatable(infoBom, decProductId);
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("PC:2" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
 /// <summary>
 /// Function to check data in Multiple Unit table
 /// </summary>
 public void BomDeleteFunction()
 {
     try
     {
         ProductBomBll BllProductBom = new ProductBomBll();
         BllProductBom.BomDeleteForUpdation(decProductIdForEdit);
     }
     catch (Exception ex)
     {
         MessageBox.Show("PC:12" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
 //-------------------------------------------------------------TaxBomComboFill--------------------------
 public void BomComboFill()
 {
     try
     {
         List<DataTable> listObj = new List<DataTable>();
         ProductBomBll BllProductBom = new ProductBomBll();
         listObj = BllProductBom.BomViewAll();
         cmbBom.DataSource = listObj[0];
         cmbBom.DisplayMember = "taxName";
         cmbBom.ValueMember = "taxId";
     }
     catch (Exception ex)
     {
         MessageBox.Show("PC:48" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
 /// <summary>
 /// Function for delete data from tbl_BOM
 /// </summary>
 public void RemoveBom()
 {
     try
     {
         BomInfo infoBom = new BomInfo();
         ProductBomBll BllProductBom = new ProductBomBll();
         int inC = 0;
         while (strArrOfRemoveForBom[inC] != null)
         {
             decimal decId = Convert.ToDecimal(strArrOfRemoveForBom[inC]);
             BllProductBom.BomRemoveRows(decId);
             inC++;
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("PC:65" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
 /// <summary>
 /// Function for new row added for Bom
 /// </summary>
 public void NewRowAddedForBom()
 {
     try
     {
         BomInfo infoBom = new BomInfo();
         ProductBomBll BllProductBom = new ProductBomBll();
         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"]);
                 BllProductBom.BomFromDatatable(infoBom, decProductIdForEdit);
             }
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("PC:78" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
 /// <summary>
 /// DeleteFunction checking conformation
 /// </summary>
 public void DeleteFunction()
 {
     try
     {
         ProductBomBll BllProductBom = new ProductBomBll();
         Messages.DeletedMessage();
         if (frmProductCreationObj != null)
         {
             bool isDeleted = true;
             frmProductCreationObj.ReciveDeleteConfirmation(isDeleted);
         }
         Clear();
         this.Close();
     }
     catch (Exception ex)
     {
         MessageBox.Show("PB:15" + ex.Message, "Open Miracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }