示例#1
0
        /// <summary>
        /// This function includes Admin button click operation.
        /// This function used to show new the admin screen .
        /// </summary>
        /// <returns> This function does not return a value </returns>
        private void btnAdmin_Click(object sender, EventArgs e)
        {
            Logger.GetLogger().WriteLog(LoginedCustomer.getInstance().User.Username, btnAdmin.Text, DateTime.Now);
            AdminScreen adminScreen = new AdminScreen();

            adminScreen.Show();
        }
示例#2
0
        /// <summary>
        /// This function add book button click operation.
        /// This function is used to add product list and save for util function.
        /// </summary>
        /// <returns> This function does not return a value  </returns>
        private void btnAdd_Click(object sender, EventArgs e)
        {
            Logger.GetLogger().WriteLog(LoginedCustomer.getInstance().User.Username, btnAdd.Text, DateTime.Now);
            if (!isBlank())
            {
                MessageBox.Show("Please fill all blanks!");
                return;
            }
            else if (pboxBook.Image == null)
            {
                MessageBox.Show("Please select an image.");
                return;
            }
            else if (isExist())
            {
                MessageBox.Show("Please change product ID! It's already taken.");
                return;
            }
            NumberFormatInfo provider = new NumberFormatInfo();

            provider.NumberDecimalSeparator = ".";
            Creator c = new BookFactory(txtName.Text, txtID.Text, Convert.ToDouble(txtPrice.Text, provider), txtISBN.Text, txtAuthor.Text,
                                        txtPublisher.Text, Convert.ToInt32(txtPages.Text), pboxBook.Image);

            string[]     lvItem = { txtID.Text, txtName.Text, txtPrice.Text, txtISBN.Text, txtAuthor.Text, txtPublisher.Text, txtPages.Text };
            ListViewItem item   = new ListViewItem(lvItem);

            listViewBooks.Items.Add(item);
            StoreMainScreen.productList.Add(c.FactoryMethod());
            UtilSave.Save(c.FactoryMethod());
            MessageBox.Show("Added succesfully!");
            listViewBooks.Refresh();
            panelAddBook.Visible = false;
        }
示例#3
0
 /// <summary>
 /// This function delete book button click operation.
 /// This function is used to remove product list and delete for util function.
 /// </summary>
 /// <returns> This function does not return a value  </returns>
 private void btnDelete_Click(object sender, EventArgs e)
 {
     Logger.GetLogger().WriteLog(LoginedCustomer.getInstance().User.Username, btnDelete.Text, DateTime.Now);
     if (selectedIndex == -1)
     {
         MessageBox.Show("Please select a book from list!");
         return;
     }
     selectedID = listViewBooks.Items[selectedIndex].SubItems[0].Text;
     for (int i = 0; i < listViewBooks.Items.Count; i++)
     {
         if (listViewBooks.Items[i].SubItems[0].Text == selectedID)
         {
             listViewBooks.Items.RemoveAt(i);
             break;
         }
     }
     for (int i = 0; i < StoreMainScreen.productList.Count; i++)
     {
         if (StoreMainScreen.productList[i].ID1 == selectedID)
         {
             UtilUpdate.Delete(StoreMainScreen.productList[i]);
             StoreMainScreen.productList.RemoveAt(i);
             break;
         }
     }
     MessageBox.Show("Deleted Succesfully!");
     selectedIndex = -1;
 }
        /// <summary>
        /// This function login button click operation.
        /// This function is used to login application.
        /// </summary>
        /// <returns> This function does not return a value  </returns>
        private void btnLogin_Click(object sender, EventArgs e)
        {
            Logger.GetLogger().WriteLog(loginUsername.GetSetText, btnLogin.Text, DateTime.Now);
            if (loginUsername.GetSetText == "" || loginPassword.GetSetText == "")
            {
                MessageBox.Show("Please fill all blanks.");
                return;
            }
            string username = loginUsername.GetSetText;
            string password = loginPassword.GetSetText;
            int    i        = 0;

            foreach (Customer customer in OceanBookStore.customerList)
            {
                if (customer.IsValid(username, password))
                {
                    shoppingCardIndex = i;
                    LoginedCustomer.getInstance().User = customer;
                    MessageBox.Show("Succesful Login!");
                    this.Parent.Parent.Hide();
                    StoreMainScreen.storeMainScreen.ShowDialog();
                    return;
                }
                i++;
            }
            MessageBox.Show("Username or password is wrong.");
            loginUsername.GetSetText = "";
            loginPassword.GetSetText = "";
        }
示例#5
0
 /// <summary>
 /// This function update selected book button click operation.
 /// This function is used to changed enabled.
 /// </summary>
 /// <returns> This function does not return a value  </returns>
 private void btnUpdateSelected_Click(object sender, EventArgs e)
 {
     Logger.GetLogger().WriteLog(LoginedCustomer.getInstance().User.Username, btnUpdateSelected.Text, DateTime.Now);
     if (selectedIndex == -1)
     {
         MessageBox.Show("Please select a book from list!");
         return;
     }
     panelAddBook.Visible = true;
     selectedID           = listViewBooks.Items[selectedIndex].SubItems[0].Text;
     foreach (Product product in StoreMainScreen.productList)
     {
         if (product.ID1 == selectedID)
         {
             Book book = (Book)product;
             pboxBook.Image    = book.Image;
             txtName.Text      = book.Name;
             txtID.Text        = book.ID1;
             txtPrice.Text     = book.Price.ToString();
             txtISBN.Text      = book.ISBN1;
             txtAuthor.Text    = book.Author;
             txtPublisher.Text = book.Publisher;
             txtPages.Text     = book.Pages.ToString();
         }
     }
     btnAdd.Visible    = false;
     btnUpdate.Visible = true;
     txtID.Enabled     = false;
 }
        /// <summary>
        /// This function includes checkout button click operation.
        /// This function used to hide the shopping card form and show the invoice screen.
        /// </summary>
        /// <returns> This function does not return a value </returns>
        private void btnCheckout_Click(object sender, EventArgs e)
        {
            Logger.GetLogger().WriteLog(LoginedCustomer.getInstance().User.Username, btnCheckout.Text, DateTime.Now);
            StoreMainScreen.ShoppingCardForm.Hide();
            Invoice invoiceScreen = new Invoice();

            invoiceScreen.Show();
        }
示例#7
0
        /// <summary>
        /// This function includes log out button click operation.
        /// This function used to login the application again.
        /// </summary>
        /// <returns> This function does not return a value </returns>
        private void btnLogOut_Click(object sender, EventArgs e)
        {
            Logger.GetLogger().WriteLog(LoginedCustomer.getInstance().User.Username, btnLogOut.Text, DateTime.Now);
            OceanBookStore oceanBookStore = new OceanBookStore();

            this.Hide();
            oceanBookStore.Show();
        }
        /// <summary>
        /// This function update music cd button click operation.
        /// This function is used to update product list and update for util function.
        /// </summary>
        /// <returns> This function does not return a value  </returns>
        private void btnUpdate_Click(object sender, EventArgs e)
        {
            Logger.GetLogger().WriteLog(LoginedCustomer.getInstance().User.Username, btnUpdate.Text, DateTime.Now);
            if (!isBlank())
            {
                MessageBox.Show("Please fill all blanks!");
                return;
            }
            else if (pboxMusicCD.Image == null)
            {
                MessageBox.Show("Please select an image.");
                return;
            }
            NumberFormatInfo provider = new NumberFormatInfo();

            provider.NumberDecimalSeparator = ".";
            MusicCD_Type type = MusicCD_Type.Romance;

            switch (cBoxType.SelectedIndex)
            {
            case 1:
                type = MusicCD_Type.HardRock;
                break;

            case 2:
                type = MusicCD_Type.Country;
                break;

            default:
                break;
            }
            Creator c = new MusicCdFactory(txtName.Text, txtID.Text, Convert.ToDouble(txtPrice.Text, provider),
                                           txtSinger.Text, type, pboxMusicCD.Image);

            string[]     lvItem = { txtID.Text, txtName.Text, txtPrice.Text, txtSinger.Text, cBoxType.Text };
            ListViewItem item   = new ListViewItem(lvItem);

            for (int i = 0; i < listViewMusicCDs.Items.Count; i++)
            {
                if (listViewMusicCDs.Items[i].SubItems[0].Text == selectedID)
                {
                    listViewMusicCDs.Items[i] = item;
                    break;
                }
            }
            for (int i = 0; i < StoreMainScreen.productList.Count; i++)
            {
                if (StoreMainScreen.productList[i].ID1 == selectedID)
                {
                    StoreMainScreen.productList[i] = c.FactoryMethod();
                    break;
                }
            }
            UtilUpdate.Update(c.FactoryMethod());
            MessageBox.Show("Updated Succesfully!");
            panelAddMusicCD.Visible = false;
            selectedIndex           = -1;
        }
示例#9
0
        /// <summary>
        /// This function add magazine button click operation.
        /// This function is used to add product list and save for util function.
        /// </summary>
        /// <returns> This function does not return a value  </returns>
        private void btnAdd_Click(object sender, EventArgs e)
        {
            Logger.GetLogger().WriteLog(LoginedCustomer.getInstance().User.Username, btnAdd.Text, DateTime.Now);
            if (!isBlank())
            {
                MessageBox.Show("Please fill all blanks!");
                return;
            }
            else if (pboxMagazine.Image == null)
            {
                MessageBox.Show("Please select an image.");
                return;
            }
            else if (isExist())
            {
                MessageBox.Show("Please change product ID! It's already taken.");
                return;
            }
            NumberFormatInfo provider = new NumberFormatInfo();

            provider.NumberDecimalSeparator = ".";
            Magazine_Type type = Magazine_Type.Actual;

            switch (cBoxType.SelectedIndex)
            {
            case 1:
                type = Magazine_Type.Computer;
                break;

            case 2:
                type = Magazine_Type.News;
                break;

            case 3:
                type = Magazine_Type.Sport;
                break;

            case 4:
                type = Magazine_Type.Technology;
                break;

            default:
                break;
            }
            Creator c = new MagazineFactory(txtName.Text, txtID.Text, Convert.ToDouble(txtPrice.Text, provider),
                                            txtIssue.Text, type, pboxMagazine.Image);

            string[]     lvItem = { txtID.Text, txtName.Text, txtPrice.Text, txtIssue.Text, cBoxType.Text };
            ListViewItem item   = new ListViewItem(lvItem);

            listViewMagazines.Items.Add(item);
            StoreMainScreen.productList.Add(c.FactoryMethod());
            UtilSave.Save(c.FactoryMethod());
            MessageBox.Show("Added succesfully!");
            listViewMagazines.Refresh();
            panelAddMagazine.Visible = false;
        }
示例#10
0
 /// <summary>
 /// This function includes Decrease button click operation and decrease the quantity.
 /// </summary>
 /// <returns> This function does not return a value </returns>
 private void btnDecrease_Click(object sender, EventArgs e)
 {
     Logger.GetLogger().WriteLog(LoginedCustomer.getInstance().User.Username, btnDecrease.Text, DateTime.Now);
     if (quantityBook == 1)
     {
         return;
     }
     quantityBook--;
     lblNumber.Text = quantityBook.ToString();
 }
示例#11
0
 /// <summary>
 /// This function includes My orders button click operation.
 /// This function used to changed the my orders screen visible and show this screen.
 /// </summary>
 /// <returns> This function does not return a value </returns>
 private void btnMyOrders_Click(object sender, EventArgs e)
 {
     Logger.GetLogger().WriteLog(LoginedCustomer.getInstance().User.Username, btnMyOrders.Text, DateTime.Now);
     if (myOrdersScreen.Visible == true)
     {
         return;
     }
     bookScreen.Hide();
     magazineScreen.Hide();
     musicScreen.Hide();
     myOrdersScreen.Show();
 }
 /// <summary>
 ///  This function is used to show the admin magazin screen and hide the order, book and music cd screen.
 /// </summary>
 /// <returns> This function does not return a value  </returns>
 private void btnMagazines_Click(object sender, EventArgs e)
 {
     Logger.GetLogger().WriteLog(LoginedCustomer.getInstance().User.Username, btnMagazines.Text, DateTime.Now);
     if (adminMagazineScreen.Visible == true)
     {
         return;
     }
     adminBookScreen.Hide();
     adminMagazineScreen.Show();
     adminMusicCDScreen.Hide();
     adminOrderScreen.Hide();
 }
 /// <summary>
 /// This function includes remove button click operation.
 /// This function used to deleted this product and updated shopping card.
 /// </summary>
 /// <returns> This function does not return a value  </returns>
 private void btnRemove_Click(object sender, EventArgs e)
 {
     Logger.GetLogger().WriteLog(LoginedCustomer.getInstance().User.Username, btnRemove.Text, DateTime.Now);
     for (int i = 0; i < StoreMainScreen.shoppingCards[LoginScreen.shoppingCardIndex].itemsToPurchase.Count; i++)
     {
         if (StoreMainScreen.shoppingCards[LoginScreen.shoppingCardIndex].itemsToPurchase[i].Product.Name == lblProductName.Text)
         {
             int index = i;
             UtilUpdate.Delete(StoreMainScreen.shoppingCards[LoginScreen.shoppingCardIndex], index);
             StoreMainScreen.shoppingCards[LoginScreen.shoppingCardIndex].RemoveProduct(StoreMainScreen.shoppingCards[LoginScreen.shoppingCardIndex].itemsToPurchase[i]);
         }
     }
 }
示例#14
0
 /// <summary>
 /// This function loads the MyOrders design.
 /// </summary>
 /// <returns> This function does not return a value </returns>
 private void MyOrders_Load(object sender, EventArgs e)
 {
     foreach (ShoppingCard card in StoreMainScreen.orderList)
     {
         if (card.CustomerID == LoginedCustomer.getInstance().User.CustomerId)
         {
             AdminOrderDesign design = new AdminOrderDesign(card);
             designs.Add(design);
             design.btnShow.Click += BtnShow_Click;
             flpOrders.Controls.Add(design);
         }
     }
 }
        /// <summary>
        /// This function includes cancel button click operation.
        /// This function used to called delete for util and cancel order for shopping shoppingCards function.
        /// </summary>
        /// <returns> This function does not return a value </returns>
        private void btnCancel_Click(object sender, EventArgs e)
        {
            Logger.GetLogger().WriteLog(LoginedCustomer.getInstance().User.Username, btnCancel.Text, DateTime.Now);
            DialogResult dr = MessageBox.Show("Your order will be canceled. Do you want to proceed?", "Info",
                                              MessageBoxButtons.OKCancel, MessageBoxIcon.Information);

            if (dr == DialogResult.OK)
            {
                UtilUpdate.Delete(StoreMainScreen.shoppingCards[LoginScreen.shoppingCardIndex]);
                StoreMainScreen.shoppingCards[LoginScreen.shoppingCardIndex].CancelOrder();
                flpShoppingList.Controls.Clear();
            }
        }
 /// <summary>
 /// This function add new music cd button click operation.
 /// This function is used to changed enabled.
 /// </summary>
 /// <returns> This function does not return a value  </returns>
 private void btnAddNewMusicCD_Click(object sender, EventArgs e)
 {
     Logger.GetLogger().WriteLog(LoginedCustomer.getInstance().User.Username, btnAddNewMusicCD.Text, DateTime.Now);
     panelAddMusicCD.Visible = true;
     pboxMusicCD.Image       = null;
     txtName.Text            = "";
     txtID.Text        = "";
     txtPrice.Text     = "";
     txtSinger.Text    = "";
     cBoxType.Text     = "";
     btnAdd.Visible    = true;
     btnUpdate.Visible = false;
     txtID.Enabled     = true;
 }
示例#17
0
        /// <summary>
        /// This function update selected magazine button click operation.
        /// This function is used to changed enabled.
        /// </summary>
        /// <returns> This function does not return a value  </returns>
        private void btnUpdateSelected_Click(object sender, EventArgs e)
        {
            Logger.GetLogger().WriteLog(LoginedCustomer.getInstance().User.Username, btnUpdateSelected.Text, DateTime.Now);
            if (selectedIndex == -1)
            {
                MessageBox.Show("Please select a book from list!");
                return;
            }
            panelAddMagazine.Visible = true;
            selectedID = listViewMagazines.Items[selectedIndex].SubItems[0].Text;
            foreach (Product product in StoreMainScreen.productList)
            {
                if (product.ID1 == selectedID)
                {
                    Magazine magazine = (Magazine)product;
                    pboxMagazine.Image = magazine.Image;
                    txtName.Text       = magazine.Name;
                    txtID.Text         = magazine.ID1;
                    txtPrice.Text      = magazine.Price.ToString();
                    txtIssue.Text      = magazine.Issue;
                    switch (magazine.Type)
                    {
                    case Magazine_Type.Actual:
                        cBoxType.SelectedIndex = 0;
                        break;

                    case Magazine_Type.Computer:
                        cBoxType.SelectedIndex = 1;
                        break;

                    case Magazine_Type.News:
                        cBoxType.SelectedIndex = 2;
                        break;

                    case Magazine_Type.Sport:
                        cBoxType.SelectedIndex = 3;
                        break;

                    case Magazine_Type.Technology:
                        cBoxType.SelectedIndex = 4;
                        break;
                    }
                    break;
                }
            }
            btnAdd.Visible    = false;
            btnUpdate.Visible = true;
            txtID.Enabled     = false;
        }
示例#18
0
        /// <summary>
        /// This function used to select image.
        /// </summary>
        /// <returns>if text box are not null ,return true</returns>
        private void btnSelectImage_Click(object sender, EventArgs e)
        {
            Logger.GetLogger().WriteLog(LoginedCustomer.getInstance().User.Username, btnSelectImage.Text, DateTime.Now);
            OpenFileDialog dialog = new OpenFileDialog();

            dialog.Filter = "Image Files(*.BMP;*.JPG;*.PNG)|*.BMP;*.JPG;*.PNG" +
                            "|All files(*.*)|*.*";
            dialog.CheckFileExists = true;
            dialog.Multiselect     = false;
            if (dialog.ShowDialog() == DialogResult.OK)
            {
                Bitmap image = new Bitmap(dialog.FileName);
                pboxBook.Image = (Image)image;
            }
        }
示例#19
0
 /// <summary>
 /// This function add new book button click operation.
 /// This function is used to changed enabled.
 /// </summary>
 /// <returns> This function does not return a value  </returns>
 private void btnAddNewBook_Click(object sender, EventArgs e)
 {
     Logger.GetLogger().WriteLog(LoginedCustomer.getInstance().User.Username, btnAddNewBook.Text, DateTime.Now);
     panelAddBook.Visible = true;
     pboxBook.Image       = null;
     txtName.Text         = "";
     txtID.Text           = "";
     txtPrice.Text        = "";
     txtISBN.Text         = "";
     txtAuthor.Text       = "";
     txtPublisher.Text    = "";
     txtPages.Text        = "";
     btnAdd.Visible       = true;
     btnUpdate.Visible    = false;
     txtID.Enabled        = true;
 }
示例#20
0
 /// <summary>
 /// This function includes visible changed operation for my orders.
 /// This function clear controls and design.
 /// </summary>
 /// <returns> This function does not return a value </returns>
 private void MyOrders_VisibleChanged(object sender, EventArgs e)
 {
     flpOrders.Controls.Clear();
     flpItems.Controls.Clear();
     panelBottom.Visible = false;
     designs.Clear();
     foreach (ShoppingCard card in StoreMainScreen.orderList)
     {
         if (card.CustomerID == LoginedCustomer.getInstance().User.CustomerId)
         {
             AdminOrderDesign design = new AdminOrderDesign(card);
             designs.Add(design);
             design.btnShow.Click += BtnShow_Click;
             flpOrders.Controls.Add(design);
         }
     }
 }
 /// <summary>
 /// This function includes increase button click operation and updated shopping card.
 /// </summary>
 /// <returns> This function does not return a value  </returns>
 private void btnIncrease_Click(object sender, EventArgs e)
 {
     Logger.GetLogger().WriteLog(LoginedCustomer.getInstance().User.Username, btnIncrease.Text, DateTime.Now);
     for (int i = 0; i < StoreMainScreen.shoppingCards[LoginScreen.shoppingCardIndex].itemsToPurchase.Count; i++)
     {
         if (StoreMainScreen.shoppingCards[LoginScreen.shoppingCardIndex].itemsToPurchase[i].Product.Name == lblProductName.Text)
         {
             StoreMainScreen.shoppingCards[LoginScreen.shoppingCardIndex].itemsToPurchase[i].Quantity++;
             double paymentAmount = (StoreMainScreen.shoppingCards[LoginScreen.shoppingCardIndex].itemsToPurchase[i].Product.Price *
                                     StoreMainScreen.shoppingCards[LoginScreen.shoppingCardIndex].itemsToPurchase[i].Quantity);
             StoreMainScreen.shoppingCards[LoginScreen.shoppingCardIndex].PaymentAmount +=
                 StoreMainScreen.shoppingCards[LoginScreen.shoppingCardIndex].itemsToPurchase[i].Product.Price;
             lblNumber.Text = StoreMainScreen.shoppingCards[LoginScreen.shoppingCardIndex].itemsToPurchase[i].Quantity.ToString();
             lblPrice.Text  = paymentAmount.ToString() + " ₺";
             UtilUpdate.Update(StoreMainScreen.shoppingCards[LoginScreen.shoppingCardIndex]);
         }
     }
 }
示例#22
0
        /// <summary>
        /// This function update book button click operation.
        /// This function is used to update product list and update for util function.
        /// </summary>
        /// <returns> This function does not return a value  </returns>
        private void btnUpdate_Click(object sender, EventArgs e)
        {
            Logger.GetLogger().WriteLog(LoginedCustomer.getInstance().User.Username, btnUpdate.Text, DateTime.Now);
            if (!isBlank())
            {
                MessageBox.Show("Please fill all blanks!");
                return;
            }
            else if (pboxBook.Image == null)
            {
                MessageBox.Show("Please select an image.");
                return;
            }
            NumberFormatInfo provider = new NumberFormatInfo();

            provider.NumberDecimalSeparator = ".";
            Creator c = new BookFactory(txtName.Text, txtID.Text, Convert.ToDouble(txtPrice.Text, provider), txtISBN.Text, txtAuthor.Text,
                                        txtPublisher.Text, Convert.ToInt32(txtPages.Text), pboxBook.Image);

            string[]     lvItem = { txtID.Text, txtName.Text, txtPrice.Text, txtISBN.Text, txtAuthor.Text, txtPublisher.Text, txtPages.Text };
            ListViewItem item   = new ListViewItem(lvItem);

            for (int i = 0; i < listViewBooks.Items.Count; i++)
            {
                if (listViewBooks.Items[i].SubItems[0].Text == selectedID)
                {
                    listViewBooks.Items[i] = item;
                    break;
                }
            }
            for (int i = 0; i < StoreMainScreen.productList.Count; i++)
            {
                if (StoreMainScreen.productList[i].ID1 == selectedID)
                {
                    StoreMainScreen.productList[i] = c.FactoryMethod();
                    break;
                }
            }
            UtilUpdate.Update(c.FactoryMethod());
            MessageBox.Show("Updated Succesfully!");
            panelAddBook.Visible = false;
            selectedIndex        = -1;
        }
        /// <summary>
        /// This function update selected music cd button click operation.
        /// This function is used to changed enabled.
        /// </summary>
        /// <returns> This function does not return a value  </returns>
        private void btnUpdateSelected_Click(object sender, EventArgs e)
        {
            Logger.GetLogger().WriteLog(LoginedCustomer.getInstance().User.Username, btnUpdateSelected.Text, DateTime.Now);
            if (selectedIndex == -1)
            {
                MessageBox.Show("Please select a book from list!");
                return;
            }
            panelAddMusicCD.Visible = true;
            selectedID = listViewMusicCDs.Items[selectedIndex].SubItems[0].Text;
            foreach (Product product in StoreMainScreen.productList)
            {
                if (product.ID1 == selectedID)
                {
                    MusicCD musicCD = (MusicCD)product;
                    pboxMusicCD.Image = musicCD.Image;
                    txtName.Text      = musicCD.Name;
                    txtID.Text        = musicCD.ID1;
                    txtPrice.Text     = musicCD.Price.ToString();
                    txtSinger.Text    = musicCD.Singer;
                    switch (musicCD.Type)
                    {
                    case MusicCD_Type.Romance:
                        cBoxType.SelectedIndex = 0;
                        break;

                    case MusicCD_Type.HardRock:
                        cBoxType.SelectedIndex = 1;
                        break;

                    case MusicCD_Type.Country:
                        cBoxType.SelectedIndex = 2;
                        break;

                    default:
                        break;
                    }
                }
            }
            btnAdd.Visible    = false;
            btnUpdate.Visible = true;
            txtID.Enabled     = false;
        }
示例#24
0
 /// <summary>
 /// This function is used to edit the Mdi form.
 /// </summary>
 /// <returns> This function does not return a value </returns>
 private void StoreMainScreen_Load(object sender, EventArgs e)
 {
     bookScreen.MdiParent = this;
     bookScreen.Parent    = panelBase;
     bookScreen.Dock      = DockStyle.Fill;
     bookScreen.Show();
     musicScreen.MdiParent    = this;
     musicScreen.Parent       = panelBase;
     musicScreen.Dock         = DockStyle.Fill;
     magazineScreen.MdiParent = this;
     magazineScreen.Parent    = panelBase;
     magazineScreen.Dock      = DockStyle.Fill;
     myOrdersScreen.MdiParent = this;
     myOrdersScreen.Parent    = panelBase;
     myOrdersScreen.Dock      = DockStyle.Fill;
     lblWelcome.Text          = "Welcome " + LoginedCustomer.getInstance().User.Username + "!";
     if (LoginedCustomer.getInstance().User.CustomerId == "1")
     {
         btnAdmin.Visible = true;
     }
 }
示例#25
0
        /// <summary>
        /// This function includes Add button click operation.
        /// This function used to called the add product for shopping card and save for util function.
        /// </summary>
        /// <returns> This function does not return a value </returns>
        private void btnAdd_Click(object sender, EventArgs e)
        {
            Logger.GetLogger().WriteLog(LoginedCustomer.getInstance().User.Username, btnAdd.Text, DateTime.Now);
            ItemToPurchase itemToPurchase = new ItemToPurchase();

            itemToPurchase.Product = book;
            foreach (ItemToPurchase item in StoreMainScreen.shoppingCards[LoginScreen.shoppingCardIndex].itemsToPurchase)
            {
                if (item.Product.ID1 == itemToPurchase.Product.ID1)
                {
                    MessageBox.Show("It's already in the cart!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }
            }
            itemToPurchase.Quantity = quantityBook;
            StoreMainScreen.shoppingCards[LoginScreen.shoppingCardIndex].AddProduct(itemToPurchase);
            int i = StoreMainScreen.shoppingCards[LoginScreen.shoppingCardIndex].itemsToPurchase.Count;

            UtilSave.Save(StoreMainScreen.shoppingCards[LoginScreen.shoppingCardIndex], i);
            MessageBox.Show("Added!", "Successful", MessageBoxButtons.OK, MessageBoxIcon.Information);
        }
示例#26
0
        /// <summary>
        /// This function includes receive button click operation.
        /// This function changed the order status and buttons' enable.
        /// </summary>
        /// <returns> This function does not return a value </returns>
        private void btnReceive_Click(object sender, EventArgs e)
        {
            Logger.GetLogger().WriteLog(LoginedCustomer.getInstance().User.Username, btnReceive.Text, DateTime.Now);
            DialogResult dr = MessageBox.Show("Are you sure?", "Information",
                                              MessageBoxButtons.OKCancel, MessageBoxIcon.Information);

            if (dr == DialogResult.Cancel)
            {
                return;
            }
            designs[selectedIndex].Card.Status = OrderStatus.received;
            designs[selectedIndex].SetStatus   = "Status: Received";
            foreach (ShoppingCard order in StoreMainScreen.orderList)
            {
                if (order.OID == designs[selectedIndex].Card.OID)
                {
                    order.Status = OrderStatus.received;
                    UtilUpdate.UpdateOrder(order);
                }
            }
            flpOrders.Refresh();
            btnCancel.Enabled  = false;
            btnReceive.Enabled = false;
        }
 /// <summary>
 /// This function includes continue shopping button click operation.
 /// This function used to hide the shopping card form and show the store main screen.
 /// </summary>
 /// <returns> This function does not return a value </returns>
 private void btnContinueShopping_Click(object sender, EventArgs e)
 {
     Logger.GetLogger().WriteLog(LoginedCustomer.getInstance().User.Username, btnContinueShopping.Text, DateTime.Now);
     StoreMainScreen.storeMainScreen.Show();
     StoreMainScreen.ShoppingCardForm.Hide();
 }
示例#28
0
 /// <summary>
 /// This function includes shopping list tool strip menu item button click operation.
 /// This function used to show the shopping list.
 /// </summary>
 /// <returns> This function does not return a value </returns>
 private void shoppingListToolStripMenuItem_Click(object sender, EventArgs e)
 {
     Logger.GetLogger().WriteLog(LoginedCustomer.getInstance().User.Username, shoppingListToolStripMenuItem.Text, DateTime.Now);
     shoppingList.Show();
 }
 /// <summary>
 /// This function includes Increase button click operation and increase the quantity.
 /// </summary>
 /// <returns> This function does not return a value </returns>
 private void btnIncrease_Click(object sender, EventArgs e)
 {
     Logger.GetLogger().WriteLog(LoginedCustomer.getInstance().User.Username, btnIncrease.Text, DateTime.Now);
     quantityMagazine++;
     lblNumber.Text = quantityMagazine.ToString();
 }