예제 #1
0
        /// <summary>
        /// Function to get particular values from DailySalaryVoucherDetails table based on the parameter
        /// </summary>
        /// <param name="dailySalaryVoucherDetailsId"></param>
        /// <returns></returns>
        public DailySalaryVoucherDetailsInfo DailySalaryVoucherDetailsView(decimal dailySalaryVoucherDetailsId)
        {
            DailySalaryVoucherDetailsInfo dailysalaryvoucherdetailsinfo = new DailySalaryVoucherDetailsInfo();
            SqlDataReader sdrreader = null;

            try
            {
                if (sqlcon.State == ConnectionState.Closed)
                {
                    sqlcon.Open();
                }
                SqlCommand sccmd = new SqlCommand("DailySalaryVoucherDetailsView", sqlcon);
                sccmd.CommandType = CommandType.StoredProcedure;
                SqlParameter sprmparam = new SqlParameter();
                sprmparam       = sccmd.Parameters.Add("@dailySalaryVoucherDetailsId", SqlDbType.Decimal);
                sprmparam.Value = dailySalaryVoucherDetailsId;
                sdrreader       = sccmd.ExecuteReader();
                while (sdrreader.Read())
                {
                    dailysalaryvoucherdetailsinfo.DailySalaryVoucherDetailsId = decimal.Parse(sdrreader[0].ToString());
                    dailysalaryvoucherdetailsinfo.DailySalaryVocherMasterId   = decimal.Parse(sdrreader[1].ToString());
                    dailysalaryvoucherdetailsinfo.EmployeeId = decimal.Parse(sdrreader[2].ToString());
                    dailysalaryvoucherdetailsinfo.Wage       = decimal.Parse(sdrreader[3].ToString());
                    dailysalaryvoucherdetailsinfo.Status     = sdrreader[4].ToString();
                    dailysalaryvoucherdetailsinfo.ExtraDate  = DateTime.Parse(sdrreader[5].ToString());
                    dailysalaryvoucherdetailsinfo.Extra1     = sdrreader[6].ToString();
                    dailysalaryvoucherdetailsinfo.Extra2     = sdrreader[7].ToString();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
            finally
            {
                sdrreader.Close();
                sqlcon.Close();
            }
            return(dailysalaryvoucherdetailsinfo);
        }
예제 #2
0
 /// <summary>
 /// Function to Update values in DailySalaryVoucherDetails Table
 /// </summary>
 /// <param name="dailysalaryvoucherdetailsinfo"></param>
 public void DailySalaryVoucherDetailsEdit(DailySalaryVoucherDetailsInfo dailysalaryvoucherdetailsinfo)
 {
     try
     {
         if (sqlcon.State == ConnectionState.Closed)
         {
             sqlcon.Open();
         }
         SqlCommand sccmd = new SqlCommand("DailySalaryVoucherDetailsEdit", sqlcon);
         sccmd.CommandType = CommandType.StoredProcedure;
         SqlParameter sprmparam = new SqlParameter();
         sprmparam       = sccmd.Parameters.Add("@dailySalaryVoucherDetailsId", SqlDbType.Decimal);
         sprmparam.Value = dailysalaryvoucherdetailsinfo.DailySalaryVoucherDetailsId;
         sprmparam       = sccmd.Parameters.Add("@dailySalaryVoucherMasterId", SqlDbType.Decimal);
         sprmparam.Value = dailysalaryvoucherdetailsinfo.DailySalaryVocherMasterId;
         sprmparam       = sccmd.Parameters.Add("@employeeId", SqlDbType.Decimal);
         sprmparam.Value = dailysalaryvoucherdetailsinfo.EmployeeId;
         sprmparam       = sccmd.Parameters.Add("@wage", SqlDbType.Decimal);
         sprmparam.Value = dailysalaryvoucherdetailsinfo.Wage;
         sprmparam       = sccmd.Parameters.Add("@status", SqlDbType.VarChar);
         sprmparam.Value = dailysalaryvoucherdetailsinfo.Status;
         sprmparam       = sccmd.Parameters.Add("@extraDate", SqlDbType.DateTime);
         sprmparam.Value = dailysalaryvoucherdetailsinfo.ExtraDate;
         sprmparam       = sccmd.Parameters.Add("@extra1", SqlDbType.VarChar);
         sprmparam.Value = dailysalaryvoucherdetailsinfo.Extra1;
         sprmparam       = sccmd.Parameters.Add("@extra2", SqlDbType.VarChar);
         sprmparam.Value = dailysalaryvoucherdetailsinfo.Extra2;
         sccmd.ExecuteNonQuery();
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.ToString());
     }
     finally
     {
         sqlcon.Close();
     }
 }