/// <summary>
 /// Function to save the Pricinglevel
 /// </summary>
 public void SaveFunction()
 {
     try
     {
         PricingLevelBll BllPricingLevel = new PricingLevelBll();
         PricingLevelInfo infoPricingLevel = new PricingLevelInfo();
         infoPricingLevel.PricinglevelName = txtPricingLevelName.Text.Trim();
         infoPricingLevel.Narration = txtNarration.Text.Trim();
         infoPricingLevel.Extra1 = string.Empty;
         infoPricingLevel.Extra2 = string.Empty;
         if (BllPricingLevel.PricingLevelCheckIfExist(txtPricingLevelName.Text.Trim().ToString(), 0) == false)
         {
             decPricingLevelId = BllPricingLevel.PricingLevelAddWithoutSamePricingLevel(infoPricingLevel);
             Messages.SavedMessage();
             Clear();
             decIdforOtherForms = decPricingLevelId;
             if (frmCustomerObj != null)
             {
                 this.Close();
             }
             if (frmSalesReturnObj != null)
             {
                 this.Close();
             }
             if (frmSalesInvoiceObj != null)
             {
                 this.Close();
             }
         }
         else
         {
             Messages.InformationMessage("Pricing level name already exist");
             txtPricingLevelName.Focus();
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("PL1" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
 /// <summary>
 /// Function to edit the Pricing level
 /// </summary>
 public void EditFunction()
 {
     try
     {
         PricingLevelBll BllPricingLevel = new PricingLevelBll();
         PricingLevelInfo infoPricingLevel = new PricingLevelInfo();
         infoPricingLevel.PricinglevelName = txtPricingLevelName.Text.Trim();
         infoPricingLevel.Narration = txtNarration.Text.Trim();
         infoPricingLevel.Extra1 = string.Empty;
         infoPricingLevel.Extra2 = string.Empty;
         infoPricingLevel.PricinglevelId = Convert.ToDecimal(dgvPricingLevel.CurrentRow.Cells[1].Value.ToString());
         if (txtPricingLevelName.Text.ToString() != strPricingLevel)
         {
             if (BllPricingLevel.PricingLevelCheckIfExist(txtPricingLevelName.Text.Trim().ToString(), decPricingLevel) == false)
             {
                 if (BllPricingLevel.PricingLevelEditParticularFields(infoPricingLevel))
                 {
                     Messages.UpdatedMessage();
                     Clear();
                 }
                 else if (infoPricingLevel.PricinglevelId == 1)
                 {
                     Messages.InformationMessage("Cannot update");
                     Clear();
                     txtPricingLevelName.Focus();
                 }
             }
             else
             {
                 Messages.InformationMessage("Pricing level name already exist");
                 txtPricingLevelName.Focus();
             }
         }
         else
         {
             BllPricingLevel.PricingLevelEditParticularFields(infoPricingLevel);
             Messages.UpdatedMessage();
             Clear();
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("PL2" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }