Beispiel #1
0
        public List <CityPrepDaysTbl> GetAllByCityId(int pCityID)
        {
            string _sqlCmd = CONST_SQL_SELECTBYCITYID;
            //if (!String.IsNullOrEmpty(SortBy))
            //  _sqlCmd += " ORDER BY " + SortBy;

            TrackerDb _TrackerDb = new TrackerDb();

            _TrackerDb.AddWhereParams(pCityID, DbType.Int32);

            List <CityPrepDaysTbl> _DataItems  = new List <CityPrepDaysTbl>();
            IDataReader            _DataReader = _TrackerDb.ExecuteSQLGetDataReader(_sqlCmd);

            if (_DataReader != null)
            {
                while (_DataReader.Read())
                {
                    CityPrepDaysTbl _DataItem = new CityPrepDaysTbl();

                    _DataItem.CityID            = pCityID;
                    _DataItem.CityPrepDaysID    = (_DataReader["CityPrepDaysID"] == DBNull.Value) ? 0 : Convert.ToInt32(_DataReader["CityPrepDaysID"]);
                    _DataItem.PrepDayOfWeekID   = (_DataReader["PrepDayOfWeekID"] == DBNull.Value) ? byte.MinValue : Convert.ToByte(_DataReader["PrepDayOfWeekID"]);
                    _DataItem.DeliveryDelayDays = (_DataReader["DeliveryDelayDays"] == DBNull.Value) ? 0 : Convert.ToInt16(_DataReader["DeliveryDelayDays"]);
                    _DataItem.DeliveryOrder     = (_DataReader["DeliveryOrder"] == DBNull.Value) ? 0 : Convert.ToInt16(_DataReader["DeliveryOrder"]);

                    _DataItems.Add(_DataItem);
                }
                _DataReader.Close();
            }
            _TrackerDb.Close();
            return(_DataItems);
        }
Beispiel #2
0
        public string InsertCityPrepDay(CityPrepDaysTbl objCityPrepDaysTbl)
        {
            string _Result = String.Empty;

            TrackerDb _TDB = new TrackerDb();

            /// CityID, PrepDayOfWeekID, DeliveryDelayDays, DeliveryOrder
            _TDB.AddParams(objCityPrepDaysTbl.CityID, System.Data.DbType.Int32);
            _TDB.AddParams(objCityPrepDaysTbl.PrepDayOfWeekID, System.Data.DbType.Byte);
            _TDB.AddParams(objCityPrepDaysTbl.DeliveryDelayDays, System.Data.DbType.Int32);
            _TDB.AddParams(objCityPrepDaysTbl.DeliveryOrder, System.Data.DbType.Int32);

            _Result = _TDB.ExecuteNonQuerySQL(CONST_SQL_INSERT);

            _TDB.Close();

            return(_Result);
        }
Beispiel #3
0
        public string UpdateCityPrepDay(CityPrepDaysTbl objCityPrepDaysTbl, int origCityPrepDaysID)
        {
            string _Result = String.Empty;

            if (origCityPrepDaysID > 0)
            {
                TrackerDb _TDB = new TrackerDb();
                /// CityID, PrepDayOfWeekID, DeliveryDelayDays, DeliveryOrder
                _TDB.AddParams(objCityPrepDaysTbl.CityID, System.Data.DbType.Int32);
                _TDB.AddParams(objCityPrepDaysTbl.PrepDayOfWeekID, System.Data.DbType.Byte);
                _TDB.AddParams(objCityPrepDaysTbl.DeliveryDelayDays, System.Data.DbType.Int32);
                _TDB.AddParams(objCityPrepDaysTbl.DeliveryOrder, System.Data.DbType.Int32);
                /// Where CityPrepDayID
                _TDB.AddWhereParams(origCityPrepDaysID, DbType.Int32);

                _Result = _TDB.ExecuteNonQuerySQL(CONST_SQL_UPDATEBYID);

                _TDB.Close();
            }
            return(_Result);
        }
Beispiel #4
0
 public string UpdateCityPrepDay(CityPrepDaysTbl objCityPrepDaysTbl)
 {
     return(UpdateCityPrepDay(objCityPrepDaysTbl, objCityPrepDaysTbl.CityPrepDaysID));
 }