public decimal ReceiptMasterEdit(ReceiptMasterInfo receiptmasterinfo)
        {
            decimal decResult = 0;
            try
            {
            decResult = spReceiptMaster.ReceiptMasterEdit(receiptmasterinfo);
            }
            catch (Exception)
            {

            throw;
            }
            return decResult;
        }
 public decimal ReceiptMasterAdd(ReceiptMasterInfo receiptmasterinfo)
 {
     decimal decRecieptMasterId = 0;
     try
     {
         ReceiptMasterSP spReceiptMaster = new ReceiptMasterSP();
         decRecieptMasterId = spReceiptMaster.ReceiptMasterAdd(receiptmasterinfo);
     }
     catch (Exception ex)
     {
         MessageBox.Show("RD7:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
     return decRecieptMasterId;
 }
 /// <summary>
 /// Function to insert values to ReceiptMaster Table
 /// </summary>
 /// <param name="receiptmasterinfo"></param>
 /// <returns></returns>
 public decimal ReceiptMasterAdd(ReceiptMasterInfo receiptmasterinfo)
 {
     decimal decRecieptMasterId = 0;
     try
     {
         if (sqlcon.State == ConnectionState.Closed)
         {
             sqlcon.Open();
         }
         SqlCommand sccmd = new SqlCommand("ReceiptMasterAdd", sqlcon);
         sccmd.CommandType = CommandType.StoredProcedure;
         SqlParameter sprmparam = new SqlParameter();
         sprmparam = sccmd.Parameters.Add("@voucherNo", SqlDbType.VarChar);
         sprmparam.Value = receiptmasterinfo.VoucherNo;
         sprmparam = sccmd.Parameters.Add("@invoiceNo", SqlDbType.VarChar);
         sprmparam.Value = receiptmasterinfo.InvoiceNo;
         sprmparam = sccmd.Parameters.Add("@suffixPrefixId", SqlDbType.Decimal);
         sprmparam.Value = receiptmasterinfo.SuffixPrefixId;
         sprmparam = sccmd.Parameters.Add("@date", SqlDbType.DateTime);
         sprmparam.Value = receiptmasterinfo.Date;
         sprmparam = sccmd.Parameters.Add("@ledgerId", SqlDbType.Decimal);
         sprmparam.Value = receiptmasterinfo.LedgerId;
         sprmparam = sccmd.Parameters.Add("@totalAmount", SqlDbType.Decimal);
         sprmparam.Value = receiptmasterinfo.TotalAmount;
         sprmparam = sccmd.Parameters.Add("@narration", SqlDbType.VarChar);
         sprmparam.Value = receiptmasterinfo.Narration;
         sprmparam = sccmd.Parameters.Add("@voucherTypeId", SqlDbType.Decimal);
         sprmparam.Value = receiptmasterinfo.VoucherTypeId;
         sprmparam = sccmd.Parameters.Add("@userId", SqlDbType.Decimal);
         sprmparam.Value = receiptmasterinfo.UserId;
         sprmparam = sccmd.Parameters.Add("@financialYearId", SqlDbType.Decimal);
         sprmparam.Value = receiptmasterinfo.FinancialYearId;
         sprmparam = sccmd.Parameters.Add("@extra1", SqlDbType.VarChar);
         sprmparam.Value = receiptmasterinfo.Extra1;
         sprmparam = sccmd.Parameters.Add("@extra2", SqlDbType.VarChar);
         sprmparam.Value = receiptmasterinfo.Extra2;
         decRecieptMasterId = Convert.ToDecimal(sccmd.ExecuteScalar().ToString());
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.ToString());
     }
     finally
     {
         sqlcon.Close();
     }
     return decRecieptMasterId;
 }
 /// <summary>
 /// Function to get particular values from eceiptMaster table based on the parameter
 /// </summary>
 /// <param name="decReceiptMastertId"></param>
 /// <returns></returns>
 public ReceiptMasterInfo ReceiptMasterViewByMasterId(decimal decReceiptMastertId)
 {
     ReceiptMasterInfo InfoReceiptMaster = new ReceiptMasterInfo();
     SqlDataReader sdrreader = null;
     try
     {
         if (sqlcon.State == ConnectionState.Closed)
         {
             sqlcon.Open();
         }
         SqlCommand sccmd = new SqlCommand("ReceiptMasterViewByMasterId", sqlcon);
         sccmd.CommandType = CommandType.StoredProcedure;
         SqlParameter sprmparam = new SqlParameter();
         sprmparam = sccmd.Parameters.Add("@receiptMasterId", SqlDbType.Decimal);
         sprmparam.Value = decReceiptMastertId;
         sdrreader = sccmd.ExecuteReader();
         while (sdrreader.Read())
         {
             InfoReceiptMaster.VoucherNo = sdrreader["voucherNo"].ToString();
             InfoReceiptMaster.InvoiceNo = sdrreader["invoiceNo"].ToString();
             InfoReceiptMaster.SuffixPrefixId = decimal.Parse(sdrreader["suffixprefixId"].ToString());
             InfoReceiptMaster.Date = DateTime.Parse(sdrreader["date"].ToString());
             InfoReceiptMaster.LedgerId = decimal.Parse(sdrreader["ledgerId"].ToString());
             InfoReceiptMaster.TotalAmount = decimal.Parse(sdrreader["totalAmount"].ToString());
             InfoReceiptMaster.Narration = sdrreader["narration"].ToString();
             InfoReceiptMaster.VoucherTypeId = decimal.Parse(sdrreader["voucherTypeId"].ToString());
             InfoReceiptMaster.UserId = decimal.Parse(sdrreader["userId"].ToString());
             InfoReceiptMaster.FinancialYearId = decimal.Parse(sdrreader["financialYearId"].ToString());
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.ToString());
     }
     finally
     {
         sdrreader.Close();
         sqlcon.Close();
     }
     return InfoReceiptMaster;
 }
 /// <summary>
 /// Function to get particular values from ReceiptMaster table based on the parameter
 /// </summary>
 /// <param name="receiptMasterId"></param>
 /// <returns></returns>
 public ReceiptMasterInfo ReceiptMasterView(decimal receiptMasterId)
 {
     ReceiptMasterInfo receiptmasterinfo = new ReceiptMasterInfo();
     SqlDataReader sdrreader = null;
     try
     {
         if (sqlcon.State == ConnectionState.Closed)
         {
             sqlcon.Open();
         }
         SqlCommand sccmd = new SqlCommand("ReceiptMasterView", sqlcon);
         sccmd.CommandType = CommandType.StoredProcedure;
         SqlParameter sprmparam = new SqlParameter();
         sprmparam = sccmd.Parameters.Add("@receiptMasterId", SqlDbType.Decimal);
         sprmparam.Value = receiptMasterId;
         sdrreader = sccmd.ExecuteReader();
         while (sdrreader.Read())
         {
             receiptmasterinfo.ReceiptMasterId = decimal.Parse(sdrreader[0].ToString());
             receiptmasterinfo.VoucherNo = sdrreader[1].ToString();
             receiptmasterinfo.InvoiceNo = sdrreader[2].ToString();
             receiptmasterinfo.SuffixPrefixId = decimal.Parse(sdrreader[3].ToString());
             receiptmasterinfo.Date = DateTime.Parse(sdrreader[4].ToString());
             receiptmasterinfo.LedgerId = decimal.Parse(sdrreader[5].ToString());
             receiptmasterinfo.TotalAmount = decimal.Parse(sdrreader[6].ToString());
             receiptmasterinfo.Narration = sdrreader[7].ToString();
             receiptmasterinfo.VoucherTypeId = decimal.Parse(sdrreader[8].ToString());
             receiptmasterinfo.UserId = decimal.Parse(sdrreader[9].ToString());
             receiptmasterinfo.FinancialYearId = decimal.Parse(sdrreader[10].ToString());
             receiptmasterinfo.ExtraDate = DateTime.Parse(sdrreader[11].ToString());
             receiptmasterinfo.Extra1 = sdrreader[12].ToString();
             receiptmasterinfo.Extra2 = sdrreader[13].ToString();
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.ToString());
     }
     finally
     {
         sdrreader.Close();
         sqlcon.Close();
     }
     return receiptmasterinfo;
 }
 public ReceiptMasterInfo ReceiptMasterViewByMasterId(decimal decReceiptMastertId)
 {
     ReceiptMasterInfo infoReceiptMaster = new ReceiptMasterInfo();
     try
     {
         ReceiptMasterSP spReceiptMaster = new ReceiptMasterSP();
         infoReceiptMaster = spReceiptMaster.ReceiptMasterViewByMasterId(decReceiptMastertId);
     }
     catch (Exception ex)
     {
         MessageBox.Show("RD11:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
     return infoReceiptMaster;
 }