Ejemplo n.º 1
0
        /*Florin
         * save the data for schedule
         */
        private void saveBtn_Click(object sender, RoutedEventArgs e)
        {
            TabForStaff myWindow = new TabForStaff();

            this.Close();
        }
Ejemplo n.º 2
0
        /*
         * when someone is logging in checks is the username and passowrd are correct
         * is looking for staff member's role
         * checks if the staff member has any email
         */
        private void btnLogin_Click(object sender, RoutedEventArgs e)
        { //Florin
            TabWindow           myTab         = new TabWindow();
            TabForStaff         myTabForStaff = new TabForStaff();
            int                 tempId        = -1;
            string              myMember      = "";
            string              tempCpr       = "";
            string              tempName      = "";
            List <IStaffMember> theStaffmeber = new List <IStaffMember>();
            List <IMessage>     myList        = new List <IMessage>();

            foreach (IStaffMember myStaffMember in myController.StaffMembers)

            {
                if (myStaffMember.Cpr == txtUserId.Text && myStaffMember.Password == passPassword.Password)
                {
                    myMember = myStaffMember.RoleType;
                    tempId   = myStaffMember.StaffMemeberId;
                    tempName = myStaffMember.StaffMemberName;
                    tempCpr  = myStaffMember.Cpr;
                }
                if (myStaffMember.Cpr != txtUserId.Text)
                {
                    theStaffmeber.Add(myStaffMember);
                }
            }
            //Majd
            foreach (IMessage myMessage in myController.Messages)
            {
                if (myMessage.StaffMemberId == tempId)
                {
                    myList.Add(myMessage);
                }
            }
            myTabWindow.listBoxStaffInfo.ItemsSource  = theStaffmeber;
            myTabForStaff.ListBoxRequests.ItemsSource = myList;
            myTabWindow.ListBoxRequests.ItemsSource   = myList;

            myTabForStaff.listBoxStaffInfo2.ItemsSource   = theStaffmeber;
            myTabForStaff.listBoxContactStaff.ItemsSource = theStaffmeber;
            myTabForStaff.dataGridContactInfo.ItemsSource = theStaffmeber;


            if (myMember == "Owner")
            {
                this.Close();
                myTabWindow.Show();
            }

            else if (myMember == "Employee" || myMember == "Leader" || myMember == "Schedule leader")
            {
                if (myMember != "Schedule leader")
                {
                    myTabForStaff.btnManageSchedule.Visibility = Visibility.Hidden;
                }

                this.Close();
                myTabForStaff.Show();
            }
            else
            {
                MessageBox.Show("Invalid user or password.Please try again.");
            }
        }