public decimal CreditNoteMasterEdit(CreditNoteMasterInfo creditnotemasterinfo)
 {
     decimal decResult = 0;
     try
     {
         decResult = SpCreditNoteMaster.CreditNoteMasterEdit(creditnotemasterinfo);
     }
     catch (Exception ex)
     {
         MessageBox.Show("CNB:5:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
     return decResult;
 }
 /// <summary>
 /// Function to insert values to account group Table
 /// </summary>
 /// <param name="creditnotemasterinfo"></param>
 /// <returns></returns>
 public decimal CreditNoteMasterAdd(CreditNoteMasterInfo creditnotemasterinfo)
 {
     decimal identity = 0;
     try
     {
         if (sqlcon.State == ConnectionState.Closed)
         {
             sqlcon.Open();
         }
         SqlCommand sccmd = new SqlCommand("CreditNoteMasterAdd", sqlcon);
         sccmd.CommandType = CommandType.StoredProcedure;
         SqlParameter sprmparam = new SqlParameter();
         sprmparam = sccmd.Parameters.Add("@voucherNo", SqlDbType.VarChar);
         sprmparam.Value = creditnotemasterinfo.VoucherNo;
         sprmparam = sccmd.Parameters.Add("@invoiceNo", SqlDbType.VarChar);
         sprmparam.Value = creditnotemasterinfo.InvoiceNo;
         sprmparam = sccmd.Parameters.Add("@suffixPrefixId", SqlDbType.Decimal);
         sprmparam.Value = creditnotemasterinfo.SuffixPrefixId;
         sprmparam = sccmd.Parameters.Add("@date", SqlDbType.DateTime);
         sprmparam.Value = creditnotemasterinfo.Date;
         sprmparam = sccmd.Parameters.Add("@userId", SqlDbType.Decimal);
         sprmparam.Value = creditnotemasterinfo.UserId;
         sprmparam = sccmd.Parameters.Add("@totalAmount", SqlDbType.Decimal);
         sprmparam.Value = creditnotemasterinfo.TotalAmount;
         sprmparam = sccmd.Parameters.Add("@narration", SqlDbType.VarChar);
         sprmparam.Value = creditnotemasterinfo.Narration;
         sprmparam = sccmd.Parameters.Add("@financialYearId", SqlDbType.Decimal);
         sprmparam.Value = creditnotemasterinfo.FinancialYearId;
         sprmparam = sccmd.Parameters.Add("@extra1", SqlDbType.VarChar);
         sprmparam.Value = creditnotemasterinfo.Extra1;
         sprmparam = sccmd.Parameters.Add("@extra2", SqlDbType.VarChar);
         sprmparam.Value = creditnotemasterinfo.Extra2;
         sprmparam = sccmd.Parameters.Add("@voucherTypeId", SqlDbType.Decimal);
         sprmparam.Value = creditnotemasterinfo.VoucherTypeId;
         identity = Convert.ToDecimal(sccmd.ExecuteScalar().ToString());
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.ToString());
     }
     finally
     {
         sqlcon.Close();
     }
     return identity;
 }
 public CreditNoteMasterInfo CreditNoteMasterView(decimal creditNoteMasterId)
 {
     CreditNoteMasterInfo InfoCreditNoteMaster = new CreditNoteMasterInfo();
     try
     {
         InfoCreditNoteMaster = SpCreditNoteMaster.CreditNoteMasterView(creditNoteMasterId);
     }
     catch (Exception ex)
     {
         MessageBox.Show("SB6:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
     return InfoCreditNoteMaster;
 }
 /// <summary>
 /// Function to get particular values from account CreditNoteMaster based on the parameter
 /// </summary>
 /// <param name="creditNoteMasterId"></param>
 /// <returns></returns>
 public CreditNoteMasterInfo CreditNoteMasterView(decimal creditNoteMasterId)
 {
     CreditNoteMasterInfo creditnotemasterinfo = new CreditNoteMasterInfo();
     try
     {
         creditnotemasterinfo = SpCreditNoteMaster.CreditNoteMasterView(creditNoteMasterId);
     }
     catch (Exception ex)
     {
         MessageBox.Show("CRNT:14" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
     return creditnotemasterinfo;
 }
 /// <summary>
 /// Function to insert values to account group Table
 /// </summary>
 /// <param name="creditnotemasterinfo"></param>
 /// <returns></returns>
 public decimal CreditNoteMasterAdd(CreditNoteMasterInfo creditnotemasterinfo)
 {
     decimal identity = 0;
     try
     {
         identity = SpCreditNoteMaster.CreditNoteMasterAdd(creditnotemasterinfo);
     }
     catch (Exception ex)
     {
         MessageBox.Show("CRNT:12" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
     return identity;
 }
 /// <summary>
 /// Function to get particular values from account CreditNoteMaster based on the parameter
 /// </summary>
 /// <param name="creditNoteMasterId"></param>
 /// <returns></returns>
 public CreditNoteMasterInfo CreditNoteMasterView(decimal creditNoteMasterId)
 {
     CreditNoteMasterInfo creditnotemasterinfo = new CreditNoteMasterInfo();
     SqlDataReader sdrreader = null;
     try
     {
         if (sqlcon.State == ConnectionState.Closed)
         {
             sqlcon.Open();
         }
         SqlCommand sccmd = new SqlCommand("CreditNoteMasterView", sqlcon);
         sccmd.CommandType = CommandType.StoredProcedure;
         SqlParameter sprmparam = new SqlParameter();
         sprmparam = sccmd.Parameters.Add("@creditNoteMasterId", SqlDbType.Decimal);
         sprmparam.Value = creditNoteMasterId;
         sdrreader = sccmd.ExecuteReader();
         while (sdrreader.Read())
         {
             creditnotemasterinfo.CreditNoteMasterId = decimal.Parse(sdrreader[0].ToString());
             creditnotemasterinfo.VoucherNo = sdrreader[1].ToString();
             creditnotemasterinfo.InvoiceNo = sdrreader[2].ToString();
             creditnotemasterinfo.SuffixPrefixId = decimal.Parse(sdrreader[3].ToString());
             creditnotemasterinfo.Date = DateTime.Parse(sdrreader[4].ToString());
             creditnotemasterinfo.VoucherTypeId = decimal.Parse(sdrreader[5].ToString());
             creditnotemasterinfo.UserId = decimal.Parse(sdrreader[6].ToString());
             creditnotemasterinfo.TotalAmount = decimal.Parse(sdrreader[7].ToString());
             creditnotemasterinfo.Narration = sdrreader[8].ToString();
             creditnotemasterinfo.FinancialYearId = decimal.Parse(sdrreader[9].ToString());
             creditnotemasterinfo.ExtraDate = DateTime.Parse(sdrreader[10].ToString());
             creditnotemasterinfo.Extra1 = sdrreader[11].ToString();
             creditnotemasterinfo.Extra2 = sdrreader[12].ToString();
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.ToString());
     }
     finally
     {
         sdrreader.Close();
         sqlcon.Close();
     }
     return creditnotemasterinfo;
 }