Пример #1
0
        public void ShowCategories()
        {
            Size EmptySize    = new Size(0, 0);
            Size catPanelSize = new Size(228, 136);
            Size picBoxSize   = new Size(228, 79);
            Size catNameSize  = new Size(82, 25);
            Size catAmmSize   = new Size(57, 17);

            Point emptyLoc   = new Point(0, 0);
            Point catNameLoc = new Point(85, 93);
            Point catAmmLoc  = new Point(168, 115);

            Font DefaultFont = new Font("Nirmala UI", 14, FontStyle.Bold);
            Font catAmmFont  = new Font("Nirmala UI", 10, FontStyle.Regular);

            List <string> catList = GetCategories(Forms.Authentication.LoginForm.VendorDetails.VendorID.ToString());


            //AddCategory.Click += new EventHandler(OpenAddCat);
            AddCategory.MouseMove += new MouseEventHandler(CursorChangeArgs);
            Panel AddCatPanel = AddCategory;

            flowLayoutPanel1.Controls.Clear();
            foreach (string category in catList)
            {
                string orderStatus = $"16 Items:"; //hard Coded right now change later

                Panel      catPanel = GenControls.AddPanel(category, Color.White, catPanelSize);
                PictureBox catImage = GenControls.AddPictureBox(category, emptyLoc, picBoxSize);

                //catImage.ImageLocation = ImageHandler.GetImage(ImageTypes.Avatar, )
                catImage.SizeMode = PictureBoxSizeMode.CenterImage;
                catImage.Name     = category + "picBox";
                Label catTitleLabel  = GenControls.AddLabel(category, category, catNameLoc, DefaultFont, Color.Black, Color.Transparent, EmptySize, true);
                Label catAmountLabel = GenControls.AddLabel(category, orderStatus, catAmmLoc, catAmmFont, Color.Black, Color.Transparent, EmptySize, true);
                //Label orderPriceLabel = GenControls.AddLabel(PriceText + "Rating", PriceText, PriceLoc, DefaultFont, Color.Black, Color.Transparent, EmptySize, true);
                //Label orderStatusLabel = GenControls.AddLabel(orderStatus + "Rating", orderStatus, StatusLoc, DefaultFont, Color.Black, Color.Transparent, StatusSize, false);

                Control[] controlArray = new Control[] { catImage, catTitleLabel, catAmountLabel };

                foreach (Control curControl in controlArray)
                {
                    //Add Event Handlers Below
                    curControl.Click     += new EventHandler(OpenOrder);
                    curControl.MouseMove += new MouseEventHandler(CursorChangeArgs);
                    catPanel.Controls.Add(curControl);
                    curControl.Tag = category;
                }

                flowLayoutPanel1.Controls.Add(catPanel);
                flowLayoutPanel1.Controls.Add(AddCatPanel);

                flowLayoutPanel1.Click     += new EventHandler(OpenOrder);
                flowLayoutPanel1.MouseMove += new MouseEventHandler(CursorChangeArgs);
                flowLayoutPanel1.Tag        = category;
            }
        }
Пример #2
0
        public void GenerateControls()
        {
            #region Initializing Variables

            Size EmptySize      = new Size(0, 0);
            Size orderPanelSize = new Size(660, 94);
            Size StatusSize     = new Size(300, 21);

            Point VendorLoc        = new Point(264, 10);
            Point DeliveryStartLoc = new Point(41, 49);
            Point DeliveryEndLoc   = new Point(334, 49);



            Font DefaultFont = new Font("Nirmala UI", 12, FontStyle.Regular);
            Font TextFont    = new Font("Nirmala UI", 14, FontStyle.Regular);

            #endregion Initializing Variables

            List <OrderInfo> OIList = GetOrders();

            if (OIList.Count == 0)
            {
                return;
            }

            foreach (OrderInfo Order in OIList)
            {
                string VendorStr        = $"Vendor: {Order.VendorName}";
                string DeliveryStartStr = $"Date Purchased: {Order.StartPurchase}";
                string DeliveryEndStr   = $"Date Delivered: {Order.EndPurchase}";

                string PanelName = "ObjPanelName";

                Panel vendorPanelObject = GenControls.AddPanel(PanelName, Color.White, orderPanelSize);

                Label VendorTitleLabel   = GenControls.AddLabel(VendorStr, VendorStr, VendorLoc, TextFont, Color.Black, Color.Transparent, StatusSize, false);
                Label DeliveryStartLabel = GenControls.AddLabel(DeliveryStartStr, DeliveryStartStr, DeliveryStartLoc, TextFont, Color.Black, Color.Transparent, StatusSize, false);
                Label DeliveryEndLabel   = GenControls.AddLabel(DeliveryEndStr, DeliveryEndStr, DeliveryEndLoc, TextFont, Color.Black, Color.Transparent, StatusSize, false);

                Control[] controlArray = new Control[] { VendorTitleLabel, DeliveryStartLabel, DeliveryEndLabel };

                foreach (Control curControl in controlArray)
                {
                    //Add Event Handlers Below
                    curControl.Click     += new EventHandler(OpenOrder);
                    curControl.MouseMove += new MouseEventHandler(CursorChangeArgs);
                    vendorPanelObject.Controls.Add(curControl);
                    curControl.Tag = Order.OrderID.ToString();
                }

                OrderFlowPanel.Controls.Add(vendorPanelObject);
                vendorPanelObject.Click     += new EventHandler(OpenOrder);
                vendorPanelObject.MouseMove += new MouseEventHandler(CursorChangeArgs);
                vendorPanelObject.Tag        = Order.OrderID.ToString();
            }
        }
Пример #3
0
        public void ShowItems()
        {
            Size EmptySize    = new Size(0, 0);
            Size catPanelSize = new Size(228, 136);
            Size picBoxSize   = new Size(228, 79);
            Size catNameSize  = new Size(82, 25);
            Size catAmmSize   = new Size(57, 17);

            Point emptyLoc    = new Point(0, 0);
            Point ItemNameLoc = new Point(85, 93);
            Point catAmmLoc   = new Point(155, 110);

            Font DefaultFont = new Font("Nirmala UI", 11, FontStyle.Bold);
            Font catAmmFont  = new Font("Nirmala UI", 10, FontStyle.Regular);

            DataTable ItemsList = GetItems(Forms.Authentication.LoginForm.VendorDetails.VendorID.ToString());

            EditCategory.Click     += new EventHandler(OpenEditorCat);
            EditCategory.MouseMove += new MouseEventHandler(CursorChangeArgs);

            Panel EditCategoryPanel = EditCategory;

            flowLayoutPanel1.Controls.Clear();

            foreach (DataRow Item in ItemsList.Rows)
            {
                string     orderStatus = $"16 Items:"; //hard Coded right now change later
                string     ItemName    = Item[2].ToString();
                string     ItemPrice   = "£" + Item[5].ToString();
                string     ItemID      = Item[0].ToString();
                string     imageLoc    = Item[4].ToString();
                Panel      catPanel    = GenControls.AddPanel(ItemName, Color.White, catPanelSize);
                PictureBox catImage    = GenControls.AddPictureBox(ItemID, emptyLoc, picBoxSize);
                catImage.ImageLocation = ImageHandler.GetImage(ImageTypes.Avatar, imageLoc);

                catImage.SizeMode = PictureBoxSizeMode.CenterImage;

                Label ItemNameLabel  = GenControls.AddLabel(ItemID, ItemName, ItemNameLoc, DefaultFont, Color.Black, Color.Transparent, EmptySize, true);
                Label ItemPriceLabel = GenControls.AddLabel(ItemID, ItemPrice, catAmmLoc, catAmmFont, Color.Black, Color.Transparent, EmptySize, true);

                Control[] controlArray = new Control[] { catImage, ItemNameLabel, ItemPriceLabel };

                foreach (Control curControl in controlArray)
                {
                    //Add Event Handlers Below
                    curControl.Click     += new EventHandler(OpenEditor);
                    curControl.MouseMove += new MouseEventHandler(CursorChangeArgs);
                    catPanel.Controls.Add(curControl);
                    curControl.Tag = (string)ItemID; //Store the ItemID so it can be referenced later on
                }
                catPanel.Tag = (string)ItemID;
                flowLayoutPanel1.Controls.Add(catPanel);
                flowLayoutPanel1.Controls.Add(EditCategoryPanel);
            }
        }
Пример #4
0
        public void GeneratControls(string vendorID)
        {
            #region Initializing Variables

            Size EmptySize = new Size(0, 0);


            Size  panelSize        = new Size(638, 100);
            Point DeliveryStartLoc = new Point(41, 49);
            Point DeliveryEndLoc   = new Point(334, 49);

            Point statisLoc  = new Point(14, 9);
            Point nameLoc    = new Point(285, 9);
            Point ratingLoc  = new Point(532, 9);
            Point messageLoc = new Point(249, 39);
            Point dateLoc    = new Point(14, 70);

            Font DefaultFont = new Font("Nirmala UI", 12, FontStyle.Regular);
            Font TextFont    = new Font("Nirmala UI", 12, FontStyle.Regular);

            #endregion Initializing Variables

            DataTable dt = Server.ReviewHandler.GetReviews(vendorID);

            foreach (DataRow review in dt.Rows)
            {
                string name          = review[5].ToString() + " " + review[6].ToString();
                string rating        = "Rating " + review[4].ToString();
                string reviewMessage = review[3].ToString();
                string date          = "Date: " + review[2].ToString();
                string status        = "Status: " + review[0].ToString();

                string PanelName = "ObjPanelName";

                Panel vendorPanelObject = GenControls.AddPanel(PanelName, Color.White, panelSize);

                Label NameLabel   = GenControls.AddLabel(name, name, nameLoc, TextFont, Color.Black, Color.Transparent, EmptySize, true);
                Label RatingLabel = GenControls.AddLabel(rating, rating, ratingLoc, TextFont, Color.Black, Color.Transparent, EmptySize, true);
                Label ReviewLabel = GenControls.AddLabel("reviewMsg", reviewMessage, messageLoc, TextFont, Color.Black, Color.Transparent, EmptySize, true);
                Label DateLabel   = GenControls.AddLabel(date, date, dateLoc, TextFont, Color.Black, Color.Transparent, EmptySize, true);
                Label StatusLabel = GenControls.AddLabel(status, status, statisLoc, TextFont, Color.Black, Color.Transparent, EmptySize, true);

                Control[] controlArray = new Control[] { NameLabel, RatingLabel, ReviewLabel, DateLabel, StatusLabel };

                foreach (Control curControl in controlArray)
                {
                    vendorPanelObject.Controls.Add(curControl);
                }

                reviewFlowPanel.Controls.Add(vendorPanelObject);
                //decimal val = decimal.Round(Server.ReviewHandler.CalculateRating(vendorIDLabel.Text), 2, MidpointRounding.AwayFromZero);
                //TotalRatingLabel.Text = $"Rating:  {val.ToString()}";
            }
        }
Пример #5
0
        private void MasterGenerator()
        {
            string vendorID, vendorName, vendorDescription, vendorPostcode, vendorRating, imageLoc;

            string SQLQuery = "SELECT * FROM vendors";

            using (DataTable DataResults = FeedMeLogic.Data.DAL.ExecCommand(SQLQuery))
            {
                int vendorAmount = DataResults.Rows.Count;
                VendorAmountLabel.Text = string.Format("There are currently {0} restraunts/food places near you", vendorAmount.ToString()); //Updates Text to Match No of Vendors

                #region Initiaizling Location & Size For Controls

                //Initializing Height & Location Variables (Information from Design Version)
                Size vendorPanelSize = new Size(711, 96);
                Size TitleSize       = new Size(142, 30);
                Size DescSize        = new Size(556, 47);
                Size RatingSize      = new Size(80, 21);
                Size PostcodeSize    = new Size(84, 21);
                Size PictureBoxSize  = new Size(127, 86);

                Point TitleLoc      = new Point(344, 5);
                Point DescLoc       = new Point(146, 36);
                Point RatingLoc     = new Point(485, 5);
                Point PostcodeLoc   = new Point(567, 5);
                Point PictureBoxLoc = new Point(4, 5);

                Font DefaultFont = new Font("Nirmala UI", 12, FontStyle.Regular);
                Font TitleFont   = new Font("Nirmala UI", 14, FontStyle.Bold);

                #endregion Initiaizling Location & Size For Controls

                //string DefaultFnt = "Nirmala UI";

                int maxGen = vendorAmount;
                #region Iterating Through Each Vendor

                for (int i = 0; i < maxGen; i++)
                {
                    #region Getting Variables

                    vendorID          = DataResults.Rows[i][0].ToString();
                    vendorName        = DataResults.Rows[i][1].ToString();
                    vendorDescription = DataResults.Rows[i][2].ToString();
                    vendorPostcode    = ("(" + DataResults.Rows[i][4].ToString() + ")");
                    //vendorRating = DataResults.Rows[i][6].ToString();
                    vendorRating = "⭐⭐⭐⭐⭐";
                    imageLoc     = ImageHandler.GetImage(ImageTypes.Avatar, DataResults.Rows[i][10].ToString());

                    #endregion Getting Variables

                    #region Creating & Adding Event Handlers To Each Control

                    Panel vendorPanelObject = GenControls.AddPanel(vendorName, Color.White, vendorPanelSize);

                    Label vendorTitleLabel = GenControls.AddLabel(vendorName, vendorName, TitleLoc, TitleFont, Color.Black, Color.Transparent, TitleSize, true);
                    Label vendorDescLabel  = GenControls.AddLabel(vendorName + "Desc", vendorDescription, DescLoc, DefaultFont, Color.Black, Color.Transparent, DescSize, false);

                    RatingLoc = new Point(vendorTitleLabel.Location.X + vendorTitleLabel.Width - 15, vendorTitleLabel.Location.Y);
                    Label vendorRatingLabel = GenControls.AddLabel(vendorName + "Rating", vendorRating, RatingLoc, DefaultFont, Color.Black, Color.Transparent, RatingSize, true);

                    PostcodeLoc = new Point(vendorRatingLabel.Location.X + vendorRatingLabel.Width - 15, vendorRatingLabel.Location.Y);
                    Label vendorPostcodeLabel = GenControls.AddLabel(vendorName + "PostCode", vendorPostcode, PostcodeLoc, DefaultFont, Color.LightGray, Color.Transparent, PostcodeSize, true);

                    PictureBox vendorPictureBox = GenControls.AddPictureBox(vendorName, PictureBoxLoc, PictureBoxSize);
                    vendorPictureBox.ImageLocation = imageLoc;

                    Control[] controlArray = new Control[] { vendorTitleLabel, vendorDescLabel, vendorRatingLabel, vendorPostcodeLabel, vendorPictureBox };

                    foreach (Control curControl in controlArray)
                    {
                        //Add Event Handlers Below
                        curControl.Click     += new EventHandler(OpenVendor);
                        curControl.MouseMove += new MouseEventHandler(CursorChangeArgs);
                        vendorPanelObject.Controls.Add(curControl);
                    }

                    VendorsFlowPanel.Controls.Add(vendorPanelObject);
                    vendorPanelObject.Click     += new EventHandler(OpenVendor);
                    vendorPanelObject.MouseMove += new MouseEventHandler(CursorChangeArgs);

                    #endregion Creating & Adding Event Handlers To Each Control
                }

                #endregion Iterating Through Each Vendor
            }
        }
Пример #6
0
        private void GenerateItems(int vendorID, string itemType)
        {
            #region Initiaizling Variables & DataTable

            int    ItemAmount;
            string ItemID, ItemType, ItemName, ItemDescription, ItemPrice, imageLoc;

            string SQLCommand = ($"SELECT * FROM items WHERE vendorID = {vendorID} AND Category = '{itemType}'");

            DataTable ItemResults = DAL.ExecCommand(SQLCommand);
            ItemAmount = ItemResults.Rows.Count;

            #endregion Initiaizling Variables & DataTable

            #region Initiaizling Common Variables for Dynamic Controls

            //Size & Location Variables
            Size EmptySize   = new Size(0, 0);
            Size PanelSize   = new Size(678, 133);
            Size DescSize    = new Size(434, 78);
            Size PicBoxSize  = new Size(124, 97);
            Size ButtonSize  = new Size(25, 31);
            Size TextBoxSize = new Size(29, 22);

            Point EmptyLoc      = new Point(0, 0);
            Point TitleLoc      = new Point(278, 10);
            Point DescLoc       = new Point(141, 41);
            Point PriceLoc      = new Point(594, 22);
            Point PicBoxLoc     = new Point(6, 22);
            Point RemoveItemLoc = new Point(584, 53);
            Point ItemAmountLoc = new Point(609, 55);
            Point AddItemLoc    = new Point(639, 53);

            Font TitleFont  = new Font("Nirmala UI", 12, FontStyle.Regular);
            Font ButtonFont = new Font("Nirmala UI", 12, FontStyle.Bold);
            Font PriceFont  = new Font("Nirmala UI", 14, FontStyle.Regular);

            Color BlackColour       = Color.Black;
            Color WhiteColour       = Color.White;
            Color TransparentColour = Color.Transparent;
            Color DimGrayColour     = Color.DimGray;

            #endregion Initiaizling Common Variables for Dynamic Controls

            #region Iterating Through DataTable

            //Getting Data From Table & Creating Controls
            foreach (DataRow Item in ItemResults.Rows)
            {
                #region Getting Item Information

                ItemID          = Item[0].ToString();
                ItemName        = Item[2].ToString();
                ItemType        = Item[3].ToString();
                ItemDescription = Item[4].ToString();
                ItemPrice       = Item[5].ToString();
                imageLoc        = Item[6].ToString();

                #endregion Getting Item Information

                #region Creating Dynamic Item Controls

                Panel ItemPanel = GenControls.AddPanel(ItemName, Color.White, PanelSize);

                Label      TitleLabel     = GenControls.AddLabel(ItemName + "Title", ItemName, TitleLoc, TitleFont, BlackColour, TransparentColour, EmptySize, true);
                Label      DescLabel      = GenControls.AddLabel(ItemName + "Desc", ItemDescription, DescLoc, TitleFont, Color.DarkGray, TransparentColour, DescSize, false);
                Label      PriceLabel     = GenControls.AddLabel(ItemName + "Price", "£" + ItemPrice, PriceLoc, PriceFont, Color.Maroon, Color.Transparent, EmptySize, true);
                Button     RemoveButton   = GenControls.AddButton(ItemName + "Remove", "-", RemoveItemLoc, ButtonFont, DimGrayColour, WhiteColour, ButtonSize, false);
                TextBox    ItemAmountTBox = GenControls.AddTextBox(ItemName, "0", ItemID, ItemAmountLoc, TitleFont, BlackColour, WhiteColour, TextBoxSize);
                Button     AddButton      = GenControls.AddButton(ItemName + "Add", "+", AddItemLoc, ButtonFont, DimGrayColour, WhiteColour, ButtonSize, false);
                PictureBox ItemPictureBox = GenControls.AddPictureBox(ItemName, PicBoxLoc, PicBoxSize);

                ItemPictureBox.ImageLocation = ImageHandler.GetImage(ImageTypes.Item, imageLoc);

                #endregion Creating Dynamic Item Controls

                #region Adding to Form & Setting Event Handlers

                Control[] PanelControls = new Control[] { TitleLabel, DescLabel, PriceLabel, RemoveButton, ItemAmountTBox, AddButton, ItemPictureBox };

                foreach (Control CurrentItemControl in PanelControls)
                {
                    ItemPanel.Controls.Add(CurrentItemControl);
                }

                RemoveButton.Click         += new EventHandler(ItemDecreased);
                AddButton.Click            += new EventHandler(ItemIncreased);
                ItemAmountTBox.TextChanged += new EventHandler(ItemAmountChanged);
                ItemsFlowPanel.Controls.Add(ItemPanel);

                #endregion Adding to Form & Setting Event Handlers
            }

            #endregion Iterating Through DataTable
        }
Пример #7
0
        public void GenerateControls(string status)
        {
            #region Initializing Variables

            Size EmptySize       = new Size(0, 0);
            Size vendorPanelSize = new Size(219, 135);
            Size StatusSize      = new Size(134, 21);

            Point OrderLoc    = new Point(65, 10);
            Point CustomerLoc = new Point(55, 37);
            Point PriceLoc    = new Point(55, 65);
            Point StatusLoc   = new Point(40, 89);

            Font DefaultFont = new Font("Nirmala UI", 12, FontStyle.Regular);
            Font OrderFont   = new Font("Nirmala UI", 14, FontStyle.Bold);

            #endregion Initializing Variables

            List <OrderInfo> OIList = GetUpdates(status);

            if (OIList.Count == 0)
            {
                return;
            }

            foreach (OrderInfo Order in OIList)
            {
                string orderText    = "Order";
                string customerName = $"Customer: {Order.CustomerName}";
                string PriceText    = $"Price: {Order.TotalPrice.ToString()}";
                string orderStatus  = $"Status: {status}";

                Panel vendorPanelObject = GenControls.AddPanel(orderText, Color.White, vendorPanelSize);

                Label orderTitleLabel  = GenControls.AddLabel(orderText, orderText, OrderLoc, OrderFont, Color.Black, Color.Transparent, EmptySize, true);
                Label orderCustLabel   = GenControls.AddLabel(customerName, customerName, CustomerLoc, DefaultFont, Color.Black, Color.Transparent, EmptySize, true);
                Label orderPriceLabel  = GenControls.AddLabel(PriceText + "Rating", PriceText, PriceLoc, DefaultFont, Color.Black, Color.Transparent, EmptySize, true);
                Label orderStatusLabel = GenControls.AddLabel(orderStatus + "Rating", orderStatus, StatusLoc, DefaultFont, Color.Black, Color.Transparent, StatusSize, false);

                Control[] controlArray = new Control[] { orderTitleLabel, orderCustLabel, orderPriceLabel, orderStatusLabel };

                if (status == "processing")
                {
                    OrdersFlowPanel.Controls.Clear();
                }
                else if (status == "Cooking")
                {
                    CookingFlowPanel.Controls.Clear();
                }
                else if (status == "Delivering")
                {
                    DeliveryFlowPanel.Controls.Clear();
                }

                foreach (Control curControl in controlArray)
                {
                    //Add Event Handlers Below
                    curControl.Click     += new EventHandler(OpenOrder);
                    curControl.MouseMove += new MouseEventHandler(CursorChangeArgs);
                    vendorPanelObject.Controls.Add(curControl);
                    curControl.Tag = Order.OrderID.ToString();
                }

                if (status == "processing")
                {
                    OrdersFlowPanel.Controls.Add(vendorPanelObject);
                }
                else if (status == "Cooking")
                {
                    CookingFlowPanel.Controls.Add(vendorPanelObject);
                }
                else if (status == "Delivering")
                {
                    DeliveryFlowPanel.Controls.Add(vendorPanelObject);
                }

                vendorPanelObject.Click     += new EventHandler(OpenOrder);
                vendorPanelObject.MouseMove += new MouseEventHandler(CursorChangeArgs);
                vendorPanelObject.Tag        = Order.OrderID.ToString();
                //GenerateControls();
            }
        }