Ejemplo n.º 1
0
        //btn checkout in cashRegister
        private void btn_CashRegister_Checkout_Click_1(object sender, EventArgs e)
        {
            if (studentIDSelect != null && drink != null)
            {
                //show order
                string order = $"Order from student {studentIDSelect} has been made.";
                MessageBox.Show(order);

                //update drink
                Drink_Service ds = new Drink_Service();
                ds.SaleDrink(drink);

                //reset values
                studentIDSelect = null;
                drink           = null;

                //refresh form
                Refresh();
                showPanel("CashRegister");
            }
            else
            {
                MessageBox.Show("Not a valid selection");
            }
        }
Ejemplo n.º 2
0
        public override void OnClickOK(object sender, EventArgs e)
        {
            //Check if the user is sure
            CP_Popup_Sure popup = new CP_Popup_Sure();

            popup.SetAsChangeStock(item.Name);
            popup.ShowDialog();

            if (!(popup.DialogResult == DialogResult.OK))
            {
                DialogResult = DialogResult.Cancel;
                Close();
            }

            //Store the value of the input
            bool stockParsed = int.TryParse(CP_Popup_ChangeStock_txtStock.Text, out int stock);

            //Close the form if the parse fails
            if (!stockParsed)
            {
                Close();
            }

            //Check whether to use the Dish or the drink Service
            if (item.GetType() == typeof(Dish))
            {
                Dish_Service dishService = new Dish_Service();

                //Modify the stock
                try
                {
                    dishService.ModifyStock(item.Id, stock);
                }
                catch (Exception ex)
                {
                    ErrorHandler.Instance.HandleError("Voorraad van " + item.Id + " kon niet aangepast worden!", "Voorraad niet aangepast", ex);

                    //Tell the ControlPanel form that the action didn't succeed
                    DialogResult = DialogResult.Cancel;
                }
            }
            else
            {
                Drink_Service drinkService = new Drink_Service();

                //Modify the stock
                try
                {
                    drinkService.ModifyStock(item.Id, stock);
                }
                catch (Exception ex)
                {
                    ErrorHandler.Instance.HandleError("Voorraad van " + item.Id + " kon niet aangepast worden!", "Voorraad niet aangepast", ex);

                    //Tell the ControlPanel form that the action didn't succeed
                    DialogResult = DialogResult.Cancel;
                }
            }
        }
        private void btnRemove_Click(object sender, EventArgs e)
        {
            Drink_Service drinkService = new Drink_Service();

            drinkService.DeleteADrink(drink);
            //hide the form
            this.Close();
        }
Ejemplo n.º 4
0
        private void btn_Remove_Drink_Click(object sender, EventArgs e)
        {
            var           selectedItem  = listViewDrinks.SelectedItems[0];
            Drink         selectedDrink = drinks.Where(t => t.Name == selectedItem.Text).FirstOrDefault();
            Drink_Service drinkSer      = new Drink_Service();

            drinkSer.DeleteDrink(selectedDrink.Name);
            btn_Remove_Drink.Enabled = false;
            btn_Edit_Drink.Enabled   = false;
        }
Ejemplo n.º 5
0
        private void bestelBtn_Click(object sender, EventArgs e)
        {
            orderService     = new Order_Service();
            tableService     = new Table_Service();
            order.EmployeeId = employee.Id;
            billService      = new Bill_Service();
            try
            {
                bill = billService.GetBillByTableId(tafel.Number);
            }
            catch (Exception d)
            {
                orders = new List <Order>();
                bill   = new Bill(DateTime.Now, tafel, orders, employee, false);
                billService.AddBill(bill);
                MessageBox.Show("Bestelling is geplaatst.", "Attentie", MessageBoxButtons.OK, MessageBoxIcon.Information);
                orderService.AddOrderWhereBillIdIs(order, bill.Id);
                tafel.Occupied = true;
                tableService.ModifyTable(tafel);
                return;
            }

            if (bill.Payed == false)
            {
                orderService.AddOrderWhereBillIdIs(order, bill.Id);
                MessageBox.Show("Bestelling is geplaatst.", "Attentie", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }
            else
            {
                orders = new List <Order>();
                bill   = new Bill(DateTime.Now, tafel, orders, employee, false);
                billService.AddBill(bill);
                MessageBox.Show("Bestelling is geplaatst.", "Attentie", MessageBoxButtons.OK, MessageBoxIcon.Information);
                orderService.AddOrderWhereBillIdIs(order, bill.Id);
                tafel.Occupied = true;
                tableService.ModifyTable(tafel);
            }

            foreach (Dish dish in order.Dishes)
            {
                dishService = new Dish_Service();
                dishService.ModifyStock(dish.Id, dish.Stock - 1);
            }

            foreach (Drink drink in order.Drinks)
            {
                drinkService = new Drink_Service();
                drinkService.ModifyStock(drink.Id, drink.Stock - 1);
            }

            order = new Order();
        }
Ejemplo n.º 6
0
        //Event fired for button press in Supplies
        private void Btn_Supplies_Save_Click(object sender, EventArgs e)
        {
            Drink_Service sv = new Drink_Service();

            if (!Txt_Supplies_Price.Visible)
            {
                sv.UpdateDrink(Convert.ToInt32(Txt_Supplies_Id.Text), Txt_Supplies_NewName.Text, Convert.ToInt32(Txt_Supplies_NewStock.Text));
            }
            else
            {
                sv.AddDrink(Txt_Supplies_NewName.Text, Convert.ToInt32(Txt_Supplies_NewStock.Text), Convert.ToInt32(Txt_Supplies_Sold.Text), Convert.ToInt32(Txt_Supplies_Price.Text));
            }
            showPanel("DrinkSup");
        }
Ejemplo n.º 7
0
        public override void OnClickOK(object sender, EventArgs e)
        {
            CP_Popup_Sure popup = new CP_Popup_Sure();

            popup.SetAsEdit(CP_Popop_EditDrinksMenu_txtName.Text);
            popup.ShowDialog();

            if (!(popup.DialogResult == DialogResult.OK))
            {
                DialogResult = DialogResult.Cancel;
                Close();
            }

            Drink_Service drinkService = new Drink_Service();

            //Store the values of all of the inputs
            string name = CP_Popop_EditDrinksMenu_txtName.Text;
            bool   alcoholic;

            bool priceParsed = double.TryParse(CP_Popop_EditDrinksMenu_txtPrice.Text, out double price);
            bool stockParsed = int.TryParse(CP_Popup_EditDrinksMenu_txtStock.Text, out int stock);

            if (!(priceParsed && stockParsed))
            {
                Close();
            }

            if (CP_Popup_EditDrinksMenu_cboxAlcoholic.Checked)
            {
                alcoholic = true;
            }
            else
            {
                alcoholic = false;
            }


            //Add a new dish to the system
            try
            {
                drinkService.ModifyDrink(new Drink(id, name, alcoholic, price, stock));
            }
            catch (Exception ex)
            {
                ErrorHandler.Instance.HandleError("Drank met id " + id + " kon niet aangepast worden!", "Gerecht niet aangepast", ex);

                //Tell the ControlPanel form that the action didn't succeed
                DialogResult = DialogResult.Cancel;
            }
        }
        private void btnEdit_Click(object sender, EventArgs e)
        {
            //get the field that the user wants to edit
            drink.DrinkName   = txtEditName.Text;
            drink.DrinksSold  = int.Parse(txtEditSold.Text);
            drink.DrinkType   = txtEditType.Text;
            drink.Price       = decimal.Parse(txtEditPrice.Text);
            drink.StockAmount = int.Parse(txtEditStock.Text);
            Drink_Service drinkService = new Drink_Service();

            drinkService.UpdateDrink(drink);
            //hide the form
            this.Close();
        }
Ejemplo n.º 9
0
        public void refreshDrinks()
        {
            // fill the students listview within the students panel with a list of students
            Drink_Service drinkService = new Drink_Service();
            List <Drink>  drinkList    = drinkService.getDrinks();

            // clear the listview before filling it again
            listViewDrinks.Items.Clear();

            foreach (Drink drink in drinkList)
            {
                ListViewItem item = new ListViewItem(drink.DrinkName);
                listViewDrinks.Items.Add(item);
            }
        }
Ejemplo n.º 10
0
 private void btnSubmit_Click(object sender, EventArgs e)
 {
     if (txtDrinkName.Text == "" && txtDrinkNum.Text == "" && txtSold.Text == "" && txtDrinkType.Text == "" && txtPrice.Text == "" && txtStock.Text == "")
     {
         MessageBox.Show("Some fields are empty, please fill fields that are empty");
     }
     else
     {
         Drink drink = new Drink();
         //get the drink from the user, and store it in Drink fields
         drink.DrinkName   = txtDrinkName.Text;
         drink.DrinkNumber = int.Parse(txtDrinkNum.Text);
         drink.DrinksSold  = int.Parse(txtSold.Text);
         drink.DrinkType   = txtDrinkType.Text;
         drink.Price       = decimal.Parse(txtPrice.Text);
         drink.StockAmount = int.Parse(txtStock.Text);
         Drink_Service drinkService = new Drink_Service();
         drinkService.InsertNewDrink(drink);
         //hide the form after clicking the submit button
         this.Close();
     }
 }
Ejemplo n.º 11
0
        private void RefreshDrinkPanel()
        {
            Drink_Service drinkService = new Drink_Service();
            List <Drink>  drinks       = drinkService.GetDrinks();

            //clear listview before filling it
            listViewDrinks.Items.Clear();

            //fill up list view
            foreach (Drink d in drinks)
            {
                ListViewItem li = new ListViewItem(d.DrinkID.ToString(), 0);
                li.SubItems.Add(d.DrinkName);
                li.SubItems.Add(d.VATID.ToString());
                li.SubItems.Add(d.DrinkPrice.ToString());
                li.SubItems.Add(d.StockAmount.ToString());

                //if(d.StockAmount< 10)
                //{
                //    li.SubItems.Add(d.StockAmount.ToString());
                //    li.SubItems.Add("Nearly depleted");

                //}else if (d.StockAmount == 0)
                //{
                //    li.SubItems.Add(d.StockAmount.ToString());
                //    li.SubItems.Add("is empty");

                //}
                //else
                //{
                //    li.SubItems.Add("stock sufficient");

                //}

                li.SubItems.Add(d.SalesCount.ToString());
                li.Tag = d;
                listViewDrinks.Items.Add(li);
            }
        }
        public override void OnClickOK(object sender, EventArgs e)
        {
            Drink_Service drinkService = new Drink_Service();

            //Store the values of all of the inputs
            string name = CP_Popop_AddToDrinksMenu_txtName.Text;
            bool   alcoholic;

            bool priceParsed = double.TryParse(CP_Popop_AddToDrinksMenu_txtPrice.Text, out double price);
            bool stockParsed = int.TryParse(CP_Popup_AddToDrinksMenu_txtStock.Text, out int stock);

            if (!(priceParsed && stockParsed))
            {
                Close();
            }

            if (CP_Popup_AddToDrinksMenu_cboxAlcoholic.Checked)
            {
                alcoholic = true;
            }
            else
            {
                alcoholic = false;
            }

            //Add a new drink to the system
            try
            {
                drinkService.AddDrink(new Drink(name, alcoholic, price, stock));
            }
            catch (Exception ex)
            {
                ErrorHandler.Instance.HandleError("Drank kon niet toegevoegd worden!", "Drank niet toegevoegd", ex);

                //Tell the ControlPanel form that the action didn't succeed
                DialogResult = DialogResult.Cancel;
            }
        }
Ejemplo n.º 13
0
        //private to internal because we will reference it from the other form
        internal void showPanel(string panelName)
        {
            //hide all panels
            pnl_Dashboard.Hide();
            img_Dashboard.Hide();
            pnl_Students.Hide();
            pnl_Teachers.Hide();
            pnl_Drinks.Hide();
            pnl_CashRegister.Hide();
            pnl_Supervisors.Hide();


            if (panelName == "Dashboard")
            {
                // show dashboard
                pnl_Dashboard.Show();
                img_Dashboard.Show();
            }
            else if (panelName == "Students")
            {
                //Check if the listview already exist, if not create one.
                if (viewStudentList == null)
                {
                    viewStudentList = CreateStudentListView();
                    pnl_Students.Controls.Add(viewStudentList);
                }

                // show students
                pnl_Students.Show();

                // fill the students listview within the students panel with a list of students
                Student_Service studService = new Student_Service();
                List <Student>  studentList = studService.GetStudents();

                // clear the listview before filling it again
                viewStudentList.Items.Clear();

                foreach (Student s in studentList)
                {
                    ListViewItem student = new ListViewItem(new string[] { s.Number.ToString(), s.FirstName, s.LastName });
                    viewStudentList.Items.Add(student);
                }
            }
            else if (panelName == "Lecturers")
            {
                // show teachers panel
                pnl_Teachers.Show();

                // fill the teachers listview within the teacher panel with a list of teachers
                Teacher_Service teacherService = new Teacher_Service();
                List <Teacher>  teacherList    = teacherService.GetTeachers();

                // clear the items in listview
                listViewTeachers.Items.Clear();

                // fill list
                foreach (Teacher s in teacherList)
                {
                    ListViewItem teacher = new ListViewItem(s.Number.ToString());
                    teacher.SubItems.Add(s.FirstName);
                    teacher.SubItems.Add(s.LastName);
                    listViewTeachers.Items.Add(teacher);
                }
            }



            //this is part of variant A from assignment 3
            //this is part of variant A from assignment 3
            else if (panelName == "Drinks Supplies")
            {
                //show drinks panel
                pnl_Drinks.Show();

                //fill the drinks listview wihin the drink panel with a list of drinks
                Drink_Service drinkService = new Drink_Service();
                List <Drink>  drinkList    = drinkService.GetDrinks();

                //clear the items in listview
                listViewDrinks.Items.Clear();

                //fill list
                foreach (Drink d in drinkList)
                {
                    ListViewItem drink = new ListViewItem(new string[] { d.DrinkName, String.Format("{0:0.00}", d.Price), d.StockAmount.ToString() });
                    drink.Tag = d;
                    if (d.StockAmount < 10)
                    {
                        //show half bottle icon
                        drink.ImageIndex = 1;
                    }
                    else
                    {
                        //show full bottle icon
                        drink.ImageIndex = 0;
                    }
                    listViewDrinks.Items.Add(drink);
                }
                this.Refresh();
            }



            //this is a part of variant B from assignment 3
            //this is a part of variant B from assignment 3
            else if (panelName == "CashRegister")
            {
                //show panel
                pnl_CashRegister.Show();

                //get list of drinks and students
                Student_Service studService = new Student_Service();
                List <Student>  studentList = studService.GetStudents();

                Drink_Service drinkService = new Drink_Service();
                List <Drink>  drinkList    = drinkService.GetDrinks();

                //clear the listview before filling it again
                lv_Cash_Student.Items.Clear();
                lv_Cash_Drinks.Items.Clear();

                //get students
                foreach (Student s in studentList)
                {
                    ListViewItem student = new ListViewItem(s.Number.ToString());
                    student.SubItems.Add(s.FullName);

                    lv_Cash_Student.Items.Add(student);
                }

                //get drinks
                foreach (Drink d in drinkList)
                {
                    ListViewItem drink = new ListViewItem(d.DrinkNumber.ToString());
                    drink.SubItems.Add(d.DrinkName);
                    drink.SubItems.Add(d.Price.ToString("0.00"));
                    drink.SubItems.Add(d.StockAmount.ToString());

                    lv_Cash_Drinks.Items.Add(drink);
                }
            }

            //this is a part of variant B from assignment 4
            //this is a part of variant B from assignment 4
            else if (panelName == "Supervisors")
            {
                //show supervisor panek
                pnl_Supervisors.Show();

                //fill the supervisors listview within the supervisor panel with list of supervisors
                Supervisor_Service supervisorService = new Supervisor_Service();
                List <Supervisor>  supervisorList    = supervisorService.GetSupervisors();

                //clear items in listview
                listViewSupervisors.Items.Clear();

                //fill list
                foreach (Supervisor s in supervisorList)
                {
                    ListViewItem supervisor = new ListViewItem(new string[] { s.LecturerID.ToString(), s.FirstName, s.LastName });
                    supervisor.Tag = s;
                    listViewSupervisors.Items.Add(supervisor);
                }
            }
        }
Ejemplo n.º 14
0
        private void applyBtn_Click(object sender, EventArgs e)
        {
            int drinkType = 4;   //1 = alcoholic ; 0 = non-alcoholic

            //if it's true, there is an error, if it's false, there is no error
            bool error = false;


            //set drinkType based on the selected index
            if (typeCmb.SelectedIndex == 0)
            {
                drinkType = 0;
            }
            else if (typeCmb.SelectedIndex == 1)
            {
                drinkType = 1;
            }
            else
            {
                MessageBox.Show("You need to select a drink type!", "Select drink type", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                error = true;
            }
            if (!Regex.IsMatch(priceTxt.Text, @"[\d]{1,4}([.,][\d]{1,2})?"))
            {
                MessageBox.Show("Wrong price format", "Price error", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                error = true;
            }
            //check if the name TextBox is empty or it has less than 4 characters
            if (nameTxt.Text == "" || nameTxt.Text.Length <= 3)
            {
                MessageBox.Show("Your drink name must NOT be empty and it has to have a minimum length of 3 characters!",
                                "Warning",
                                MessageBoxButtons.OK,
                                MessageBoxIcon.Warning);

                error = true;
            }
            if (!Regex.IsMatch(stockTxt.Text, "[0-9]"))
            {
                MessageBox.Show("The stock has to be a number!", "Stock error", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                error = true;
            }
            if (!error)
            {
                if (decimal.Parse(priceTxt.Text) < 0 || decimal.Parse(stockTxt.Text) < 0)
                {
                    MessageBox.Show("The stock and the price can't be less than 0!", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    error = true;
                }
            }

            if (!error) //if there are no errors, add a new drink
            {
                for (int i = 0; i < priceTxt.Text.Length; i++)
                {
                    //if there are commas in the price, replace them with a period
                    if (priceTxt.Text[i].ToString() == ",")
                    {
                        priceTxt.Text = priceTxt.Text.Replace(",", ".");
                    }
                }
                Drink_Service drinkService = new Drink_Service();
                drinkService.AddDrink(nameTxt.Text, int.Parse((stockTxt.Text)), decimal.Parse(priceTxt.Text), drinkType);
                MessageBox.Show("Drink added succesfully!", "Drink Added", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                this.Close();
            }
        }
Ejemplo n.º 15
0
        private void showPanel(string panelName)
        {
            //dashboard

            if (panelName == "Dashboard")
            {
                // hide all other panels
                HidingPanels();

                // show dashboard
                pnl_Dashboard.Show();
                img_Dashboard.Show();
            }
            //for students
            else if (panelName == "Students")
            {
                // hide all other panels
                HidingPanels();

                // show students
                pnl_Students.Show();

                // fill the students listview within the students panel with a list of students
                SomerenLogic.Student_Service studService = new SomerenLogic.Student_Service();
                List <Student> studentList = studService.GetStudents();

                // clear the listview before filling it again
                listViewStudents.Clear();

                ///////remove this
                listViewStudents.Columns.Add("Id");
                listViewStudents.Columns.Add("First Name");
                listViewStudents.Columns.Add("Last Name");
                listViewStudents.Columns.Add("Year");


                foreach (SomerenModel.Student s in studentList)
                {
                    ListViewItem li = new ListViewItem(s.StudentNumber.ToString());
                    li.SubItems.Add(s.FirstName.ToString());
                    li.SubItems.Add(s.LastName.ToString());
                    li.SubItems.Add(s.Year.ToString());
                    listViewStudents.Items.Add(li);
                }
            }
            //for lecturers
            else if (panelName == "Lecturers")
            {
                HidingPanels();

                PNL_TEACHERS.Show();

                // fill the students listview within the students panel with a list of students
                SomerenLogic.Teacher_Service teachService = new SomerenLogic.Teacher_Service();
                List <Teacher> teacherList = teachService.GetTeachers();

                // clear the listview before filling it again
                listViewTeachers.Items.Clear();

                foreach (SomerenModel.Teacher s in teacherList)
                {
                    ListViewItem li = new ListViewItem(s.TeacherNumber.ToString());
                    li.SubItems.Add(s.FirstName.ToString());
                    li.SubItems.Add(s.LastName.ToString());
                    li.SubItems.Add(s.Speciality.ToString());
                    listViewTeachers.Items.Add(li);
                }
            }
            // for rooms
            else if (panelName == "Rooms")
            {
                //hiding the panels you dont wanna show
                HidingPanels();

                //showing Rooms
                PNL_Rooms.Show();

                //filling the rooms listview within the srooms panel with a list of rooms
                SomerenLogic.Room_Service roomService = new SomerenLogic.Room_Service();
                List <Room> roomList = roomService.GetRooms();

                foreach (SomerenModel.Room r in roomList)
                {
                    ListViewItem li = new ListViewItem(r.Number.ToString());
                    li.SubItems.Add(r.Capacity.ToString());

                    if (r.Type == true)
                    {
                        li.SubItems.Add("Teacher");
                    }
                    else
                    {
                        li.SubItems.Add("Student");
                    }

                    LV_Rooms.Items.Add(li);
                }
            }
            //for drinks
            if (panelName == "Drinks")
            {
                //hide panels
                HidingPanels();
                //Show the panel
                Pnl_Drinks.Show();

                listViewsDrinks.Items.Clear();

                //Add columns
                listViewsDrinks.Columns.Add("Id");
                listViewsDrinks.Columns.Add("NameOfDrink");
                listViewsDrinks.Columns[1].Width = 100;
                listViewsDrinks.Columns.Add("Price");
                listViewsDrinks.Columns.Add("Stock");
                //listViewsDrinks.Columns.Add("studentId");
                ////listViewsDrinks.Columns[5].Width = 50;
                listViewsDrinks.Columns.Add(" ");
                listViewsDrinks.Columns.Add("Alcoholic");


                // Fill the drink
                LoadDrinks();
            }

            //for register
            if (panelName == "Register")
            {
                //hide panels
                HidingPanels();

                //show pnl register
                PNL_Register.Show();
                Student_Service studentService = new Student_Service();
                List <Student>  studentList    = studentService.GetStudents();
                Drink_Service   drinkService   = new Drink_Service();
                List <Drinks>   drinkList      = drinkService.GetDrinks();

                listViewStudent.Items.Clear();
                listViewStudent.Columns.Add("Student ID", 100);
                listViewStudent.Columns.Add("Student Name", 200);

                listViewDrink.Items.Clear();
                //listViewDrink.Items.Add("DrinkID", 60);
                listViewDrink.Columns.Add("DrinkID", 80);
                listViewDrink.Columns.Add("DrinkName", 100);
                listViewDrink.Columns.Add("Price", 80);


                foreach (Student s in studentList)
                {
                    ListViewItem li = new ListViewItem(s.StudentNumber.ToString());
                    li.SubItems.Add(s.FullName);
                    listViewStudent.Items.Add(li);
                }

                foreach (Drinks d in drinkList)
                {
                    ListViewItem li = new ListViewItem(d.Id.ToString());
                    //li.SubItems.Add(d.NameOfDrink);
                    li.SubItems.Add(d.NameOfDrink);
                    li.SubItems.Add(d.Price.ToString());
                    listViewDrink.Items.Add(li);
                }
            }

            //for revenue --> RETAKE
            else if (panelName == "Revenue")
            {
                //hiding all other panels
                HidingPanels();
                //showing the revenue panel
                PNL_Revenue.Show();
                //generating the revenue table from database
                ShowRevenue();
            }

            //for activities
            if (panelName == "Activities")
            {
                //showing activities panel
                PnlActivities.Show();

                // clear the listview before filling it again
                listViewActivities.Clear();

                //add columns
                listViewActivities.Columns.Add("Id");
                listViewActivities.Columns[0].Width = 30;
                listViewActivities.Columns.Add("ActivityName");
                listViewActivities.Columns[1].Width = 100;
                listViewActivities.Columns.Add("NumberofStudents");
                listViewActivities.Columns[2].Width = 100;
                listViewActivities.Columns.Add("NumberofSupervisors");
                listViewActivities.Columns[3].Width = 130;

                LoadActivities();
            }
            //for supervisors
            else if (panelName == "Supervisors")
            {
                HidingPanels();

                SomerenLogic.Teacher_Service teachService = new SomerenLogic.Teacher_Service();
                List <Teacher> teacherList = teachService.GetSupervisors();

                // clear the listview before filling it again
                listViewSupervisors.Items.Clear();

                foreach (SomerenModel.Teacher s in teacherList)
                {
                    ListViewItem li = new ListViewItem(s.TeacherNumber.ToString());
                    li.SubItems.Add(s.FirstName.ToString());
                    li.SubItems.Add(s.LastName.ToString());
                    li.SubItems.Add(s.Speciality.ToString());
                    li.SubItems.Add(s.Supervisor.ToString());
                    listViewSupervisors.Items.Add(li);
                }
            }
            //for timetbale
            else if (panelName == "Timetable")
            {
                HidingPanels();
                PNL_timetable.Show();
                LV_Timetable.Items.Clear();
            }
        }
Ejemplo n.º 16
0
        private void showPanel(string panelName)
        {
            switch (panelName)
            {
            case "Students":
                Student_Service studService = new Student_Service();
                List <Student>  studentList = studService.GetStudents();

                ListViewStuPrint(listViewStudents, studentList);
                break;

            case "Lecturers":
                Lecturer_Service lecService = new Lecturer_Service();
                List <Teacher>   lecList    = lecService.GetTeachers();

                ListViewLecPrint(listView_Lec, lecList);
                break;

            case "Supervisors":
                Supervisor_Service supService = new Supervisor_Service();
                List <Supervisor>  supList    = supService.GetSupervisors();
                PrintSup(listView_Sup, supList);
                Activity_Service actService = new Activity_Service();
                List <Activity>  actList    = actService.GetActivities();
                cmb_ActivityID.DataSource    = actList;
                cmb_ActivityID.DisplayMember = "Name";
                cmb_ActivityID.ValueMember   = "ID";
                break;

            case "Rooms":
                Room_Service roomService = new Room_Service();
                List <Room>  roomList    = roomService.GetRooms();

                ListViewRoomPrint(listViewRooms, roomList);
                break;

            case "DrinkSup":
                Btn_Supplies_Save.Enabled  = false;
                Txt_Supplies_Id.Text       = string.Empty;
                Txt_Supplies_NewName.Text  = string.Empty;
                Txt_Supplies_NewStock.Text = string.Empty;
                Txt_Supplies_Price.Text    = string.Empty;
                Txt_Supplies_Sold.Text     = string.Empty;

                // fill the students listview within the students panel with a list of students
                Drink_Service drinkService = new Drink_Service();
                List <Drink>  DrinkList    = drinkService.GetDrinks();

                ListViewStockPrint(Lst_Supplies, DrinkList);
                break;

            case "Activities":
                Dtp_Activities_TimePart.Format       = DateTimePickerFormat.Custom;
                Dtp_Activities_TimePart.CustomFormat = "hh:mm tt";
                Dtp_Activities_TimePart.ShowUpDown   = true;

                Txt_Activities_Id.Text          = "";
                Txt_Activities_Description.Text = "";
                Txt_Activities_Location.Text    = "";
                Txt_Activities_Name.Text        = "";
                Dtp_Activities_DatePart.Value   = DateTime.Today;
                Dtp_Activities_TimePart.Value   = DateTime.UtcNow;

                Activity_Service actServe     = new Activity_Service();
                List <Activity>  ActivityList = actServe.GetActivities();

                ListViewActivitiesPrint(Lst_Activities, ActivityList);
                break;

            case "CashRegister":
                FillRegistryStudents();
                FillRegistryDrinks();
                Btn_Register_Checkout.Enabled = false;
                break;

            case "RevRep":
                mcRev.MaxDate = DateTime.Today;
                PrintReport();
                break;

            case "Timetable":
                Timetable_Service timeServ      = new Timetable_Service();
                List <Timetable>  TimetableList = timeServ.GetTimetable();

                ListViewTimetablePrint(listViewTimetable, TimetableList);
                break;

            default:
                break;
            }
        }