Example #1
0
        public static List <EmployeeLeave> GetEmployeeLeaveList(int companyId)
        {
            List <EmployeeLeave> list = new List <EmployeeLeave>();

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

            db.AddInParameter(dbCommand, "@CompanyId", DbType.Int32, companyId);

            using (IDataReader dataReader = db.ExecuteReader(dbCommand))
            {
                while (dataReader.Read())
                {
                    EmployeeLeave employeeLeave = new EmployeeLeave();
                    employeeLeave.EmployeeLeaveId   = Convert.ToInt32(dataReader["EmployeeLeaveId"]);
                    employeeLeave.EmployeeId        = Convert.ToInt32(dataReader["EmployeeId"]);
                    employeeLeave.FinancialPeriodId = Convert.ToInt32(dataReader["FinancialPeriodId"]);
                    employeeLeave.CurrentDays       = Convert.ToDouble(dataReader["CurrentDays"]);
                    employeeLeave.EntitledDays      = Convert.ToDouble(dataReader["EntitledDays"]);
                    list.Add(employeeLeave);
                }
            }
            return(list);
        }
Example #2
0
        public static EmployeeLeave GetEmployeeLeaveByEmployeeIdFinancialPeriodId(int employeeId, int financialPeriodId)
        {
            Database  db         = DatabaseFactory.CreateDatabase("Spar-StoreRep");
            string    sqlCommand = "GetEmployeeLeaveByEmployeeIdFinancialPeriodId";
            DbCommand dbCommand  = db.GetStoredProcCommand(sqlCommand);

            db.AddInParameter(dbCommand, "@EmployeeId", DbType.Int32, employeeId);
            db.AddInParameter(dbCommand, "@FinancialPeriodId", DbType.Int32, financialPeriodId);
            db.AddOutParameter(dbCommand, "@EmployeeLeaveId", DbType.Int32, 4);
            db.AddOutParameter(dbCommand, "@CurrentDays", DbType.Double, 8);
            db.AddOutParameter(dbCommand, "@EntitledDays", DbType.Double, 8);
            //db.AddOutParameter(dbCommand, "@AccumulatedDays", DbType.Double, 8);
            db.AddOutParameter(dbCommand, "@EmployeeLeaveProjection", DbType.Double, 8);
            db.ExecuteNonQuery(dbCommand);
            EmployeeLeave employeeLeave = new EmployeeLeave();

            employeeLeave.EmployeeId        = employeeId;
            employeeLeave.FinancialPeriodId = financialPeriodId;
            employeeLeave.EmployeeLeaveId   = Convert.ToInt32(db.GetParameterValue(dbCommand, "EmployeeLeaveId"));
            employeeLeave.CurrentDays       = Convert.ToDouble(db.GetParameterValue(dbCommand, "CurrentDays"));
            employeeLeave.EntitledDays      = Convert.ToDouble(db.GetParameterValue(dbCommand, "EntitledDays"));
            //employeeLeave.AccumulatedDays = Convert.ToDouble(db.GetParameterValue(dbCommand, "AccumulatedDays"));
            employeeLeave.EmployeeLeaveProjection = Convert.ToDouble(db.GetParameterValue(dbCommand, "EmployeeLeaveProjection"));
            return(employeeLeave);
        }
Example #3
0
        public static EmployeeLeave GetAccumulatedLeaveByEmployeeId(int employeeId, int financialPeriodId)
        {
            Database  db         = DatabaseFactory.CreateDatabase("Spar-StoreRep");
            string    sqlCommand = "GetAccumulatedLeaveByEmployeeId";
            DbCommand dbCommand  = db.GetStoredProcCommand(sqlCommand);

            db.AddInParameter(dbCommand, "@EmployeeId", DbType.Int32, employeeId);
            db.AddInParameter(dbCommand, "@FinancialPeriodId", DbType.Int32, financialPeriodId);
            db.AddOutParameter(dbCommand, "@AccumulatedLeave", DbType.Double, 8);
            db.ExecuteNonQuery(dbCommand);
            EmployeeLeave employeeLeave = new EmployeeLeave();

            employeeLeave.EmployeeId       = employeeId;
            employeeLeave.AccumulatedLeave = Convert.ToDouble(db.GetParameterValue(dbCommand, "AccumulatedLeave"));
            return(employeeLeave);
        }