/// <summary>
 /// Function to get particular values from SalesQuotationMaster table based on the parameter
 /// </summary>
 /// <param name="quotationMasterId"></param>
 /// <returns></returns>
 public SalesQuotationMasterInfo SalesQuotationMasterView(decimal quotationMasterId)
 {
     SalesQuotationMasterInfo salesquotationmasterinfo = new SalesQuotationMasterInfo();
     SqlDataReader sdrreader = null;
     try
     {
         if (sqlcon.State == ConnectionState.Closed)
         {
             sqlcon.Open();
         }
         SqlCommand sccmd = new SqlCommand("SalesQuotationMasterView", sqlcon);
         sccmd.CommandType = CommandType.StoredProcedure;
         SqlParameter sprmparam = new SqlParameter();
         sprmparam = sccmd.Parameters.Add("@quotationMasterId", SqlDbType.Decimal);
         sprmparam.Value = quotationMasterId;
         sdrreader = sccmd.ExecuteReader();
         while (sdrreader.Read())
         {
             salesquotationmasterinfo.QuotationMasterId = Convert.ToDecimal(sdrreader[0].ToString());
             salesquotationmasterinfo.VoucherNo = sdrreader[1].ToString();
             salesquotationmasterinfo.InvoiceNo = sdrreader[2].ToString();
             salesquotationmasterinfo.VoucherTypeId = Convert.ToDecimal(sdrreader[3].ToString());
             salesquotationmasterinfo.SuffixPrefixId = Convert.ToDecimal(sdrreader[4].ToString());
             salesquotationmasterinfo.Date = DateTime.Parse(sdrreader[5].ToString());
             salesquotationmasterinfo.PricinglevelId = Convert.ToDecimal(sdrreader[6].ToString());
             salesquotationmasterinfo.LedgerId = Convert.ToDecimal(sdrreader[7].ToString());
             salesquotationmasterinfo.EmployeeId = Convert.ToDecimal(sdrreader[8].ToString());
             salesquotationmasterinfo.Approved = bool.Parse(sdrreader[9].ToString());
             salesquotationmasterinfo.TotalAmount = Convert.ToDecimal(sdrreader[10].ToString());
             salesquotationmasterinfo.Narration = sdrreader[11].ToString();
             salesquotationmasterinfo.FinancialYearId = Convert.ToDecimal(sdrreader[12].ToString());
             salesquotationmasterinfo.ExchangeRateId = Convert.ToDecimal(sdrreader[13].ToString());
             salesquotationmasterinfo.Extra1 = sdrreader[14].ToString();
             salesquotationmasterinfo.Extra2 = sdrreader[15].ToString();
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.ToString());
     }
     finally
     {
         sdrreader.Close();
         sqlcon.Close();
     }
     return salesquotationmasterinfo;
 }
 /// <summary>
 /// Function to Update values in SalesQuotationMaster Table
 /// </summary>
 /// <param name="salesquotationmasterinfo"></param>
 public void SalesQuotationMasterEdit(SalesQuotationMasterInfo salesquotationmasterinfo)
 {
     try
     {
         if (sqlcon.State == ConnectionState.Closed)
         {
             sqlcon.Open();
         }
         SqlCommand sccmd = new SqlCommand("SalesQuotationMasterEdit", sqlcon);
         sccmd.CommandType = CommandType.StoredProcedure;
         SqlParameter sprmparam = new SqlParameter();
         sprmparam = sccmd.Parameters.Add("@quotationMasterId", SqlDbType.Decimal);
         sprmparam.Value = salesquotationmasterinfo.QuotationMasterId;
         sprmparam = sccmd.Parameters.Add("@voucherNo", SqlDbType.VarChar);
         sprmparam.Value = salesquotationmasterinfo.VoucherNo;
         sprmparam = sccmd.Parameters.Add("@invoiceNo", SqlDbType.VarChar);
         sprmparam.Value = salesquotationmasterinfo.InvoiceNo;
         sprmparam = sccmd.Parameters.Add("@voucherTypeId", SqlDbType.Decimal);
         sprmparam.Value = salesquotationmasterinfo.VoucherTypeId;
         sprmparam = sccmd.Parameters.Add("@suffixPrefixId", SqlDbType.Decimal);
         sprmparam.Value = salesquotationmasterinfo.SuffixPrefixId;
         sprmparam = sccmd.Parameters.Add("@date", SqlDbType.DateTime);
         sprmparam.Value = salesquotationmasterinfo.Date;
         sprmparam = sccmd.Parameters.Add("@pricinglevelId", SqlDbType.Decimal);
         sprmparam.Value = salesquotationmasterinfo.PricinglevelId;
         sprmparam = sccmd.Parameters.Add("@ledgerId", SqlDbType.Decimal);
         sprmparam.Value = salesquotationmasterinfo.LedgerId;
         sprmparam = sccmd.Parameters.Add("@employeeId", SqlDbType.Decimal);
         sprmparam.Value = salesquotationmasterinfo.EmployeeId;
         sprmparam = sccmd.Parameters.Add("@approved", SqlDbType.Bit);
         sprmparam.Value = salesquotationmasterinfo.Approved;
         sprmparam = sccmd.Parameters.Add("@totalAmount", SqlDbType.Decimal);
         sprmparam.Value = salesquotationmasterinfo.TotalAmount;
         sprmparam = sccmd.Parameters.Add("@narration", SqlDbType.VarChar);
         sprmparam.Value = salesquotationmasterinfo.Narration;
         sprmparam = sccmd.Parameters.Add("@financialYearId", SqlDbType.Decimal);
         sprmparam.Value = salesquotationmasterinfo.FinancialYearId;
         sprmparam = sccmd.Parameters.Add("@exchangeRateId", SqlDbType.Decimal);
         sprmparam.Value = salesquotationmasterinfo.ExchangeRateId;
         sprmparam = sccmd.Parameters.Add("@extra1", SqlDbType.VarChar);
         sprmparam.Value = salesquotationmasterinfo.Extra1;
         sprmparam = sccmd.Parameters.Add("@extra2", SqlDbType.VarChar);
         sprmparam.Value = salesquotationmasterinfo.Extra2;
         sccmd.ExecuteNonQuery();
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.ToString());
     }
     finally
     {
         sqlcon.Close();
     }
 }
 public void SalesQuotationMasterEdit(SalesQuotationMasterInfo infoSalesQuotationMaster)
 {
     try
     {
         spSalesQuotationMaster.SalesQuotationMasterEdit(infoSalesQuotationMaster);
     }
     catch (Exception ex)
     {
         MessageBox.Show("SQBLL22:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
 public SalesQuotationMasterInfo SalesQuotationMasterView(decimal decQuotationMasterId)
 {
     SalesQuotationMasterInfo infoSalesQuotationMaster = new SalesQuotationMasterInfo();
     try
     {
         infoSalesQuotationMaster = spSalesQuotationMaster.SalesQuotationMasterView(decQuotationMasterId);
     }
     catch (Exception ex)
     {
         MessageBox.Show("SQBLL25:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
     return infoSalesQuotationMaster;
 }
 public decimal SalesQuotationMasterAdd(SalesQuotationMasterInfo infoSalesQuotationMaster)
 {
     decimal decSalesQuotationmasterIdentity = 0;
     try
     {
         decSalesQuotationmasterIdentity = spSalesQuotationMaster.SalesQuotationMasterAdd(infoSalesQuotationMaster);
     }
     catch (Exception ex)
     {
         MessageBox.Show("SQBLL20:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
     return decSalesQuotationmasterIdentity;
 }