Example #1
0
        public static CustomList <ShiftRoster> GetAllShiftRoster()
        {
            ConnectionManager        conManager            = new ConnectionManager(ConnectionName.HR);
            CustomList <ShiftRoster> ShiftRosterCollection = new CustomList <ShiftRoster>();
            IDataReader  reader = null;
            const String sql    = "select *from ShiftRoster";

            try
            {
                conManager.OpenDataReader(sql, out reader);
                while (reader.Read())
                {
                    ShiftRoster newShiftRoster = new ShiftRoster();
                    newShiftRoster.SetData(reader);
                    ShiftRosterCollection.Add(newShiftRoster);
                }
                ShiftRosterCollection.InsertSpName = "spInsertShiftRoster";
                ShiftRosterCollection.UpdateSpName = "spUpdateShiftRoster";
                ShiftRosterCollection.DeleteSpName = "spDeleteShiftRoster";
                return(ShiftRosterCollection);
            }
            catch (Exception ex)
            {
                throw (ex);
            }
            finally
            {
                if (reader != null && !reader.IsClosed)
                {
                    reader.Close();
                }
            }
        }
Example #2
0
        public static CustomList <ShiftRoster> GetAllProcessedShiftRoster(string fromDate, string toDate)
        {
            ConnectionManager        conManager            = new ConnectionManager(ConnectionName.HR);
            CustomList <ShiftRoster> ShiftRosterCollection = new CustomList <ShiftRoster>();
            string search = String.Empty;

            search = CommonHelper.CreateSearchString();
            search = "@FromDate='" + fromDate + "',@ToDate='" + toDate + "'," + search;
            search = search.Length > 0 ? search.Substring(0, search.Length - 1) : string.Empty;


            IDataReader reader = null;
            String      sql    = "EXEC spGetShiftSRosteredEmp " + search;

            try
            {
                conManager.OpenDataReader(sql, out reader);
                while (reader.Read())
                {
                    ShiftRoster newShiftRoster = new ShiftRoster();
                    newShiftRoster.SetDataShiftRoster(reader);
                    ShiftRosterCollection.Add(newShiftRoster);
                }
                ShiftRosterCollection.InsertSpName = "spInsertShiftRoster";
                ShiftRosterCollection.UpdateSpName = "spUpdateShiftRoster";
                ShiftRosterCollection.DeleteSpName = "spDeleteShiftRoster";
                return(ShiftRosterCollection);
            }
            catch (Exception ex)
            {
                throw (ex);
            }
            finally
            {
                if (reader != null && !reader.IsClosed)
                {
                    reader.Close();
                }
            }
        }