Beispiel #1
0
        public void addForm()
        {
            formList.Clear();
            DbWorking.ViewMsg();
            StackLayout stack = new StackLayout
            {
                BackgroundColor = Color.FromHex("#F8F8F8"),
                Spacing         = 0,
                Children        =
                {
                    new Line {
                        X1 = 500, Stroke = Brush.GhostWhite, HorizontalOptions = LayoutOptions.CenterAndExpand, Margin = new Thickness(0, 0, 0, 5)
                    },
                }
            };

            foreach (Frame frame in News.formList)
            {
                stack.Children.Add(frame);
            }
            ScrollView scrollView = new ScrollView {
                Content = stack
            };

            refreshView.Content     = scrollView;
            refreshView.Refreshing += RefreshView_Refreshing;

            Content = refreshView;
        }
Beispiel #2
0
        async private void Button1_Clicked(object sender, EventArgs e)
        {
            User user = new User
            {
                firstName = Entry1.Text,
                phone     = Entry2.Text,
            };

            if (!Check.IsChecked)
            {
                user.zone = picker.Items[picker.SelectedIndex];
            }

            if (Check.IsChecked)
            {
                DbWorking.DeleteCourier(user.phone);
                await DisplayActionSheet("Курьеры", "Ок", null, "Вы успешно удалили курьера!");
            }
            else
            {
                if (DbWorking.AddCourier(user))
                {
                    await DisplayActionSheet("Курьеры", "Ок", null, "Вы успешно добавили нового курьера!");
                }
                else
                {
                    await DisplayActionSheet("Курьеры", "Ок", null, "Вы успешно обновили данные курьера!");
                }
            }
            Application.Current.MainPage = new AdminMenu(8);
        }
        private void Button_Clicked(object sender, EventArgs e)   // разобраться чтобы не заходило по сто раз
        {
            Vibration.Vibrate(TimeSpan.FromSeconds(0.03));
            prod.Clear();
            ProductBasket.list.Clear();
            DbWorking.ViewToBasket(1);
            DbWorking.DeleteBasket();
            string checkList = String.Empty;
            int    i         = 0;

            foreach (String txt in prod)
            {
                checkList = checkList + "\n" + $"{++i}. " + txt;
            }

            userPay.total     = ProductBasket.prCheck;
            userPay.firstName = entry5.Text;
            userPay.phone     = entry2.Text;
            userPay.products  = checkList;
            userPay.point     = 2;

            DisplayActionSheet("Кондитер", "Ок", null, "Ожидайте, пока ваш заказ примет наш оператор.");
            DbWorking.OrdersAdd(userPay);

            Application.Current.MainPage = new UserMenu(0);
        }
Beispiel #4
0
        public Stats()
        {
            InitializeComponent();
            Review rev = DbWorking.StatsReviews();

            LabelSpeed.Text   = rev.speed.ToString();
            LabelService.Text = rev.service.ToString();
            LabelKitchen.Text = rev.kitchen.ToString();
            LabelSum.Text     = rev.sum.ToString() + " балл.";

            int quantity = DbWorking.StatsUsers();

            labelQuantity.Text = quantity.ToString();
            int orders = DbWorking.StatsOrders();

            labelOrders.Text = orders.ToString() + " заказ.";
            int profit = DbWorking.StatsProfit();

            labelProfit.Text = profit.ToString() + " р.";

            labelDay.Text   = DbWorking.StatsNumberOfOrders(0).ToString();
            labelWeek.Text  = DbWorking.StatsNumberOfOrders(1).ToString();
            labelMonth.Text = DbWorking.StatsNumberOfOrders(2).ToString();
            labelYear.Text  = DbWorking.StatsNumberOfOrders(3).ToString();
        }
Beispiel #5
0
 private void TapGestureRecognizer_Tapped(object sender, EventArgs e) // дублирование кода
 {
     Vibration.Vibrate(TimeSpan.FromSeconds(0.03));
     DbWorking.DeleteBasket();
     ProductBasket.list.Clear();
     ProdEmpty();
 }
Beispiel #6
0
        public Courier()
        {
            InitializeComponent();
            User u = DbWorking.ViewCourier();

            label1.Text = u.firstName;
            label2.Text = u.phone;
            label3.Text = u.zone;
        }
Beispiel #7
0
        public LogPoint()
        {
            InitializeComponent();
            User log = DbWorking.LogPoint();

            label1.Text = log.Date;
            label2.Text = log.phone;
            label3.Text = log.tranc;
            label4.Text = log.Point;
        }
Beispiel #8
0
        public Client()
        {
            InitializeComponent();
            User profile = DbWorking.ViewClients();

            label1.Text = profile.firstName;
            label2.Text = profile.Id;
            label3.Text = profile.lastName;
            label4.Text = profile.phone;
            label5.Text = profile.gender;
            label6.Text = profile.dob;
        }
Beispiel #9
0
 public AccountController(
     UserManager <ApplicationUser> userManager,
     SignInManager <ApplicationUser> signInManager,
     IEmailSender emailSender,
     ILogger <AccountController> logger,
     DbWorking dbWorking)
 {
     _userManager   = userManager;
     _signInManager = signInManager;
     _emailSender   = emailSender;
     _logger        = logger;
     _dbWorking     = dbWorking;
 }
Beispiel #10
0
        async private void Button_Clicked(object sender, EventArgs e)
        {
            string click = await DisplayActionSheet("Пуш-рассылка", "Нет", "Отправить", "Не спеши отправлять, убедись, что всё правильно написано.");

            if (click == "Отправить")
            {
                DbWorking.AddPush(Entry1.Text, Editor1.Text);
                await DisplayActionSheet("Пуш-рассылка", "Ок", null, "Отправка прошла успешно!");

                Entry1.Text  = String.Empty;
                Editor1.Text = String.Empty;
            }
        }
Beispiel #11
0
        private void Button_Clicked(object sender, EventArgs e)
        {
            int check = DbWorking.CheckIO();

            if (check == 0)
            {
                Application.Current.MainPage = new GuestMenu(0);
            }
            else
            {
                Application.Current.MainPage = new UserMenu(0);
            }
        }
Beispiel #12
0
        private void Refresh_Refreshing(object sender, EventArgs e)
        {
            Refresh.IsRefreshing = false;
            int isMenu = DbWorking.isCheckMenu();

            if (isMenu == 0)
            {
                Application.Current.MainPage = new UserMenu(2);
            }
            else
            {
                Application.Current.MainPage = new AdminMenu(1);
            }
        }
Beispiel #13
0
 async private void Button1_Clicked(object sender, EventArgs e)
 {
     Vibration.Vibrate(TimeSpan.FromSeconds(0.03));
     if (RadioButton1.IsChecked == true)
     {
         us.gender = "М";
     }
     else
     {
         us.gender = "Ж";
     }
     DbWorking.EditProfile(us.phone, Entry1.Text, Entry2.Text, us.gender);
     await Navigation.PopAsync();
 }
Beispiel #14
0
        private void Button_Clicked(object sender, EventArgs e)
        {
            Vibration.Vibrate(TimeSpan.FromSeconds(0.03));

            Review review = new Review
            {
                speed   = Rating1.Rating,
                kitchen = Rating2.Rating,
                service = Rating3.Rating,
                text    = Editor1.Text
            };

            DbWorking.AddReview(review);
            CheckUserMenu();
        }
Beispiel #15
0
        public Reviews()
        {
            InitializeComponent();
            formList.Clear();
            int check = DbWorking.CheckIO();

            if (check == 1)
            {
                int isMenu = DbWorking.isCheckMenu();
                if (isMenu == 0)
                {
                    DbWorking.ViewReviews(1);
                }
                else
                {
                    DbWorking.ViewReviews(0);
                }
            }
            else
            {
                DbWorking.ViewReviews(1);
            }

            StackLayout stack = new StackLayout
            {
                BackgroundColor = Color.FromHex("#F8F8F8"),
                Spacing         = 0,
                Children        =
                {
                    new Line {
                        X1 = 500, Stroke = Brush.GhostWhite, HorizontalOptions = LayoutOptions.CenterAndExpand, Margin = new Thickness(0, 0, 0, 5)
                    },
                }
            };

            foreach (Frame frame in formList)
            {
                stack.Children.Add(frame);
            }
            ScrollView scrollView = new ScrollView {
                Content = stack
            };

            Content = scrollView;
        }
Beispiel #16
0
        public Orders()
        {
            InitializeComponent();
            stacks.Clear();
            DbWorking.ViewOrders();

            foreach (StackLayout layout in stacks)
            {
                stack.Children.Add(layout);
                stack.Children.Add(new Line
                {
                    X1                = 580,
                    Stroke            = Brush.LightGray,
                    HorizontalOptions = LayoutOptions.Start,
                    Margin            = new Thickness(0, 5, 0, 5)
                });
            }
            Content = Refresh;
        }
Beispiel #17
0
        public History()
        {
            int check = DbWorking.CheckIO();

            if (check == 0)
            {
                Application.Current.MainPage = new GuestMenu(0);
            }
            else
            {
                listFrame.Clear();
                InitializeComponent();
                DbWorking.ViewHistory();
                foreach (Frame frame in listFrame)
                {
                    stackout.Children.Add(frame);
                }
                Scroll.Content  = stackout;
                Refresh.Content = Scroll;
            }
        }
Beispiel #18
0
        public void CheckUserMenu()
        {
            int check = DbWorking.CheckIO();

            if (check == 1)
            {
                int isMenu = DbWorking.isCheckMenu();
                if (isMenu == 0)
                {
                    Application.Current.MainPage = new UserMenu(4);
                }
                else
                {
                    Application.Current.MainPage = new AdminMenu(4);
                }
            }
            else
            {
                Application.Current.MainPage = new GuestMenu(4);
            }
        }
Beispiel #19
0
        public Profile()
        {
            list.Clear();
            Connectivity.ConnectivityChanged += Ethernet.Connectivity_ConnectivityChanged;
            InitializeComponent();
            User us = DbWorking.ViewUser();

            Label1.Text = us.firstName;
            Label2.Text = us.phone;
            Label3.Text = us.DOB.ToString("d");
            Label5.Text = us.point.ToString() + " р.";
            Label4.Text = us.count.ToString() + " заказ";
            DbWorking.ViewPoint(us.phone);

            foreach (Frame frame in list)
            {
                stack.Children.Add(frame);
            }
            Scroll.Content = stack;
            stack2.Children.Add(Scroll);
            Refresh.Content = stack2;
        }
Beispiel #20
0
        public static void CreateFormAdmin(Review rev)
        {
            string rating = String.Empty;
            int    check;

            for (check = 0; check < rev.sum; check++)
            {
                rating = rating + "★";
            }
            if (check < 5)
            {
                int check1 = 5 - check;
                for (check = 0; check < check1; check++)
                {
                    rating = rating + "☆";
                }
            }
            Image image = new Image
            {
                Source        = "close.png",
                Aspect        = Aspect.AspectFit,
                HeightRequest = 25,
                WidthRequest  = 25,
                Margin        = new Thickness(0, -5, 0, 0)
            };
            StackLayout stackLayout = new StackLayout
            {
                Orientation = StackOrientation.Horizontal,
                Spacing     = 210,
                Children    =
                {
                    new Label
                    {
                        Text       = rev.date.ToShortDateString() + " " + rev.date.ToShortTimeString(),
                        TextColor  = Color.FromHex("#A0A0A0"),
                        FontFamily = "Ubuntu-Light.ttf#Ubuntu",
                        FontSize   = 13
                    },
                    image
                }
            };

            Frame frame = new Frame
            {
                Padding      = new Thickness(0, 0, 0, 10),
                Margin       = new Thickness(20, 10, 20, 0),
                CornerRadius = 8,
                HasShadow    = false,
                Content      =
                    new StackLayout
                {
                    Margin   = new Thickness(10),
                    Children =
                    {
                        stackLayout,
                        new Label
                        {
                            Text       = rating,
                            Margin     = new Thickness(0, -4, 0, 0),
                            TextColor  = Color.Black,
                            FontFamily = "Ubuntu-Light.ttf#Ubuntu",
                            FontSize   = 14
                        },
                        new Label
                        {
                            Text       = rev.text,
                            Margin     = new Thickness(0,  2, 0, 0),
                            TextColor  = Color.Black,
                            FontFamily = "Ubuntu-Light.ttf#Ubuntu",
                            FontSize   = 17
                        }
                    }
                }
            };

            int id = rev.id;
            var TapGestureRecognizer = new TapGestureRecognizer();

            TapGestureRecognizer.Tapped += (object sender, EventArgs e) =>
            {
                Vibration.Vibrate(TimeSpan.FromSeconds(0.05));
                formList.Remove(frame);
                DbWorking.DeleteReviewIndex(id);
                Application.Current.MainPage = new AdminMenu(4);
            };
            image.GestureRecognizers.Add(TapGestureRecognizer);

            formList.Add(frame);
        }
Beispiel #21
0
        public Basket()
        {
            ProductBasket.prodlist.Clear();
            ProductBasket.sumlist.Clear();
            ProductBasket.list.Clear();
            InitializeComponent();

            Product p = DbWorking.ViewToBasket(0);

            if (p == null)
            {
                ProdEmpty();
            }
            else
            {
                Frame frame = new Frame
                {
                    BackgroundColor   = Color.FromHex("#F8F8F8"),
                    Padding           = new Thickness(20, 10, 20, 10),
                    VerticalOptions   = LayoutOptions.EndAndExpand,
                    HorizontalOptions = LayoutOptions.FillAndExpand,
                    HasShadow         = false
                };

                Button button = new Button
                {
                    FontSize        = 16,
                    FontFamily      = "Ubuntu-Bold.ttf#Ubuntu",
                    Text            = $"Оформить заказ на {ProductBasket.buttonText} р.\nДоставка = 0 р.",
                    TextTransform   = 0,
                    TextColor       = Color.White,
                    BackgroundColor = Color.FromHex("#b39afd"),
                    CornerRadius    = 8,
                    HeightRequest   = 60
                };

                button.Clicked += (object sender, EventArgs e) =>
                {
                    Vibration.Vibrate(TimeSpan.FromSeconds(0.03));
                    int check = DbWorking.CheckIO();
                    if (check == 0)
                    {
                        DisplayActionSheet("Кондитер", "Ок", null, "Ошибка! Для оплаты товара, необходимо зайти в учетную запись.");
                        return;
                    }
                    Navigation.PushAsync(new BasketList());
                };

                frame.Content = button;

                StackLayout st = new StackLayout
                {
                    Spacing = 0,
                };

                foreach (Grid grid in ProductBasket.list)
                {
                    st.Children.Add(grid);
                    st.Children.Add(new Line
                    {
                        Margin            = new Thickness(0, 10, 0, 0),
                        HeightRequest     = 0.2,
                        X1                = 400,
                        Stroke            = Brush.LightGray,
                        HorizontalOptions = LayoutOptions.Center
                    });
                }

                StackLayout stackLayout = new StackLayout
                {
                    BackgroundColor = Color.White,
                    Children        =
                    {
                        st
                    }
                };

                ScrollView scrollView = new ScrollView {
                    Content = stackLayout
                };

                StackLayout stack = new StackLayout
                {
                    BackgroundColor = Color.White,
                    Spacing         = 0,
                    Children        =
                    {
                        scrollView,
                        frame
                    }
                };
                Content = stack;
            }
        }
Beispiel #22
0
 private void Button_Clicked_6(object sender, EventArgs e)
 {
     Vibration.Vibrate(TimeSpan.FromMilliseconds(2));
     DbWorking.AddToBasket(5);
 }
Beispiel #23
0
        public static void Prod(Product p)
        {
            Image image = new Image
            {
                Source            = p.productPhoto,
                HeightRequest     = 110,
                WidthRequest      = 150,
                HorizontalOptions = LayoutOptions.Start,
            };
            Label labelName = new Label
            {
                Margin     = new Thickness(-20, 4, 0, 0),
                Text       = p.productName,
                TextColor  = Color.Black,
                FontFamily = "Ubuntu-Bold.ttf#Ubuntu",
                FontSize   = 18
            };
            Label labelCharacter = new Label
            {
                Margin     = new Thickness(-20, 30, 0, 0),
                Text       = p.productCharacter,
                TextColor  = Color.FromHex("#8B8B8B"),
                FontSize   = 13,
                FontFamily = "Ubuntu-Light.ttf#Ubuntu"
            };
            Label labelCol = new Label
            {
                Text       = p.basketAmount.ToString(),
                Margin     = new Thickness(-3, 16, 0, 0),
                TextColor  = Color.Black,
                FontFamily = "Ubuntu-Bold.ttf#Ubuntu",
                FontSize   = 17
            };
            Label labelPrice = new Label
            {
                Text       = p.productPrice.ToString() + " р.",
                Margin     = new Thickness(0, 16, 0, 0),
                TextColor  = Color.Black,
                FontFamily = "Ubuntu-Bold.ttf#Ubuntu",
                FontSize   = 17
            };
            Image imageMin = new Image
            {
                Source        = "minus.png",
                HeightRequest = 45,
                WidthRequest  = 45
            };
            Image imagePlus = new Image
            {
                Source        = "plus.png",
                HeightRequest = 45,
                WidthRequest  = 45,
                Margin        = new Thickness(-3, 0, 0, 0)
            };

            Grid grid = new Grid
            {
                Padding = 0,
                Margin  = new Thickness(15, 15, 0, 0)
            };

            Int32 productPrice = new Int32();

            productPrice = p.productPrice * Int32.Parse(labelCol.Text);
            Int32 productId = new Int32();

            productId = p.productId;

            labelPrice.Text = productPrice.ToString() + " р.";

            int price = Int32.Parse(labelPrice.Text.Replace("р.", " "));

            sumlist.Add(price);

            int priceCheck = 0;

            foreach (Int32 sum in sumlist)
            {
                priceCheck = priceCheck + sum;
            }

            buttonText = $"{priceCheck}";

            prCheck = priceCheck;

            var TapGestureRecognizer = new TapGestureRecognizer();

            TapGestureRecognizer.Tapped += (object sender, EventArgs e) =>
            {
                if (Int32.Parse(labelCol.Text) != 0)
                {
                    Vibration.Vibrate(TimeSpan.FromMilliseconds(2));
                    labelPrice.Text = Convert.ToString(Int32.Parse(labelPrice.Text.Replace("р.", " ")) - productPrice) + " р.";
                    labelCol.Text   = Convert.ToString(Int32.Parse(labelCol.Text) - 1);

                    if (labelCol.Text == "0")
                    {
                        list.Remove(grid);
                        DbWorking.DeleteBasketIndex(labelName.Text);
                        Application.Current.MainPage = new UserMenu(3);
                    }
                    else
                    {
                        DbWorking.ManipulationBasket(productId, 0);
                        Application.Current.MainPage = new UserMenu(3);
                    }
                }
            };

            imageMin.GestureRecognizers.Add(TapGestureRecognizer);

            var TapGestureRecognizer_1 = new TapGestureRecognizer();

            TapGestureRecognizer_1.Tapped += (object sender, EventArgs e) =>
            {
                Vibration.Vibrate(TimeSpan.FromMilliseconds(2));
                labelPrice.Text = Convert.ToString(Int32.Parse(labelPrice.Text.Replace("р.", " ")) + productPrice) + " р.";
                labelCol.Text   = Convert.ToString(Int32.Parse(labelCol.Text) + 1);

                DbWorking.ManipulationBasket(productId, 1);
                Application.Current.MainPage = new UserMenu(3);
            };
            imagePlus.GestureRecognizers.Add(TapGestureRecognizer_1);


            grid.Children.Add(image, 0, 0);
            grid.Children.Add(labelName, 1, 0);
            grid.Children.Add(labelCharacter, 1, 0);
            grid.Children.Add(new StackLayout
            {
                Orientation = StackOrientation.Horizontal,
                Padding     = 0,
                Margin      = new Thickness(-28, 55, 0, 0),
                Spacing     = 0,

                Children =
                {
                    imageMin,
                    labelCol,
                    imagePlus,
                    labelPrice
                }
            }, 1, 0);

            list.Add(grid);
        }
Beispiel #24
0
        public static void CreateForm(Order usOrder)
        {
            Picker picker = new Picker
            {
                TitleColor = Color.LightGray,
                TextColor  = Color.Black,
                FontFamily = "Ubuntu-Regular.ttf#Ubuntu",
                FontSize   = 14,
                Items      =
                {
                    "Новый", "Принят", "Доставлен", "Отмена"
                },
                Margin = new Thickness(20, -11, 0, 0)
            };

            /////////////////////////
            Button button = new Button
            {
                Text            = "Нажми",
                FontFamily      = "Ubuntu-Light.ttf#Ubuntu",
                FontSize        = 14,
                TextColor       = Color.Black,
                BackgroundColor = Color.FromHex("#0000ffff"),
                Padding         = new Thickness(0),
                TextTransform   = TextTransform.None,
                Margin          = new Thickness(-18, -26, 0, -15)
            };
            string txt = $"{usOrder.products}";

            button.Clicked += async(object sender, EventArgs e) =>
            {
                await App.Current.MainPage.DisplayAlert("Заказ", txt, "ОK");
            };
            //////////////////////

            StackLayout stackLayout = new StackLayout
            {
                Orientation       = StackOrientation.Horizontal,
                HorizontalOptions = LayoutOptions.Start,
                Margin            = new Thickness(10, 5, 10, -5),
                Children          =
                {
                    new Label
                    {
                        Text       = usOrder.date.ToShortDateString() + " " + usOrder.date.ToShortTimeString(),
                        FontFamily = "Ubuntu-Light.ttf#Ubuntu", FontSize = 14, TextColor = Color.Black
                    },
                    new Label
                    {
                        Text   = usOrder.firstName, FontFamily = "Ubuntu-Light.ttf#Ubuntu", FontSize = 14, TextColor = Color.Black,
                        Margin = new Thickness(10, 0, 15, 0)
                    },
                    new Label
                    {
                        Text   = usOrder.phone, FontFamily = "Ubuntu-Light.ttf#Ubuntu", FontSize = 14, TextColor = Color.Black,
                        Margin = new Thickness(0, 0, 10, 0)
                    },
                    button,
                    new Label
                    {
                        Text   = usOrder.total.ToString() + "р.", FontFamily = "Ubuntu-Light.ttf#Ubuntu", FontSize = 14, TextColor = Color.Black,
                        Margin = new Thickness(10, 0, 0, 0)
                    },
                    picker
                }
            };

            picker.Title = usOrder.status;
            pickerColor(picker.Title, picker);
            string telephone = usOrder.phone;
            int    id        = usOrder.id;

            picker.SelectedIndexChanged += (object sender, EventArgs e) =>
            {
                string status = picker.Items[picker.SelectedIndex];
                DbWorking.UpdateOrder(status, telephone, id);
                pickerColor(status, picker);
            };

            picker.Focused += (object sender, FocusEventArgs e) =>
            {
                picker.TextColor  = Color.LightSkyBlue;
                picker.TitleColor = Color.LightSkyBlue;
            };
            picker.Unfocused += (object sender, FocusEventArgs e) =>
            {
                if (picker.SelectedIndex == -1)
                {
                    pickerColor(picker.Title, picker);
                }
                else
                {
                    pickerColor(picker.Items[picker.SelectedIndex], picker);
                }
            };
            stacks.Add(stackLayout);
        }
Beispiel #25
0
 public SettingsController(DbWorking dbWorking)
 {
     _dbWorking = dbWorking;
 }
Beispiel #26
0
 public PresentationController(DbWorking dbWorking)
 {
     _dbWorking = dbWorking;
 }
Beispiel #27
0
 private void Button_Clicked(object sender, EventArgs e)
 {
     Vibration.Vibrate(TimeSpan.FromSeconds(0.03));
     DbWorking.UpdateToIO(0, string.Empty);
     Application.Current.MainPage = new SplashPage();
 }