Exemplo n.º 1
0
        public static List <PayrollRun> GetReportPayrollRun(int locationId, string payrollMonth)
        {
            List <PayrollRun> list = new List <PayrollRun>();

            Database  db         = DatabaseFactory.CreateDatabase("Spar-StoreRep");
            string    sqlCommand = "GetReportPayrollRun";
            DbCommand dbCommand  = db.GetStoredProcCommand(sqlCommand);

            db.AddInParameter(dbCommand, "@LocationId", DbType.Int32, locationId);
            db.AddInParameter(dbCommand, "@PayrollMonth", DbType.String, payrollMonth);

            using (IDataReader dataReader = db.ExecuteReader(dbCommand))
            {
                while (dataReader.Read())
                {
                    PayrollRun payrollRun = new PayrollRun();
                    payrollRun.IDNumber       = dataReader["IDNumber"].ToString();
                    payrollRun.EmployeeNumber = dataReader["EmployeeNumber"].ToString();
                    payrollRun.FirstName      = dataReader["FirstName"].ToString();
                    payrollRun.LastName       = dataReader["LastName"].ToString();
                    payrollRun.Run            = Convert.ToInt32(dataReader["Run"]);
                    payrollRun.Deduction      = Convert.ToDecimal(dataReader["Deduction"]);
                    payrollRun.Comment        = dataReader["Comment"].ToString();

                    list.Add(payrollRun);
                }
            }
            return(list);
        }
Exemplo n.º 2
0
        public static List <PayrollRun> GetPayrollMonthList()
        {
            List <PayrollRun> list = new List <PayrollRun>();

            Database  db         = DatabaseFactory.CreateDatabase("Spar-StoreRep");
            string    sqlCommand = "GetPayrollMonthList";
            DbCommand dbCommand  = db.GetStoredProcCommand(sqlCommand);

            using (IDataReader dataReader = db.ExecuteReader(dbCommand))
            {
                while (dataReader.Read())
                {
                    PayrollRun payrollRun = new PayrollRun();
                    payrollRun.FormattedPayrollMonth = dataReader["PayrollMonth"].ToString();
                    list.Add(payrollRun);
                }
            }

            return(list);
        }
Exemplo n.º 3
0
        public static List <PayrollRun> GetPayrollRunDetailListByEmployeeId(int employeeId)
        {
            List <PayrollRun> list = new List <PayrollRun>();

            Database  db         = DatabaseFactory.CreateDatabase("Spar-StoreRep");
            string    sqlCommand = "GetPayrollRunDetailListByEmployeeId";
            DbCommand dbCommand  = db.GetStoredProcCommand(sqlCommand);

            db.AddInParameter(dbCommand, "@EmployeeId", DbType.Int32, employeeId);

            using (IDataReader dataReader = db.ExecuteReader(dbCommand))
            {
                while (dataReader.Read())
                {
                    PayrollRun payrollRun = new PayrollRun();
                    payrollRun.FormattedPayrollMonth = dataReader["PayrollMonth"].ToString();
                    payrollRun.Deduction             = Convert.ToDecimal(dataReader["Deduction"]);
                    payrollRun.Comment = dataReader["Comment"].ToString();
                    list.Add(payrollRun);
                }
            }
            return(list);
        }
Exemplo n.º 4
0
        public static PayrollRun GetPayrollRunByPayrollRunId(int payrollRunId)
        {
            Database  db         = DatabaseFactory.CreateDatabase("Spar-StoreRep");
            string    sqlCommand = "GetPayrollRunByPayrollRunId";
            DbCommand dbCommand  = db.GetStoredProcCommand(sqlCommand);

            db.AddInParameter(dbCommand, "@PayrollRunId", DbType.Int32, payrollRunId);
            db.AddOutParameter(dbCommand, "@PayrollMonth", DbType.DateTime, 4);
            db.AddOutParameter(dbCommand, "@EmployeeId", DbType.Int32, 4);
            db.AddOutParameter(dbCommand, "@Deduction", DbType.Double, 4);
            db.AddOutParameter(dbCommand, "@Run", DbType.Int32, 4);
            db.AddOutParameter(dbCommand, "@Comment", DbType.String, 1000);
            db.ExecuteNonQuery(dbCommand);
            PayrollRun payrollRun = new PayrollRun();

            payrollRun.PayrollRunId = payrollRunId;
            payrollRun.PayrollMonth = Convert.ToDateTime(db.GetParameterValue(dbCommand, "PayrollMonth"));
            payrollRun.EmployeeId   = Convert.ToInt32(db.GetParameterValue(dbCommand, "EmployeeId"));
            payrollRun.Deduction    = Convert.ToDecimal(db.GetParameterValue(dbCommand, "Deduction"));
            payrollRun.Run          = Convert.ToInt32(db.GetParameterValue(dbCommand, "Run"));
            payrollRun.Comment      = db.GetParameterValue(dbCommand, "Comment").ToString();

            return(payrollRun);
        }