public SuffixPrefixInfo GetSuffixPrefixDetails(decimal vouchertypeId, DateTime date)
        {
            SuffixPrefixInfo infoSuffixPrefix = new SuffixPrefixInfo();
            try
            {
                infoSuffixPrefix = spSuffixPrefix.GetSuffixPrefixDetails(vouchertypeId, date);
            }
            catch (Exception ex)
            {

                MessageBox.Show("BD4:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            return infoSuffixPrefix;
        }
        public bool SuffixPrefixAddWithId(SuffixPrefixInfo Infosuffixprefix)
        {
            bool isEdit = false;
            try
            {

                isEdit = spSuffixPrefix.SuffixPrefixAddWithId(Infosuffixprefix);
            }
            catch (Exception ex)
            {

                MessageBox.Show("BD2:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }

            return isEdit;
        }
 /// <summary>
 /// Function to get SuffixPrefix details based on parameter
 /// </summary>
 /// <param name="vouchertypeId"></param>
 /// <param name="date"></param>
 /// <returns></returns>
 public SuffixPrefixInfo GetSuffixPrefixDetails(decimal vouchertypeId, DateTime date)
 {
     SuffixPrefixInfo suffixprefixinfo = new SuffixPrefixInfo();
     SqlDataReader sdrreader = null;
     try
     {
         if (sqlcon.State == ConnectionState.Closed)
         {
             sqlcon.Open();
         }
         SqlCommand sccmd = new SqlCommand("GetSuffixPrefixDetails", sqlcon);
         sccmd.CommandType = CommandType.StoredProcedure;
         SqlParameter sprmparam = new SqlParameter();
         sprmparam = sccmd.Parameters.Add("@voucherId", SqlDbType.Decimal);
         sprmparam.Value = vouchertypeId;
         sprmparam = sccmd.Parameters.Add("@date", SqlDbType.DateTime);
         sprmparam.Value = date;
         sdrreader = sccmd.ExecuteReader();
         while (sdrreader.Read())
         {
             suffixprefixinfo.SuffixprefixId = decimal.Parse(sdrreader[0].ToString());
             suffixprefixinfo.VoucherTypeId = decimal.Parse(sdrreader[1].ToString());
             suffixprefixinfo.FromDate = DateTime.Parse(sdrreader[2].ToString());
             suffixprefixinfo.ToDate = DateTime.Parse(sdrreader[3].ToString());
             suffixprefixinfo.StartIndex = decimal.Parse(sdrreader[4].ToString());
             suffixprefixinfo.Prefix = sdrreader[5].ToString();
             suffixprefixinfo.Suffix = sdrreader[6].ToString();
             suffixprefixinfo.WidthOfNumericalPart = int.Parse(sdrreader[7].ToString());
             suffixprefixinfo.PrefillWithZero = bool.Parse(sdrreader[8].ToString());
             suffixprefixinfo.Narration = sdrreader[9].ToString();
             suffixprefixinfo.ExtraDate = DateTime.Parse(sdrreader[10].ToString());
             suffixprefixinfo.Extra1 = sdrreader[11].ToString();
             suffixprefixinfo.Extra2 = sdrreader[12].ToString();
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.ToString());
     }
     finally
     {
         sdrreader.Close();
         sqlcon.Close();
     }
     return suffixprefixinfo;
 }
        public SuffixPrefixInfo SuffixPrefixView(decimal suffixprefixId)
        {
            SuffixPrefixInfo infoSuffixPrefix = new SuffixPrefixInfo();
            try
            {
                infoSuffixPrefix = spSuffixPrefix.SuffixPrefixView(suffixprefixId);
            }
            catch (Exception ex)
            {

                MessageBox.Show("BD4:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            return infoSuffixPrefix;
        }
 /// <summary>
 /// Function to insert values to SuffixPrefix Table
 /// </summary>
 /// <param name="suffixprefixinfo"></param>
 public void SuffixPrefixAdd(SuffixPrefixInfo suffixprefixinfo)
 {
     try
     {
         if (sqlcon.State == ConnectionState.Closed)
         {
             sqlcon.Open();
         }
         SqlCommand sccmd = new SqlCommand("SuffixPrefixAdd", sqlcon);
         sccmd.CommandType = CommandType.StoredProcedure;
         SqlParameter sprmparam = new SqlParameter();
         sprmparam = sccmd.Parameters.Add("@suffixprefixId", SqlDbType.Decimal);
         sprmparam.Value = suffixprefixinfo.SuffixprefixId;
         sprmparam = sccmd.Parameters.Add("@voucherTypeId", SqlDbType.Decimal);
         sprmparam.Value = suffixprefixinfo.VoucherTypeId;
         sprmparam = sccmd.Parameters.Add("@fromDate", SqlDbType.DateTime);
         sprmparam.Value = suffixprefixinfo.FromDate;
         sprmparam = sccmd.Parameters.Add("@toDate", SqlDbType.DateTime);
         sprmparam.Value = suffixprefixinfo.ToDate;
         sprmparam = sccmd.Parameters.Add("@startIndex", SqlDbType.Decimal);
         sprmparam.Value = suffixprefixinfo.StartIndex;
         sprmparam = sccmd.Parameters.Add("@prefix", SqlDbType.VarChar);
         sprmparam.Value = suffixprefixinfo.Prefix;
         sprmparam = sccmd.Parameters.Add("@suffix", SqlDbType.VarChar);
         sprmparam.Value = suffixprefixinfo.Suffix;
         sprmparam = sccmd.Parameters.Add("@widthOfNumericalPart", SqlDbType.Int);
         sprmparam.Value = suffixprefixinfo.WidthOfNumericalPart;
         sprmparam = sccmd.Parameters.Add("@prefillWithZero", SqlDbType.Bit);
         sprmparam.Value = suffixprefixinfo.PrefillWithZero;
         sprmparam = sccmd.Parameters.Add("@narration", SqlDbType.VarChar);
         sprmparam.Value = suffixprefixinfo.Narration;
         sprmparam = sccmd.Parameters.Add("@extraDate", SqlDbType.DateTime);
         sprmparam.Value = suffixprefixinfo.ExtraDate;
         sprmparam = sccmd.Parameters.Add("@extra1", SqlDbType.VarChar);
         sprmparam.Value = suffixprefixinfo.Extra1;
         sprmparam = sccmd.Parameters.Add("@extra2", SqlDbType.VarChar);
         sprmparam.Value = suffixprefixinfo.Extra2;
         sccmd.ExecuteNonQuery();
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.ToString());
     }
     finally
     {
         sqlcon.Close();
     }
 }
 /// <summary>
 /// Function to get id for update
 /// </summary>
 /// <param name="Infosuffixprefix"></param>
 /// <returns></returns>
 public bool SuffixPrefixSettingsEdit(SuffixPrefixInfo Infosuffixprefix)
 {
     bool isEdit = false;
     try
     {
         if (sqlcon.State == ConnectionState.Closed)
         {
             sqlcon.Open();
         }
         SqlCommand sqlcmd = new SqlCommand("SuffixPrefixSettingsEdit", sqlcon);
         sqlcmd.CommandType = CommandType.StoredProcedure;
         sqlcmd.Parameters.Add("@suffixprefixId", SqlDbType.Decimal).Value = Infosuffixprefix.SuffixprefixId;
         sqlcmd.Parameters.Add("@voucherTypeId", SqlDbType.Decimal).Value = Infosuffixprefix.VoucherTypeId;
         sqlcmd.Parameters.Add("@fromDate", SqlDbType.DateTime).Value = Infosuffixprefix.FromDate;
         sqlcmd.Parameters.Add("@toDate", SqlDbType.DateTime).Value = Infosuffixprefix.ToDate;
         sqlcmd.Parameters.Add("@startIndex", SqlDbType.VarChar).Value = Infosuffixprefix.StartIndex;
         sqlcmd.Parameters.Add("@prefix", SqlDbType.VarChar).Value = Infosuffixprefix.Prefix;
         sqlcmd.Parameters.Add("@suffix", SqlDbType.VarChar).Value = Infosuffixprefix.Suffix;
         sqlcmd.Parameters.Add("@widthOfNumericalPart", SqlDbType.Decimal).Value = Infosuffixprefix.WidthOfNumericalPart;
         sqlcmd.Parameters.Add("@prefillWithZero", SqlDbType.Bit).Value = Infosuffixprefix.PrefillWithZero;
         sqlcmd.Parameters.Add("@narration", SqlDbType.VarChar).Value = Infosuffixprefix.Narration;
         int ineffectedrow = sqlcmd.ExecuteNonQuery();
         if (ineffectedrow > 0)
         {
             isEdit = true;
         }
         else
         {
             isEdit = false;
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.ToString());
     }
     finally
     {
         sqlcon.Close();
     }
     return isEdit;
 }