示例#1
0
        ///	<summary>
        ///	Data Set Get Trailer Data
        ///	</summary>
        private DataSet GetTrailerData()
        {
            DataSet dsTrailers = null;

            if (Request.QueryString["showAvailable"] != null)
            {
                DateTime startDate = DateTime.Parse(dteStartDate.SelectedDate.ToString());
                startDate = startDate.Subtract(startDate.TimeOfDay);

                DateTime endDate = DateTime.Parse(dteEndDate.SelectedDate.ToString());
                endDate = endDate.Subtract(endDate.TimeOfDay).Add(new TimeSpan(23, 59, 59));

                Facade.IResource facTrailer = new Facade.Resource();
                dsTrailers = facTrailer.GetAvailableForDateRange(eResourceType.Trailer, startDate, endDate);

                pnlTrailer.Visible = true;
            }
            else if (!String.IsNullOrEmpty(txtFilterTrailerRef.Text))
            {
                Facade.ITrailer facResource = new Facade.Resource();
                dsTrailers         = facResource.GetFiltered(false, txtFilterTrailerRef.Text);
                pnlTrailer.Visible = true;
            }
            else
            {
                Facade.ITrailer facResource = new Facade.Resource();
                dsTrailers         = facResource.GetAll(false, false);
                pnlTrailer.Visible = true;
            }

            return(dsTrailers);
        }
示例#2
0
        ///	<summary>
        ///	Data Set Get Vehicle Data
        ///	</summary
        private DataSet GetVehicleData(bool inlcudeDeleted)
        {
            Facade.IVehicle facResource = new Facade.Resource();
            DataSet         dsVehicles  = null;

            Facade.IResource facTrailer = new Facade.Resource();

            if (Request.QueryString["showAvailable"] != null)
            {
                DateTime startDate = rdiStartDate.SelectedDate.Value;
                startDate = startDate.Subtract(startDate.TimeOfDay);

                DateTime endDate = rdiEndDate.SelectedDate.Value;
                endDate = endDate.Subtract(endDate.TimeOfDay).Add(new TimeSpan(23, 59, 59));

                dsVehicles = facTrailer.GetAvailableForDateRange(eResourceType.Vehicle, startDate, endDate);

                if (Orchestrator.Globals.Configuration.FleetMetrikInstance)
                {
                    dsVehicles.Tables[0].Columns.Add("CurrentLocation", typeof(string));
                }
            }
            else if (Orchestrator.Globals.Configuration.FleetMetrikInstance)
            {
                dsVehicles = facResource.GetAllWithGPS(inlcudeDeleted);
                dsVehicles.Tables[0].Columns.Add("CurrentLocation", typeof(string));
            }
            else
            {
                dsVehicles = facResource.GetAllVehicles();
                if (Orchestrator.Globals.Configuration.FleetMetrikInstance)
                {
                    dsVehicles.Tables[0].Columns.Add("CurrentLocation", typeof(string));
                }
            }


            return(dsVehicles);
        }
        private void PopulateVehicles()
        {
            DataSet ds = null;

            if (dteStartDate.SelectedDate != DateTime.MinValue && dteEndDate.SelectedDate != DateTime.MinValue)
            {
                DateTime startDate = dteStartDate.SelectedDate.Value;
                startDate = startDate.Subtract(startDate.TimeOfDay);

                DateTime endDate = dteEndDate.SelectedDate.Value;
                endDate = endDate.Subtract(endDate.TimeOfDay).Add(new TimeSpan(23, 59, 59));

                Facade.IResource facResource = new Facade.Resource();
                ds = facResource.GetAvailableForDateRange(eResourceType.Vehicle, startDate, endDate);
            }
            else
            {
                ds = (DataSet)ViewState[C_VEHICLESDS_VS];
            }

            if (ds != null)
            {
                DataView dv             = new DataView(ds.Tables[0]);
                string   sortExpression = SortCriteria + " " + SortDirection;
                dv.Sort = sortExpression.Trim();

                dgVehicles.DataSource = dv;
                dgVehicles.DataBind();

                ViewState[C_VEHICLESDS_VS] = ds;
            }
            else
            {
                dgVehicles.Visible = false;
            }
        }