public void ContraMasterEdit(ContraMasterInfo InfoContraMaster)
 {
     try
     {
         SpContraMaster.ContraMasterEdit(InfoContraMaster);
     }
     catch (Exception)
     {
     }
 }
 /// <summary>
 /// Function to insert values to ContraMaster Table
 /// </summary>
 /// <param name="contramasterinfo"></param>
 /// <returns></returns>
 public decimal ContraMasterAdd(ContraMasterInfo contramasterinfo)
 {
     decimal decIdentity = 0;
     try
     {
         if (sqlcon.State == ConnectionState.Closed)
         {
             sqlcon.Open();
         }
         SqlCommand sccmd = new SqlCommand("ContraMasterAdd", sqlcon);
         sccmd.CommandType = CommandType.StoredProcedure;
         SqlParameter sprmparam = new SqlParameter();
         sprmparam = sccmd.Parameters.Add("@voucherNo", SqlDbType.VarChar);
         sprmparam.Value = contramasterinfo.VoucherNo;
         sprmparam = sccmd.Parameters.Add("@invoiceNo", SqlDbType.VarChar);
         sprmparam.Value = contramasterinfo.InvoiceNo;
         sprmparam = sccmd.Parameters.Add("@suffixPrefixId", SqlDbType.Decimal);
         sprmparam.Value = contramasterinfo.SuffixPrefixId;
         sprmparam = sccmd.Parameters.Add("@date", SqlDbType.DateTime);
         sprmparam.Value = contramasterinfo.Date;
         sprmparam = sccmd.Parameters.Add("@ledgerId", SqlDbType.Decimal);
         sprmparam.Value = contramasterinfo.LedgerId;
         sprmparam = sccmd.Parameters.Add("@type", SqlDbType.VarChar);
         sprmparam.Value = contramasterinfo.Type;
         sprmparam = sccmd.Parameters.Add("@totalAmount", SqlDbType.Decimal);
         sprmparam.Value = contramasterinfo.TotalAmount;
         sprmparam = sccmd.Parameters.Add("@narration", SqlDbType.VarChar);
         sprmparam.Value = contramasterinfo.Narration;
         sprmparam = sccmd.Parameters.Add("@userId", SqlDbType.Decimal);
         sprmparam.Value = contramasterinfo.UserId;
         sprmparam = sccmd.Parameters.Add("@voucherTypeId", SqlDbType.Decimal);
         sprmparam.Value = contramasterinfo.VoucherTypeId;
         //sprmparam = sccmd.Parameters.Add("@exchangeRateId", SqlDbType.Decimal);
         //sprmparam.Value = contramasterinfo.ExchangeRateId;
         sprmparam = sccmd.Parameters.Add("@financialYearId", SqlDbType.Decimal);
         sprmparam.Value = contramasterinfo.FinancialYearId;
         //sprmparam = sccmd.Parameters.Add("@extraDate", SqlDbType.DateTime);
         //sprmparam.Value = contramasterinfo.ExtraDate;
         sprmparam = sccmd.Parameters.Add("@extra1", SqlDbType.VarChar);
         sprmparam.Value = contramasterinfo.Extra1;
         sprmparam = sccmd.Parameters.Add("@extra2", SqlDbType.VarChar);
         sprmparam.Value = contramasterinfo.Extra2;
         decIdentity = Convert.ToDecimal(sccmd.ExecuteScalar().ToString());
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.ToString());
     }
     finally
     {
         sqlcon.Close();
     }
     return decIdentity;
 }
 public ContraMasterInfo ContraMasterView(decimal contraMasterId)
 {
     ContraMasterInfo InfoContraMaster = new ContraMasterInfo();
     try
     {
         InfoContraMaster = SpContraMaster.ContraMasterView(contraMasterId);
     }
     catch (Exception ex)
     {
         MessageBox.Show("CV:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
     return InfoContraMaster;
 }
 public decimal ContraMasterAdd(ContraMasterInfo InfoContraMaster)
 {
     decimal decId = 0;
     try
     {
         decId = SpContraMaster.ContraMasterAdd(InfoContraMaster);
     }
     catch (Exception ex)
     {
         MessageBox.Show("CV:1:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
     return decId;
 }
 /// <summary>
 /// Function to get particular values from ContraMaster table based on the parameter
 /// </summary>
 /// <param name="contraMasterId"></param>
 /// <returns></returns>
 public ContraMasterInfo ContraMasterView(decimal contraMasterId)
 {
     ContraMasterInfo contramasterinfo = new ContraMasterInfo();
     SqlDataReader sdrreader = null;
     try
     {
         if (sqlcon.State == ConnectionState.Closed)
         {
             sqlcon.Open();
         }
         SqlCommand sccmd = new SqlCommand("ContraMasterView", sqlcon);
         sccmd.CommandType = CommandType.StoredProcedure;
         SqlParameter sprmparam = new SqlParameter();
         sprmparam = sccmd.Parameters.Add("@contraMasterId", SqlDbType.Decimal);
         sprmparam.Value = contraMasterId;
         sdrreader = sccmd.ExecuteReader();
         while (sdrreader.Read())
         {
             contramasterinfo.ContraMasterId = decimal.Parse(sdrreader[0].ToString());
             contramasterinfo.VoucherNo = sdrreader[1].ToString();
             contramasterinfo.InvoiceNo = sdrreader[2].ToString();
             contramasterinfo.SuffixPrefixId = decimal.Parse(sdrreader[3].ToString());
             contramasterinfo.Date = DateTime.Parse(sdrreader[4].ToString());
             contramasterinfo.LedgerId = decimal.Parse(sdrreader[5].ToString());
             contramasterinfo.Type = sdrreader[6].ToString();
             contramasterinfo.TotalAmount = decimal.Parse(sdrreader[7].ToString());
             contramasterinfo.Narration = sdrreader[8].ToString();
             contramasterinfo.UserId = decimal.Parse(sdrreader[9].ToString());
             contramasterinfo.VoucherTypeId = decimal.Parse(sdrreader[10].ToString());
             contramasterinfo.FinancialYearId = decimal.Parse(sdrreader[11].ToString());
             contramasterinfo.ExtraDate = DateTime.Parse(sdrreader[12].ToString());
             contramasterinfo.Extra1 = sdrreader[13].ToString();
             contramasterinfo.Extra2 = sdrreader[14].ToString();
             contramasterinfo.date = sdrreader["date"].ToString();
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.ToString());
     }
     finally
     {
         sdrreader.Close();
         sqlcon.Close();
     }
     return contramasterinfo;
 }
 /// <summary>
 /// Function to Update values in ContraMaster Table
 /// </summary>
 /// <param name="contramasterinfo"></param>
 public void ContraMasterEdit(ContraMasterInfo contramasterinfo)
 {
     try
     {
         if (sqlcon.State == ConnectionState.Closed)
         {
             sqlcon.Open();
         }
         SqlCommand sccmd = new SqlCommand("ContraMasterEdit", sqlcon);
         sccmd.CommandType = CommandType.StoredProcedure;
         SqlParameter sprmparam = new SqlParameter();
         sprmparam = sccmd.Parameters.Add("@contraMasterId", SqlDbType.Decimal);
         sprmparam.Value = contramasterinfo.ContraMasterId;
         sprmparam = sccmd.Parameters.Add("@invoiceNo", SqlDbType.VarChar);
         sprmparam.Value = contramasterinfo.InvoiceNo;
         sprmparam = sccmd.Parameters.Add("@suffixPrefixId", SqlDbType.Decimal);
         sprmparam.Value = contramasterinfo.SuffixPrefixId;
         sprmparam = sccmd.Parameters.Add("@date", SqlDbType.DateTime);
         sprmparam.Value = contramasterinfo.Date;
         sprmparam = sccmd.Parameters.Add("@ledgerId", SqlDbType.Decimal);
         sprmparam.Value = contramasterinfo.LedgerId;
         sprmparam = sccmd.Parameters.Add("@type", SqlDbType.VarChar);
         sprmparam.Value = contramasterinfo.Type;
         sprmparam = sccmd.Parameters.Add("@totalAmount", SqlDbType.Decimal);
         sprmparam.Value = contramasterinfo.TotalAmount;
         sprmparam = sccmd.Parameters.Add("@narration", SqlDbType.VarChar);
         sprmparam.Value = contramasterinfo.Narration;
         sprmparam = sccmd.Parameters.Add("@userId", SqlDbType.Decimal);
         sprmparam.Value = contramasterinfo.UserId;
         sprmparam = sccmd.Parameters.Add("@voucherTypeId", SqlDbType.Decimal);
         sprmparam.Value = contramasterinfo.VoucherTypeId;
         sprmparam = sccmd.Parameters.Add("@financialYearId", SqlDbType.Decimal);
         sprmparam.Value = contramasterinfo.FinancialYearId;
         sprmparam = sccmd.Parameters.Add("@extra1", SqlDbType.VarChar);
         sprmparam.Value = contramasterinfo.Extra1;
         sprmparam = sccmd.Parameters.Add("@extra2", SqlDbType.VarChar);
         sprmparam.Value = contramasterinfo.Extra2;
         sccmd.ExecuteNonQuery();
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.ToString());
     }
     finally
     {
         sqlcon.Close();
     }
 }
 public decimal ContraMasterAdd(ContraMasterInfo contramasterinfo)
 {
     decimal decIdentity = 0;
     try
     {
         ContraMasterSP spContraMaster = new ContraMasterSP();
         decIdentity = spContraMaster.ContraMasterAdd(contramasterinfo);
     }
     catch (Exception ex)
     {
         MessageBox.Show("CVBLL:10" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
     return decIdentity;
 }
 public ContraMasterInfo ContraMasterView(decimal contraMasterId)
 {
     ContraMasterInfo contramasterinfo = new ContraMasterInfo();
     try
     {
         ContraMasterSP spContraMaster = new ContraMasterSP();
         contramasterinfo = spContraMaster.ContraMasterView(contraMasterId);
     }
     catch (Exception ex)
     {
         MessageBox.Show("CVBLL:12" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
     return contramasterinfo;
 }
 public void ContraMasterEdit(ContraMasterInfo contramasterinfo)
 {
     try
     {
         ContraMasterSP spContraMaster = new ContraMasterSP();
         spContraMaster.ContraMasterEdit(contramasterinfo);
     }
     catch (Exception ex)
     {
         MessageBox.Show("CVBLL:11" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }