/// <summary>
 /// Function to fill the fields while user double click on the datagridview
 /// </summary>
 public void FillControls()
 {
     try
     {
         PriceListInfo infoPricelist = new PriceListInfo();
         PriceListBll BllPriceList = new PriceListBll();
         infoPricelist.PricelistId = decpriceListId;
         infoPricelist = BllPriceList.PriceListView(decpriceListId);
         txtRate.Text = infoPricelist.Rate.ToString();
         ProductInfo infoProduct = new ProductInfo();
         ProductCreationBll BllProductCreation = new ProductCreationBll();
         infoProduct = BllProductCreation.PriceListPopUpView(decProductId);
         txtProductCode.Text = infoProduct.ProductCode;
         txtProductName.Text = infoProduct.ProductName;
         BatchInfo infobatch = new BatchInfo();
        // BatchSP spBatch = new BatchSP();
         BatchBll BllBatch = new BatchBll();
         infobatch = BllBatch.BatchView(decBatchId);
         cmbBatch.SelectedValue = infobatch.BatchId;
         UnitInfo infoUnit = new UnitInfo();
         UnitBll bllUnit = new UnitBll();
         infoUnit = bllUnit.UnitView(decUnitId);
         txtUnitName.Text = infoUnit.UnitName;
         PricingLevelInfo infoPricingLevel = new PricingLevelInfo();
         PricingLevelBll BllPricingLevel = new PricingLevelBll();
         infoPricingLevel = BllPricingLevel.PricingLevelView(decPriceLevelId);
         txtPricingLevel.Text = infoPricingLevel.PricinglevelName;
         txtProductName.ReadOnly = true;
         txtProductCode.ReadOnly = true;
         txtUnitName.ReadOnly = true;
         txtPricingLevel.ReadOnly = true;
     }
     catch (Exception ex)
     {
         MessageBox.Show("PLP9:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
 /// <summary>
 /// Function to execute while calling from frmPriceList form to add new pricelist for the product
 /// </summary>
 /// <param name="decPricingLevel"></param>
 /// <param name="decProduct"></param>
 /// <param name="decPriceListId"></param>
 /// <param name="frmPriceList"></param>
 public void CallFromPriceListForPricingLevel(decimal decPricingLevel, decimal decProduct, decimal decPriceListId, frmPriceList frmPriceList)
 {
     try
     {
         ProductInfo infoProduct = new ProductInfo();
         ProductCreationBll BllProductCreation = new ProductCreationBll();
         UnitBll bllUnit = new UnitBll();
         UnitInfo infoUnit = new UnitInfo();
         PriceListBll BllPriceList = new PriceListBll();
         PriceListInfo infoPriceList = new PriceListInfo();
         PricingLevelBll BllPricingLevel = new PricingLevelBll();
         PricingLevelInfo infoPricingLevel = new PricingLevelInfo();
         infoProduct = BllProductCreation.PriceListPopUpView(decProduct);
         txtProductCode.Text = infoProduct.ProductCode;
         txtProductName.Text = infoProduct.ProductName;
         decProduct = infoProduct.ProductId;
         decProductMain = infoProduct.ProductId;
         infoUnit = bllUnit.UnitViewForPriceListPopUp(decProduct);
         decUnitId = infoUnit.UnitId;
         txtUnitName.Text = infoUnit.UnitName;
         decPriceLevelId = infoPriceList.PricinglevelId;
         infoPricingLevel = BllPricingLevel.PricingLevelNameViewForPriceListPopUp(decPricingLevel, decProduct, decUnitId);
         decPriceLevelId = infoPricingLevel.PricinglevelId;
         txtPricingLevel.Text = infoPricingLevel.PricinglevelName;
         if (txtPricingLevel.Text == string.Empty)
         {
             infoPricingLevel = BllPricingLevel.PricingLevelView(decPricingLevel);
             txtPricingLevel.Text = infoPricingLevel.PricinglevelName;
         }
         decPricingLevelMain = infoPricingLevel.PricinglevelId;
         txtPricingLevel.ReadOnly = true;
         txtProductCode.ReadOnly = true;
         txtProductName.ReadOnly = true;
         txtUnitName.ReadOnly = true;
         txtRate.Focus();
         BatchUnderProductComboFill(decProduct);
         PriceListPopupGridFill();
         deca = decPriceListId;
         this.frmPriceListobj = frmPriceList;
     }
     catch (Exception ex)
     {
         MessageBox.Show("PLP1" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }