private void Transport_Click(object sender, RoutedEventArgs e)
        {
            TransportList transportList = new TransportList();

            transportList.Show();
            this.Close();
        }
        //застосування фільтру
        void ApplyFilter()
        {
            if (RecoveryList == null)
            {
                RecoveryList = TransportList;
            }

            _orderFlag  = Order.None;
            ordrBtnText = "Не впорядковано";

            List <PublicTransport> result;

            result = _filter.ByModel(ModelArg, TransportList.ToList());//_ft.ByModel

            result = _filter.ByEngineType(EngineTypeArg, result);
            result = _filter.ByEnginePower(EnginePowerArg, result);
            result = _filter.ByAxles(AxlesArg, result);
            result = _filter.ByDoors(DoorsArg, result);
            result = _filter.ByCapacity(CapacityArg, result);
            result = _filter.BySeats(SeatsArg, result);
            result = _filter.ByStandingRoom(StandsArg, result);
            result = _filter.ByClearance(LowClearanceArg, result);

            TransportList = new ObservableCollection <PublicTransport>(result);
        }
 //розрахунок середньої потужності
 public void CalculateAvgPower()
 {
     try { AvgPower = TransportList.Average(p => p.EnginePower); }
     catch (Exception ex)
     {
         //MessageBox.Show("Error during calculating avg value! \r\nAdditional info:\r\n" + ex.Message, Constants.DefaultErrorHeader);
     }
 }
Esempio n. 4
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            //if (Request.Form["_details"] != null)
            //{

            int      event_fk       = int.Parse(Request.QueryString["event_fk"]);
            DateTime date           = DateTime.Parse(Request.QueryString["date"]);
            TimeSpan time           = TimeSpan.Parse(Request.QueryString["time"]);
            int      activity_fk    = int.Parse(Request.QueryString["activity_fk"]);
            int      guide_fk       = int.Parse(Request.QueryString["guide_fk"]);
            string   comments_trans = Request.QueryString["comments_trans"];

            TransportList list   = new TransportList();
            Event         _event = db.Events.SingleOrDefault(a => a.ID == event_fk);
            list.activity_name  = _event.Activity.name;
            list.comments_trans = _event.comments;
            list.date           = _event.date;
            list.guide_name     = _event.Guide.name;
            list.passengers     = GetPassengersList(event_fk);
            TotalP           = list.passengers.Sum(a => a.PAX);
            list.pickup_time = _event.time.Value;


            var PNRs = (from a in db.SoldActivities
                        where a.event_fk == event_fk && a.canceled == false
                        select a.PNR).ToList();

            var flights = (from a in db.Clients
                           where PNRs.Contains(a.PNR)
                           select a.Flight1).Distinct();

            list.flights = (from a in flights
                            select new FlightDTO {
                num = a.num, date = a.date, time = a.time
            }).ToList();

            var agencies = from a in db.Clients
                           where PNRs.Contains(a.PNR)
                           select a.Agency.name;
            db.Dispose();
            DATA       = Newtonsoft.Json.JsonConvert.SerializeObject(list);
            Passengers = Newtonsoft.Json.JsonConvert.SerializeObject(list.passengers);
            Flights    = Newtonsoft.Json.JsonConvert.SerializeObject(list.flights);

            DateStart = list.date.ToString("yyyy-MM-dd");
        }
    }
Esempio n. 5
0
        private void SaveUserData(ServerDataModel serverData)
        {
            Settings.Extension = serverData.extension;
            #region save data
            Settings.FirstLogin  = false;
            Settings.UserDomain  = serverData.user_domain;
            Settings.DisplayName = serverData.display_name;
            Settings.UserName    = serverData.sip_username;
            Settings.Password    = serverData.sip_password;
            Settings.AuthName    = serverData.auth_name;
            Settings.SipServer   = serverData.sip_server;
            Settings.STUNServer  = serverData.stun_server;
            //Settings.STUNServerPort = int.Parse(serverDataResult.data.stun_server_port);
            Settings.SRTPPolicy       = serverData.srtp;
            Settings.DefaultTransport = serverData.default_transport;
            // make it list key wa value
            if (serverData.default_transport.ToLower().Equals(TransportType.TCP.ToString().ToLower()))
            {
                Settings.SipServerPort = serverData.sip_transport.tcp;
                Settings.SipServerType = TransportType.TCP.ToString();
            }
            else if (serverData.default_transport.ToLower().Equals(TransportType.UDP.ToString().ToLower()))
            {
                Settings.SipServerPort = serverData.sip_transport.udp;
                Settings.SipServerType = TransportType.UDP.ToString();
            }
            else
            {
                Settings.SipServerPort = serverData.sip_transport.tls;
                Settings.SipServerType = TransportType.TLS.ToString();
            }
            TransportList.Add("TCP", serverData.sip_transport.tcp);
            TransportList.Add("UDP", serverData.sip_transport.udp);
            TransportList.Add("TLS", serverData.sip_transport.tls);


            #endregion
        }
Esempio n. 6
0
 /// <summary>
 /// Create a new instance of a node object and let it reference
 /// an open transport.
 /// </summary>
 /// <remarks>
 /// Create a new instance of a node object and let it reference
 /// an open transport. The creator of this object is then
 /// responsible for adding this node to the circular list itself.
 /// </remarks>
 public Node(TransportList _enclosing, object item)
 {
     this._enclosing = _enclosing;
     this.item       = item;
 }
 /// <summary>
 /// Create a new instance of a node object and let it reference
 /// an open transport.
 /// </summary>
 /// <remarks>
 /// Create a new instance of a node object and let it reference
 /// an open transport. The creator of this object is then
 /// responsible for adding this node to the circular list itself.
 /// </remarks>
 public Node(TransportList _enclosing, object item)
 {
     this._enclosing = _enclosing;
     this.item = item;
 }
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            int      event_fk       = int.Parse(Request.QueryString["event_fk"]);
            DateTime date           = DateTime.Parse(Request.QueryString["date"]);
            TimeSpan time           = TimeSpan.Parse(Request.QueryString["time"]);
            int      activity_fk    = int.Parse(Request.QueryString["activity_fk"]);
            int      guide_fk       = int.Parse(Request.QueryString["guide_fk"]);
            string   comments_trans = Request.QueryString["comments_trans"];

            TransportList list   = new TransportList();
            Event         _event = db.Events.SingleOrDefault(a => a.ID == event_fk);
            list.activity_name  = _event.Activity.name;
            list.comments_trans = _event.comments;
            list.date           = _event.date;
            list.guide_name     = _event.Guide.name;
            list.pickup_time    = _event.time.Value;



            List <string> PNRs = (from a in db.SoldActivities
                                  where a.event_fk == event_fk && a.canceled == false
                                  select a.PNR).ToList();

            var flights = (from a in db.Clients
                           where PNRs.Contains(a.PNR)
                           select a.Flight).Distinct();

            list.flights = (from a in flights
                            select new FlightDTO {
                num = a.num, date = a.date, time = a.time
            }).ToList();

            DateTime lastDepDate = (from a in db.Clients
                                    where PNRs.Contains(a.PNR)
                                    orderby a.date_dep descending
                                    select a.date_dep).FirstOrDefault();
            DateEnd        = lastDepDate.ToString("yyyy-MM-dd");
            list.tour_plan = GetTourPlan(_event.date, lastDepDate, event_fk);

            var existing_tours_fks   = list.tour_plan.Select(a => a.activity_fk).Distinct().ToList();
            var existing_tours_names = from a in db.Activities
                                       where existing_tours_fks.Contains(a.ID)
                                       select a.subcat;



            list.passengers = GetPassengersList(event_fk, PNRs, existing_tours_fks);

            TotalP = list.passengers.Sum(a => a.PAX);


            var agencies = from a in db.Clients
                           where PNRs.Contains(a.PNR)
                           select a.Agency.name;


            TourNames = Newtonsoft.Json.JsonConvert.SerializeObject(existing_tours_names);


            db.Dispose();
            DATA       = Newtonsoft.Json.JsonConvert.SerializeObject(list);
            Passengers = Newtonsoft.Json.JsonConvert.SerializeObject(list.passengers);
            TourPlan   = Newtonsoft.Json.JsonConvert.SerializeObject(list.tour_plan);
            Flights    = Newtonsoft.Json.JsonConvert.SerializeObject(list.flights);
            DateStart  = list.date.ToString("yyyy-MM-dd");
        }
    }
 //експорт всіх
 void ExportAll()
 {
     _dataService.ExportTransportList(TransportList.ToList());
 }
 //створення нового
 void CreateNewTransport()
 {
     TransportList.Add(new PublicTransport());
     SelectedItem = TransportList.LastOrDefault();
 }
 //видалення
 void DeleteTransport()
 {
     TransportList.Remove(SelectedItem);
 }
 //імпорт однойго екземпляру
 void ImportSingle()
 {
     SelectedItem = _dataService.ImportSingle(SelectedItem);
     TransportList.Add(SelectedItem);
 }
        //методи, виконувані командами
        //застосування сортування
        void ApplyOrderBy()
        {
            OrderRecoveryList = TransportList;

            switch (OrderByFlag)
            {
            case eOrderBy.Model: TransportList = new ObservableCollection <PublicTransport>(Sorter.ByModel(TransportList.ToList(), _orderFlag)); break;

            case eOrderBy.EngineType: TransportList = new ObservableCollection <PublicTransport>(Sorter.ByEngineType(TransportList.ToList(), _orderFlag)); break;

            case eOrderBy.EnginePower: TransportList = new ObservableCollection <PublicTransport>(Sorter.ByPower(TransportList.ToList(), _orderFlag)); break;

            case eOrderBy.Axles: TransportList = new ObservableCollection <PublicTransport>(Sorter.ByAxles(TransportList.ToList(), _orderFlag)); break;

            case eOrderBy.Doors: TransportList = new ObservableCollection <PublicTransport>(Sorter.ByDoors(TransportList.ToList(), _orderFlag)); break;

            case eOrderBy.PassengerCapacity: TransportList = new ObservableCollection <PublicTransport>(Sorter.ByCapacity(TransportList.ToList(), _orderFlag)); break;

            case eOrderBy.Seats: TransportList = new ObservableCollection <PublicTransport>(Sorter.BySeats(TransportList.ToList(), _orderFlag)); break;

            case eOrderBy.LowClearance: TransportList = new ObservableCollection <PublicTransport>(Sorter.ByClearance(TransportList.ToList(), _orderFlag)); break;

            default:
                TransportList = OrderRecoveryList;
                break;
            }

            var take = SkipValue;

            if (SkipValue == 0)
            {
                take = TransportList.Count;
            }
            TransportList = new ObservableCollection <PublicTransport>(TransportList.Take(take));
        }