Exemplo n.º 1
0
        public List<RMS.Common.ObjectModel.CShiftSchedule> GetAllShiftSchedule()
        {
            List<CShiftSchedule> shiftScheduleList = new List<CShiftSchedule>();

            string sSql = SqlQueries.GetQuery(Query.GetAllShiftSchedule);

            try
            {

                this.OpenConnection();
                IDataReader oReader = this.ExecuteReader(sSql);

                while (oReader.Read())
                {
                    CShiftSchedule shiftSchedule = new CShiftSchedule();

                    shiftSchedule = ReaderToShiftSchedule(oReader);

                    shiftScheduleList.Add(shiftSchedule);
                }

            }

            catch (Exception ex)
            {
                Logger.Write("Exception : " + ex + " in GetAllShiftManage()", LogLevel.Error, "Database");
                if (ex.GetType().Equals(typeof(SqlException)))
                {
                    SqlException oSQLEx = ex as SqlException;
                    if (oSQLEx.Number != 7619)
                        throw new Exception("Exception occured at GetAllShiftManage()", ex);
                }
                else
                {
                    throw new Exception("Exception occure at GetAllShiftManage()", ex);
                }
            }
            finally
            {
                this.CloseConnection();
            }

            return shiftScheduleList;
        }
Exemplo n.º 2
0
        private CShiftSchedule ReaderToShiftSchedule(IDataReader inReader)
        {
            CShiftSchedule tempShiftSchedule = new CShiftSchedule();

            if (inReader["schedule_id"] != null)
                tempShiftSchedule.ScheduleId = Int64.Parse(inReader["schedule_id"].ToString());

            if (inReader["shift_id"] != null)
                tempShiftSchedule.ShiftId = Int64.Parse(inReader["shift_id"].ToString());

                if (inReader["shift_no"] != null)
                tempShiftSchedule.ShiftNo = Int32.Parse(inReader["shift_no"].ToString());

            if (inReader["creationDate"] != null)
                tempShiftSchedule.CreationDate = Convert.ToDateTime(inReader["creationDate"].ToString());

            if (inReader["start_day"] != null)
                tempShiftSchedule.StartDay = Convert.ToDateTime(inReader["start_day"].ToString());

            if (inReader["start_time"] != null)
                tempShiftSchedule.StartTime = Convert.ToDateTime(inReader["start_time"].ToString());

            if (inReader["end_day"] != null)
                tempShiftSchedule.EndDay = Convert.ToDateTime(inReader["end_day"].ToString());

            if (inReader["end_time"] != null)
                tempShiftSchedule.EndTime = Convert.ToDateTime(inReader["end_time"].ToString());

            if (inReader["start_timestamp"] != null)
                tempShiftSchedule.StartTimestamp = Int64.Parse(inReader["start_timestamp"].ToString());

            if (inReader["end_timestamp"] != null)
                tempShiftSchedule.EndTimestamp = Int64.Parse(inReader["end_timestamp"].ToString());

            if (inReader["isactive"] != null)
                tempShiftSchedule.Isactive = Boolean.Parse( inReader["isactive"].ToString());

            return tempShiftSchedule;
        }