Пример #1
0
        public RMS.Common.ObjectModel.CShiftOrderInfo GetAllShiftOrderInfoID(long ShiftOrderID)
        {
            CShiftOrderInfo shiftSchedule = new CShiftOrderInfo();

            string sSql = String.Format(SqlQueries.GetQuery(Query.GetAllShiftOrderInfoID), ShiftOrderID);

            try
            {

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

                while (oReader.Read())
                {
                    shiftSchedule = ReaderToShiftOrder(oReader);

                }

            }

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

            return shiftSchedule;
        }
Пример #2
0
        private CShiftOrderInfo ReaderToShiftOrder(IDataReader inReader)
        {
            CShiftOrderInfo tempShiftSOrder = new CShiftOrderInfo();

            if (inReader["ShiftOrderID"] != null)
                tempShiftSOrder.ShiftOrderID = Int64.Parse(inReader["ShiftOrderID"].ToString());

            if (inReader["shiftID"] != null)
                tempShiftSOrder.ShiftID = Int64.Parse(inReader["shiftID"].ToString());

            if (inReader["orderID"] != null)
                tempShiftSOrder.OrderID = Int64.Parse(inReader["orderID"].ToString());

            if (inReader["creationDate"] != null)
                tempShiftSOrder.CreationDate = DateTime.Parse(inReader["creationDate"].ToString());

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

            if (inReader["paymentcreationDate"] != null)
                tempShiftSOrder.PaymentCreationDate = DateTime.Parse(inReader["paymentcreationDate"].ToString());

            return tempShiftSOrder;
        }
Пример #3
0
        public List<CShiftOrderInfo> GetAllShiftOrderInfoByPaymentcreationDate(DateTime paymentcreationDate)
        {
            List<CShiftOrderInfo> shiftorderList = new List<CShiftOrderInfo>();
                DateTime toDate = new DateTime(paymentcreationDate.Year, paymentcreationDate.Month, paymentcreationDate.Day, 23, 59, 59);

                string sSql = String.Format(SqlQueries.GetQuery(Query.GetAllShiftOrderInfoByPaymentcreationDate), paymentcreationDate, toDate);

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

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

                    shiftSchedule = ReaderToShiftOrder(oReader);

                    shiftorderList.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 shiftorderList;
        }