Ejemplo n.º 1
0
        private void Save_Click(object sender, RoutedEventArgs e)
        {
            var    route    = wayVal;
            var    interval = interVal;
            var    number   = 0; //заглушка?
            string comment  = Comment.Text;

            addr_street = tB_Addr_street.Text;
            addr_house  = tB_Addr_house.Text;
            addr_korp   = tB_Addr_korp.Text;
            order       = tB_order.Text;

            if ((addr_street == "") || (addr_house == "") || (order == ""))
            {
                MessageBox.Show("Введите улицу/дом/номер заказа");
            }

            //Если номер точки изменился используем метод перестроения ряда
            if (wayNumber.Value != pointRN & wayNumber.Value > 0)
            {
                try
                {
                    //Вызов метода сдвига точек при изменении номера
                    pointRN = GUI.PointRN.NumberMove((int)wayNumber.Value, pointRN, db.GetRoutsBySession(sessionID), db.getPointBySession(sessionID), wayVal);
                }
                catch (Exception)
                {
                    MessageBox.Show("Неверный ввод номера точки в маршруте");
                    return;
                }
            }


            db.ChangePoint(point.ID_Point, route, interval, number, pointRN, sessionID, comment, addr_street, addr_house, addr_korp, order);
            GUI.PointRN.SpaceChecking(db.GetRoutsBySession(sessionID), db.getPointBySession(sessionID), wayVal);
            var Data = db.getPointBySession(sessionID);

            db.ChangePoint(point.ID_Point, route, interval, number, pointRN, sessionID, comment, addr_street, addr_house, addr_korp, order);

            DataChangedEventHandler handler = DataChanged;

            if (handler != null)
            {
                handler(this, new EventArgs());
            }

            this.Close();
        }
Ejemplo n.º 2
0
        public PrintRoute(int sesID, int rourID)
        {
            InitializeComponent();

            sessionId = sesID;
            routeId   = rourID;
            db        = new DBWork();

            db.getPointBySession(sessionId);

            Gecko.Xpcom.Initialize("Firefox");
            WindowsFormsHost host = new WindowsFormsHost();

            browser = new GeckoWebBrowser();
            browser.DocumentCompleted += (sender, e) => { DrawRoutesOnMap(); };

            host.Child = browser;
            GridWeb.Children.Add(host);
            browser.Navigate(URL);

            setRoutes();
            //point Update
            PrintDialog printDlg = new PrintDialog();

            printDlg.PrintVisual(GridPanel, "GridPrinting");
        }
Ejemplo n.º 3
0
        private void AddPointClick(object sender, RoutedEventArgs e)
        {
            string korp = "0";

            if (City.Text == null || Street.Text == "" || House.Text == "")
            {
                System.Windows.MessageBox.Show("Не все обязательные значения введены");
            }
            else
            {
                //pointRN = (int)wayNumber.Value; // получаем введенное значение
                //if (pointNumber < db.FindLastPoint(wayVal + 1, interVal) + 1)
                //    db.Shift(wayVal + 1, interVal, pointNumber);
                if (Corpes.Text != "")
                {
                    korp = Corpes.Text;
                }
                var orderNumber = Order.Text;
                var house       = House.Text;

                var city     = City.Text;
                var street   = Street.Text;
                var interval = interVal;
                var number   = 0; //заглушка?
                //Если номер больше 0, то вызываем метод сдвига
                if (wayNumber.Value > 0)
                {
                    //Метод возвращает (утверждает) номер точки, осуществляя по необходимости сдвиг
                    pointRN = GUI.PointRN.NumberInsert((int)wayNumber.Value, db.GetRoutsBySession(sessionID), db.getPointBySession(sessionID), wayVal);
                }
                //если равен или меньше то ставим в конец
                else
                {
                    DBWork db = new DBWork();
                    pointRN = GUI.PointRN.FirstNumber(db.GetRoutsBySession(sessionID), db.getPointBySession(sessionID), wayVal);
                }


                db.InsertPoint(orderNumber, city, street, house, korp, interval, number, pointRN, sessionID, wayVal);

                DataChangedEventHandler handler = DataChanged;

                if (handler != null)
                {
                    handler(this, new EventArgs());
                }

                this.Close();
            }
        }
Ejemplo n.º 4
0
        public void setRoutes()
        {
            db     = new DBWork();
            Routes = new ObservableCollection <newRoute> {
            };

            var    Data      = db.getPointBySession(sessionId);
            var    sizeData  = Data.Count;
            string dataPoint = "";

            var dbRoutes = db.GetRoutsBySession(sessionId);

            foreach (var item in dbRoutes)
            {
                if (item.RouteNumber == routeId)
                {
                    List <NewPoints> pointSet1 = new List <NewPoints>();
                    List <NewPoints> pointSet2 = new List <NewPoints>();
                    List <NewPoints> pointSet3 = new List <NewPoints>();
                    List <NewPoints> pointSet4 = new List <NewPoints>();
                    List <NewPoints> pointSet5 = new List <NewPoints>();

                    for (var k = 0; k < sizeData; k++)
                    {
                        var elem     = Data[k];
                        var city     = elem.City;
                        var street   = elem.Street;
                        var house    = elem.House + "";
                        var korp     = elem.Korp + "";
                        var interval = elem.Interval;

                        var route   = elem.ID_Route;
                        var pointID = elem.ID_Point;

                        if (route == item.ID_Route)
                        {
                            string streetAndHouse;
                            if ((korp == "") || (korp == "0"))
                            {
                                streetAndHouse = "ул. " + street + ", " + house;
                                dataPoint      = "   #1" + ": " + streetAndHouse;
                            }
                            else
                            {
                                streetAndHouse = "ул. " + street + ", " + house + " к" + korp;
                                dataPoint      = "   #1" + ": " + streetAndHouse;
                            }

                            var newPoint = new NewPoints
                            {
                                pointId   = elem.ID_Point,
                                pointText = dataPoint,
                                Order     = elem.OrderNumber,
                                Address   = city + ", " + streetAndHouse
                            };
                            switch (interval)
                            {
                            case ("с 9:00 до 12:00"):
                                pointSet1.Add(newPoint);
                                break;

                            case ("с 12:00 до 15:00"):
                                pointSet2.Add(newPoint);
                                break;

                            case ("с 15:00 до 18:00"):
                                pointSet3.Add(newPoint);
                                break;

                            case ("с 18:00 до 21:00"):
                                pointSet4.Add(newPoint);
                                break;

                            case ("с 9:00 до 21:00"):
                                pointSet5.Add(newPoint);
                                break;
                            }
                        }
                    }


                    if (item.RouteNumber == 0)
                    {
                        Routes.Add(new newRoute
                        {
                            routeText  = "Без маршрута",
                            point1     = pointSet1,
                            point2     = pointSet2,
                            point3     = pointSet3,
                            point4     = pointSet4,
                            point5     = pointSet5,
                            GUIroute   = item,
                            RouteColor = item.Color
                        });
                    }
                    else
                    {
                        Routes.Add(new newRoute
                        {
                            routeText  = "Маршрут " + item.RouteNumber,
                            point1     = pointSet1,
                            point2     = pointSet2,
                            point3     = pointSet3,
                            point4     = pointSet4,
                            point5     = pointSet5,
                            GUIroute   = item,
                            RouteColor = item.Color
                        });
                    }
                }
            }
            routesList.ItemsSource = Routes;
        }