/// <summary>
 /// Function to delete 
 /// </summary>
 public void Delete()
 {
     try
     {
         SalesOrderBll bllSalesOrder = new SalesOrderBll();
         decimal decResult1 = 0;
         for (int inI = 0; inI < dgvSalesOrder.Rows.Count - 1; inI++)
         {
             if (Convert.ToDecimal(dgvSalesOrder.Rows[inI].Cells["dgvtxtSalesOrderDetailsId"].Value) != 0)
             {
                 decResult1 = bllSalesOrder.SalesOrderDetailsDeletee(Convert.ToDecimal(dgvSalesOrder.Rows[inI].Cells["dgvtxtSalesOrderDetailsId"].Value));
             }
         }
         decimal decResult2 = bllSalesOrder.SalesOrderMasterDelete(decSalesOrderMasterId);
         if (decResult1 > 0 && decResult2 > 0)
         {
             Messages.DeletedMessage();
             if (frmSalesOrderRegisterObj != null)
             {
                 this.Close();
                 frmSalesOrderRegisterObj.Enabled = true;
             }
             if (frmSalesOrderReportObj != null)
             {
                 this.Close();
                 frmSalesOrderReportObj.Enabled = true;
             }
             if (objVoucherSearch != null)
             {
                 this.Close();
                 objVoucherSearch.Enabled = true;
             }
             if (frmDayBookObj != null)
             {
                 this.Close();
             }
         }
         else
         {
             Messages.ReferenceExistsMessage();
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("SO53:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }