Esempio n. 1
0
        /// <summary>
        /// Function to insert values to MonthlySalaryVoucherMaster Table and return the Curresponding row's Id
        /// </summary>
        /// <param name="salaryvouchermasterinfo"></param>
        /// <param name="IsAutomatic"></param>
        /// <returns></returns>
        public DataTable MonthlySalaryVoucherMasterAddWithIdentity(SalaryVoucherMasterInfo salaryvouchermasterinfo, bool IsAutomatic)
        {
            DataTable dtbl = new DataTable();

            try
            {
                if (sqlcon.State == ConnectionState.Closed)
                {
                    sqlcon.Open();
                }
                SqlDataAdapter sqlda = new SqlDataAdapter("MonthlySalaryVoucherMasterAddWithIdentity", sqlcon);
                sqlda.SelectCommand.CommandType = CommandType.StoredProcedure;
                SqlParameter sprmparam = new SqlParameter();
                sprmparam       = sqlda.SelectCommand.Parameters.Add("@ledgerId", SqlDbType.Decimal);
                sprmparam.Value = salaryvouchermasterinfo.LedgerId;
                sprmparam       = sqlda.SelectCommand.Parameters.Add("@voucherNo", SqlDbType.VarChar);
                sprmparam.Value = salaryvouchermasterinfo.VoucherNo;
                sprmparam       = sqlda.SelectCommand.Parameters.Add("@invoiceNo", SqlDbType.VarChar);
                sprmparam.Value = salaryvouchermasterinfo.InvoiceNo;
                sprmparam       = sqlda.SelectCommand.Parameters.Add("@date", SqlDbType.DateTime);
                sprmparam.Value = salaryvouchermasterinfo.Date;
                sprmparam       = sqlda.SelectCommand.Parameters.Add("@month", SqlDbType.DateTime);
                sprmparam.Value = salaryvouchermasterinfo.Month;
                sprmparam       = sqlda.SelectCommand.Parameters.Add("@totalAmount", SqlDbType.Decimal);
                sprmparam.Value = salaryvouchermasterinfo.TotalAmount;
                sprmparam       = sqlda.SelectCommand.Parameters.Add("@narration", SqlDbType.VarChar);
                sprmparam.Value = salaryvouchermasterinfo.Narration;
                sprmparam       = sqlda.SelectCommand.Parameters.Add("@extra1", SqlDbType.VarChar);
                sprmparam.Value = salaryvouchermasterinfo.Extra1;
                sprmparam       = sqlda.SelectCommand.Parameters.Add("@extra2", SqlDbType.VarChar);
                sprmparam.Value = salaryvouchermasterinfo.Extra2;
                sprmparam       = sqlda.SelectCommand.Parameters.Add("@suffixPrefixId", SqlDbType.Decimal);
                sprmparam.Value = salaryvouchermasterinfo.SuffixPrefixId;
                sprmparam       = sqlda.SelectCommand.Parameters.Add("@voucherTypeId", SqlDbType.Decimal);
                sprmparam.Value = salaryvouchermasterinfo.VoucherTypeId;
                sprmparam       = sqlda.SelectCommand.Parameters.Add("@financialYearId", SqlDbType.Decimal);
                sprmparam.Value = salaryvouchermasterinfo.FinancialYearId;
                sprmparam       = sqlda.SelectCommand.Parameters.Add("@isAutomatic", SqlDbType.Bit);
                sprmparam.Value = IsAutomatic;
                sqlda.Fill(dtbl);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
            finally
            {
                sqlcon.Close();
            }
            return(dtbl);
        }
Esempio n. 2
0
 /// <summary>
 /// Function to insert values to SalaryVoucherMaster Table
 /// </summary>
 /// <param name="salaryvouchermasterinfo"></param>
 public void SalaryVoucherMasterAdd(SalaryVoucherMasterInfo salaryvouchermasterinfo)
 {
     try
     {
         if (sqlcon.State == ConnectionState.Closed)
         {
             sqlcon.Open();
         }
         SqlCommand sccmd = new SqlCommand("SalaryVoucherMasterAdd", sqlcon);
         sccmd.CommandType = CommandType.StoredProcedure;
         SqlParameter sprmparam = new SqlParameter();
         sprmparam       = sccmd.Parameters.Add("@salaryVoucherMasterId", SqlDbType.Decimal);
         sprmparam.Value = salaryvouchermasterinfo.SalaryVoucherMasterId;
         sprmparam       = sccmd.Parameters.Add("@ledgerId", SqlDbType.Decimal);
         sprmparam.Value = salaryvouchermasterinfo.LedgerId;
         sprmparam       = sccmd.Parameters.Add("@voucherNo", SqlDbType.VarChar);
         sprmparam.Value = salaryvouchermasterinfo.VoucherNo;
         sprmparam       = sccmd.Parameters.Add("@invoiceNo", SqlDbType.VarChar);
         sprmparam.Value = salaryvouchermasterinfo.InvoiceNo;
         sprmparam       = sccmd.Parameters.Add("@date", SqlDbType.DateTime);
         sprmparam.Value = salaryvouchermasterinfo.Date;
         sprmparam       = sccmd.Parameters.Add("@month", SqlDbType.DateTime);
         sprmparam.Value = salaryvouchermasterinfo.Month;
         sprmparam       = sccmd.Parameters.Add("@totalAmount", SqlDbType.Decimal);
         sprmparam.Value = salaryvouchermasterinfo.TotalAmount;
         sprmparam       = sccmd.Parameters.Add("@narration", SqlDbType.VarChar);
         sprmparam.Value = salaryvouchermasterinfo.Narration;
         sprmparam       = sccmd.Parameters.Add("@extraDate", SqlDbType.DateTime);
         sprmparam.Value = salaryvouchermasterinfo.ExtraDate;
         sprmparam       = sccmd.Parameters.Add("@extra1", SqlDbType.VarChar);
         sprmparam.Value = salaryvouchermasterinfo.Extra1;
         sprmparam       = sccmd.Parameters.Add("@extra2", SqlDbType.VarChar);
         sprmparam.Value = salaryvouchermasterinfo.Extra2;
         sprmparam       = sccmd.Parameters.Add("@suffixPrefixId", SqlDbType.Decimal);
         sprmparam.Value = salaryvouchermasterinfo.SuffixPrefixId;
         sprmparam       = sccmd.Parameters.Add("@voucherTypeId", SqlDbType.Decimal);
         sprmparam.Value = salaryvouchermasterinfo.VoucherTypeId;
         sprmparam       = sccmd.Parameters.Add("@financialYearId", SqlDbType.Decimal);
         sprmparam.Value = salaryvouchermasterinfo.FinancialYearId;
         sccmd.ExecuteNonQuery();
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.ToString());
     }
     finally
     {
         sqlcon.Close();
     }
 }
Esempio n. 3
0
        /// <summary>
        /// Function to get particular values from SalaryVoucherMaster Table based on the parameter
        /// </summary>
        /// <param name="salaryVoucherMasterId"></param>
        /// <returns></returns>
        public SalaryVoucherMasterInfo SalaryVoucherMasterView(decimal salaryVoucherMasterId)
        {
            SalaryVoucherMasterInfo salaryvouchermasterinfo = new SalaryVoucherMasterInfo();
            SqlDataReader           sdrreader = null;

            try
            {
                if (sqlcon.State == ConnectionState.Closed)
                {
                    sqlcon.Open();
                }
                SqlCommand sccmd = new SqlCommand("SalaryVoucherMasterView", sqlcon);
                sccmd.CommandType = CommandType.StoredProcedure;
                SqlParameter sprmparam = new SqlParameter();
                sprmparam       = sccmd.Parameters.Add("@salaryVoucherMasterId", SqlDbType.Decimal);
                sprmparam.Value = salaryVoucherMasterId;
                sdrreader       = sccmd.ExecuteReader();
                while (sdrreader.Read())
                {
                    salaryvouchermasterinfo.SalaryVoucherMasterId = decimal.Parse(sdrreader[0].ToString());
                    salaryvouchermasterinfo.LedgerId        = decimal.Parse(sdrreader[1].ToString());
                    salaryvouchermasterinfo.VoucherNo       = sdrreader[2].ToString();
                    salaryvouchermasterinfo.InvoiceNo       = sdrreader[3].ToString();
                    salaryvouchermasterinfo.Date            = DateTime.Parse(sdrreader[4].ToString());
                    salaryvouchermasterinfo.Month           = DateTime.Parse(sdrreader[5].ToString());
                    salaryvouchermasterinfo.TotalAmount     = decimal.Parse(sdrreader[6].ToString());
                    salaryvouchermasterinfo.Narration       = sdrreader[7].ToString();
                    salaryvouchermasterinfo.ExtraDate       = DateTime.Parse(sdrreader[8].ToString());
                    salaryvouchermasterinfo.Extra1          = sdrreader[9].ToString();
                    salaryvouchermasterinfo.Extra2          = sdrreader[10].ToString();
                    salaryvouchermasterinfo.SuffixPrefixId  = decimal.Parse(sdrreader[11].ToString());
                    salaryvouchermasterinfo.VoucherTypeId   = decimal.Parse(sdrreader[12].ToString());
                    salaryvouchermasterinfo.FinancialYearId = decimal.Parse(sdrreader[13].ToString());
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
            finally
            {
                sdrreader.Close();
                sqlcon.Close();
            }
            return(salaryvouchermasterinfo);
        }