private void getCheckedFeatures()
        {
            SQLQuery  sQLQuery = new SQLQuery();
            DataTable dt       = sQLQuery.getChildFeaturesByID(GlobalVariables.globalChild.id.ToString());

            foreach (DataRow dr in dt.Rows)
            {
                IsChecked.Add(Int32.Parse(dr[0].ToString()), 1);
            }
        }
        private void fillRoomID()
        {
            SQLQuery  mSql = new SQLQuery();
            DataTable dt   = mSql.getAllRooms();

            foreach (DataRow dr in dt.Rows)
            {
                roomID.Items.Add(dr[1].ToString());
                getRoomID.Add(int.Parse(dr[1].ToString()), int.Parse(dr[0].ToString()));
            }
        }
        private void signUpButton_Click(object sender, RoutedEventArgs e)
        {
            if (checkEnteredData())
            {
                SQLQuery mSQLQuery = new SQLQuery();
                Staff    staff     = new Staff(Convert.ToInt64(ID.Text), firstName.Text, lastName.Text, phoneNumber.Text, email.Text, -1, 1, "Staff", staffQualifications.Text);
                mSQLQuery.insertStaffData(staff, "Staff");

                mSQLQuery.insertUser(username.Text, password.Password, "Staff", staff.id);
                MessageBox.Show("Requset has been sent", "Request sent", MessageBoxButton.OK, MessageBoxImage.None);
            }
        }
        private void signUpButton_Click(object sender, RoutedEventArgs e)
        {
            SQLQuery        mSQLQuery = new SQLQuery();
            List <Features> featurs   = new List <Features>();

            featurs = checkedFeatures();
            if (childName.Text.Length >= 2 && DOBpicker.SelectedDate != null && featurs.Count > 0 && mainPic != false)
            {
                string gender;
                if (female.IsChecked == true)
                {
                    gender = "Female";
                }
                else
                {
                    gender = "Male";
                }

                ImageOperation OP = new ImageOperation();
                profileHeader.Source = profileImage.ImageSource;
                Child child = new Child(childName.Text, GlobalVariables.globalParent.firstName, GlobalVariables.globalParent.id, -1, gender, DOBpicker.SelectedDate.Value, OP.ImageToBinary(profileHeader), 1);
                mSQLQuery.insertChildData(child);



                int childID = mSQLQuery.getIDForChild(childName.Text, GlobalVariables.globalParent.id.ToString());

                foreach (var item in featurs)
                {
                    mSQLQuery.insertChildFeature(childID, FeatureToID[item.featureName]);
                }

                MessageBox.Show("Requset has been sent", "Request sent", MessageBoxButton.OK, MessageBoxImage.None);
                this.Close();
            }
            else if (featurs.Count == 0)
            {
                MessageBox.Show("Please Enter atleast one feature", "Invaild Data", MessageBoxButton.OK, MessageBoxImage.Error);
            }
            else if (mainPic == false)
            {
                MessageBox.Show("Please Enter child image", "Invaild Data", MessageBoxButton.OK, MessageBoxImage.Error);
            }
            else if (childName.Text.Length < 2)
            {
                MessageBox.Show("Please Enter at least 2 letter", "Invaild Child Name", MessageBoxButton.OK, MessageBoxImage.Error);
            }
            else
            {
                MessageBox.Show("Please enter the Date of Birth", "Missing DOB", MessageBoxButton.OK, MessageBoxImage.Error);
            }
        }
Beispiel #5
0
 private void submitFeatureButton_Click(object sender, RoutedEventArgs e)
 {
     if (featureTextBox.Text.Length == 0)
     {
         MessageBox.Show("Please enter a feature", "Faild to submit", MessageBoxButton.OK, MessageBoxImage.None);
     }
     else
     {
         SQLQuery mSQLQuery = new SQLQuery();
         mSQLQuery.insertFeature(featureTextBox.Text);
         MessageBox.Show("Feature added successfully!", "Submission done!", MessageBoxButton.OK, MessageBoxImage.None);
     }
 }
        public bool vaildDataForParent(string username, string email, string ID, string phoneNumber, string creditCard, int numberOfChildren, ref string headProblem, ref string problem)
        {
            SQLQuery mSQLQuery = new SQLQuery();

            if (username.Length == 0 || email.Length == 0 || ID.Length == 0 || phoneNumber.Length == 0 || creditCard.Length == 0)
            {
                headProblem = "Wrong in data";
                problem     = "Please continue your data";
                return(true);
            }
            else if (mSQLQuery.checkForUsername(username) == true)
            {
                headProblem = "Wrong Username or Password";
                problem     = "Username already exists";
                return(true);
            }
            else if (numberOfChildren == 0)
            {
                problem     = "Parent should have at least one Child";
                headProblem = "No Children";
                return(true);
            }
            else if (!checkMails(email))
            {
                problem     = "Please Enter correct email";
                headProblem = "Invaild email";
                return(true);
            }
            else if (!checkNationalID(ID))
            {
                problem     = "Please Enter correct ID";
                headProblem = "Invaild ID";
                return(true);
            }
            else if (!checkPhoneNum(phoneNumber))
            {
                problem     = "Please Enter correct Phone Number";
                headProblem = "Invaild Phone Number";
                return(true);
            }
            else if (!checkCreditCardt(creditCard))
            {
                problem     = "Please Enter correct Credit Card";
                headProblem = "Invaild Credit Card";
                return(true);
            }


            return(false);
        }
        private void OKButton_Click(object sender, RoutedEventArgs e)
        {
            SQLQuery mSqlQuery = new SQLQuery();

            if (checkSalary() && roomID.SelectedIndex > -1)
            {
                int numOFRoom = int.Parse(roomID.Text.ToString());
                mSqlQuery.updateRoomData(new Room(getRoomID[numOFRoom], numOFRoom, Int64.Parse(ID.Text)));
                mSqlQuery.updateStaffData(GlobalVariables.globalStaff);
            }
            else
            {
                MessageBox.Show("Please Enter the Room number", "Invaild Data", MessageBoxButton.OK, MessageBoxImage.Error);
            }
        }
Beispiel #8
0
        private void deleteFeedback_Click(object sender, RoutedEventArgs e)
        {
            if (feedback.Count != 0 && feedbackIdx != -1)
            {
                SQLQuery mSQLQuery = new SQLQuery();
                int      id        = feedback.ElementAt(feedbackIdx).Item1.Item1;

                mSQLQuery.deleteParentFeedback(id);
                parentNameLabel.Content = "";
                feedbackText.Text       = "";

                feedback.Remove(feedback.ElementAt(feedbackIdx));
                feedbackIdx--;
            }
        }
Beispiel #9
0
        private void pendingRequests_Click(object sender, RoutedEventArgs e)
        {
            staffs.Children.Clear();
            parents.Children.Clear();
            children.Children.Clear();

            childRow.Clear();
            parentRow.Clear();
            staffRow.Clear();

            SQLQuery mSQLQuery = new SQLQuery();

            childList  = mSQLQuery.childToLinkedList(mSQLQuery.getPendingChild());
            parentList = mSQLQuery.parentToLinkedList(mSQLQuery.getPendingParent());
            staffList  = mSQLQuery.staffToLinkedList(mSQLQuery.getPendingStaff());

            LinkedList <Child> notPending = new LinkedList <Child>();

            foreach (Child c in childList)
            {
                DataTable dt = mSQLQuery.getParentByID(c.parentID);
                if (Convert.ToInt32(dt.Rows[0]["parentIsPending"]) == 1)
                {
                    notPending.AddLast(c);
                }
                else
                {
                    c.lastName = dt.Rows[0]["parentFirstName"].ToString();
                }
            }

            foreach (Child c in notPending)
            {
                childList.Remove(c);
            }

            showPendingStaff(staffs);
            showPendingChildren(children);
            showPendingParent(parents);

            this.pendingRequestsPanel.Visibility = Visibility.Visible;
            this.profilePanel.Visibility         = Visibility.Hidden;
            this.AdminFeedback.Visibility        = Visibility.Hidden;
            this.editDatabasePanel.Visibility    = Visibility.Hidden;
            roomPanel.Visibility          = Visibility.Hidden;
            this.featuresPanel.Visibility = Visibility.Hidden;
        }
Beispiel #10
0
        private void signUpButton_Click(object sender, RoutedEventArgs e)
        {
            if (checkEnteredData())
            {
                GlobalVariables.globalParent.creditCard = creditCard.Text;

                SQLQuery mSQLQuery = new SQLQuery();
                mSQLQuery.insertParentData(GlobalVariables.globalParent);
                mSQLQuery.insertUser(username.Text, password.Password, "Parent", GlobalVariables.globalParent.id);

                MessageBox.Show("Thank you! Your data for  request is being processed ", "Request sent", MessageBoxButton.OK, MessageBoxImage.None);
            }
            else
            {
                MessageBox.Show("check your data", "faild to register", MessageBoxButton.OK, MessageBoxImage.None);
            }
        }
Beispiel #11
0
        private void signUpButton_Click(object sender, RoutedEventArgs e)
        {
            if (checkEnteredData(false))
            {
                GlobalVariables.globalParent = new Parent(Convert.ToInt64(ID.Text), firstName.Text, lastName.Text, phoneNumber.Text, email.Text
                                                          , address.Text, creditCard.Text, 1);

                SQLQuery mSQLQuery = new SQLQuery();
                mSQLQuery.insertParentData(GlobalVariables.globalParent);
                mSQLQuery.insertUser(username.Text, password.Password, "Parent", GlobalVariables.globalParent.id);
                signedUp = true;
                MessageBox.Show("Thank you! Your data for  request is being processed ", "Request sent", MessageBoxButton.OK, MessageBoxImage.None);
            }
            else
            {
                MessageBox.Show("check your data", "faild to register", MessageBoxButton.OK, MessageBoxImage.None);
            }
        }
Beispiel #12
0
        private void editProfileButton_Click(object sender, RoutedEventArgs e)
        {
            SQLQuery mSQLQuery = new SQLQuery();

            if (checkEnteredData())
            {
                GlobalVariables.globalStaff.id        = Convert.ToInt64(ID.Text);
                GlobalVariables.globalStaff.firstName = firstName.Text;
                GlobalVariables.globalStaff.lastName  = lastName.Text;

                mSQLQuery.updateUsername(Convert.ToInt64(ID.Text), "Staff", username.Text, password.Password);

                GlobalVariables.globalStaff.email       = email.Text;
                GlobalVariables.globalStaff.phoneNumber = phoneNumber.Text;

                mSQLQuery.updateStaffData(GlobalVariables.globalStaff);
                MessageBox.Show("Data Updated sucessfuly !", "Process Finshed", MessageBoxButton.OK, MessageBoxImage.Information);
            }
        }
        private void editProfileButton_Click(object sender, RoutedEventArgs e)
        {
            SQLQuery mSQLQuery = new SQLQuery();


            if (childName.Text.Length >= 2 && DOBpicker.SelectedDate != null)
            {
                string gender;
                if (female.IsChecked == true)
                {
                    gender = "Female";
                }
                else
                {
                    gender = "Male";
                }


                mSQLQuery.deleteChildFeature((int)GlobalVariables.globalChild.id);
                GlobalVariables.globalChild.DOB       = DOBpicker.SelectedDate.Value;
                GlobalVariables.globalChild.firstName = childName.Text;
                GlobalVariables.globalChild.lastName  = GlobalVariables.globalParent.firstName;
                GlobalVariables.globalChild.gender    = gender;

                List <Features> featurs = new List <Features>();

                featurs = checkedFeatures();
                foreach (var item in featurs)
                {
                    mSQLQuery.insertChildFeature((int)GlobalVariables.globalChild.id, FeatureToID[item.featureName]);
                }
                mSQLQuery.updateChildData(GlobalVariables.globalChild);
                MessageBox.Show("Updated", "Updated successfully ", MessageBoxButton.OK, MessageBoxImage.None);
            }
            else if (childName.Text.Length < 2)
            {
                MessageBox.Show("Please Enter at least 2 letter", "Invaild Child Name", MessageBoxButton.OK, MessageBoxImage.Error);
            }
            else
            {
                MessageBox.Show("Please enter the Date of Birth", "Missing DOB", MessageBoxButton.OK, MessageBoxImage.Error);
            }
        }
Beispiel #14
0
        private void loginButton_Click(object sender, RoutedEventArgs e)
        {
            SQLQuery mSqlQuery = new SQLQuery();

            if (!mSqlQuery.checkForUsername(username.Text))
            {
                usernameError.Visibility = Visibility.Visible;
                passwordError.Visibility = Visibility.Visible;
            }
            else if (!mSqlQuery.serachForUser(username.Text, password.Password))
            {
                usernameError.Visibility = Visibility.Hidden;
                passwordError.Visibility = Visibility.Visible;
            }
            else
            {
                usernameError.Visibility = Visibility.Hidden;
                passwordError.Visibility = Visibility.Hidden;

                if (GlobalVariables.globalType.Equals("Staff"))
                {
                    //open staff form

                    staffWindow mStaffWindow = new staffWindow();

                    mStaffWindow.Show();
                }
                else if (GlobalVariables.globalType.Equals("Admin"))
                {
                    //open admin form

                    adminWindow adminForm = new adminWindow();
                    adminForm.Show();
                }
                else if (GlobalVariables.globalType.Equals("Parent"))
                {
                    //open parent form
                    parentWindow mParentWindow = new parentWindow();
                    mParentWindow.Show();
                }
                this.Close();
            }
        }
Beispiel #15
0
        private void loginButton_Click(object sender, RoutedEventArgs e)
        {
            SQLQuery mSqlQuery = new SQLQuery();

            if (mSqlQuery.checkForUsername(username.Text) == false)
            {
                usernameError.Visibility = Visibility.Visible;
                passwordError.Visibility = Visibility.Visible;
            }
            else if (!mSqlQuery.serachForUser(username.Text, password.Password) == false)
            {
                usernameError.Visibility = Visibility.Hidden;
                passwordError.Visibility = Visibility.Visible;
            }
            else
            {
                usernameError.Visibility = Visibility.Hidden;
                passwordError.Visibility = Visibility.Hidden;

                MessageBox.Show("Hello, " + username.Text + "!", "Logged In Successfully", MessageBoxButton.OK, MessageBoxImage.None);

                if (GlobalVariables.globalType.Equals("Staff"))
                {
                    //open staff form
                    staffWindow mStaffWindow = new staffWindow();
                    mStaffWindow.Show();
                }
                else if (GlobalVariables.globalType.Equals("Admin"))
                {
                    //open admin form
                    adminWindow adminForm = new adminWindow();
                    adminForm.Show();
                }
                else if (GlobalVariables.globalType.Equals("Parent"))
                {
                    //open parent form
                    parentWindow mParentWindow = new parentWindow();
                    mParentWindow.Show();
                }
                this.Close();
            }
        }
Beispiel #16
0
        private void staffFeedbackButton_Click(object sender, RoutedEventArgs e)
        {
            SQLQuery mSQLQuery = new SQLQuery();

            feedback = new LinkedList <Tuple <Tuple <int, string>, string> >();

            feedback = mSQLQuery.getAllParentFeedback();

            if (feedback.Count != 0)
            {
                feedbackIdx = 0;
                showFeedBack();
            }

            //hide all other windows
            this.profile.Visibility       = Visibility.Hidden;
            this.feedbackPanel.Visibility = Visibility.Visible;
            //show room grid
            this.room.Visibility = Visibility.Hidden;
        }
        public void addFeaturesToList()
        {
            FeatureToID.Clear();
            List <Features> list     = new List <Features>();
            SQLQuery        sQLQuery = new SQLQuery();
            DataTable       allFeatures;

            allFeatures = sQLQuery.allFeatures();

            foreach (DataRow dr in allFeatures.Rows)
            {
                Features ft = new Features(dr[1].ToString());

                FeatureToID.Add(dr[1].ToString(), Int32.Parse(dr[0].ToString()));
                list.Add(ft);
            }

            childFeaturesList.ItemsSource   = list;
            childFeaturesList.SelectionMode = SelectionMode.Multiple;
        }
Beispiel #18
0
        private void submitRoomButton_Click(object sender, RoutedEventArgs e)
        {
            //check for empty entries
            if (roomNumberTextBox.Text.Length == 0)
            {
                MessageBox.Show("Please enter a room number", "Faild to submit", MessageBoxButton.OK, MessageBoxImage.None);
            }
            if (roomStaffIDTextBox.Text.Length == 0)
            {
                MessageBox.Show("Please enter staff id", "Faild to submit", MessageBoxButton.OK, MessageBoxImage.None);
            }
            else
            {
                SQLQuery  mSQLQuery = new SQLQuery();
                bool      canEnter  = true;
                Room      mRoom;
                DataTable dtStaffID = mSQLQuery.getStaffByID(Convert.ToInt64(roomStaffIDTextBox.Text));
                DataTable dtRoomNo  = mSQLQuery.getRoomByNumber(Convert.ToInt32(roomNumberTextBox.Text));
                //check for room number entry
                if (dtRoomNo.Rows.Count != 0)
                {
                    MessageBox.Show("Room number already exists!", "Faild to submit", MessageBoxButton.OK, MessageBoxImage.None);
                    canEnter = false;
                }
                dtRoomNo = mSQLQuery.getRoomByStaffID(Convert.ToInt64(roomStaffIDTextBox.Text));
                //check for staff id entry
                if (dtStaffID.Rows.Count == 0 || Convert.ToInt32(dtStaffID.Rows[0]["staffIsPending"]) == 1 ||
                    dtRoomNo.Rows.Count != 0)
                {
                    MessageBox.Show("Staff ID doesn't exist!", "Faild to submit", MessageBoxButton.OK, MessageBoxImage.None);
                    canEnter = false;
                }

                if (canEnter)
                {
                    mRoom = new Room(-1, Convert.ToInt32(roomNumberTextBox.Text), Convert.ToInt64(roomStaffIDTextBox.Text));
                    mSQLQuery.insertRoomData(mRoom);
                    MessageBox.Show("Room added successfully!", "Submission Done!", MessageBoxButton.OK, MessageBoxImage.None);
                }
            }
        }
Beispiel #19
0
        private void adminFeedbackButton_Click(object sender, RoutedEventArgs e)
        {
            SQLQuery mSQLQuery = new SQLQuery();

            feedback = new LinkedList <Tuple <Tuple <int, string>, string> >();

            feedback = mSQLQuery.getAllParentFeedback();

            if (feedback.Count != 0)
            {
                feedbackIdx = 0;
                showFeedBack();
            }

            this.AdminFeedback.Visibility        = Visibility.Visible;
            this.profilePanel.Visibility         = Visibility.Hidden;
            this.pendingRequestsPanel.Visibility = Visibility.Hidden;
            this.editDatabasePanel.Visibility    = Visibility.Hidden;
            this.featuresPanel.Visibility        = Visibility.Hidden;
            roomPanel.Visibility = Visibility.Hidden;
        }
Beispiel #20
0
        private void roomButton_Click(object sender, RoutedEventArgs e)
        {
            //hide all other windows
            SQLQuery mSQLQuery = new SQLQuery();

            mRoom = mSQLQuery.roomToLinkedList(mSQLQuery.getRoomByStaffID(GlobalVariables.globalStaff.id)).ElementAt(0);

            roomName.Content = "Room" + "  " + Convert.ToString(mRoom.number);

            childRow.Clear();
            children.Children.Clear();

            childList = mSQLQuery.childToLinkedList(mSQLQuery.getChildByRoomID(mRoom.id));

            showPendingChildren();

            this.profile.Visibility       = Visibility.Hidden;
            this.feedbackPanel.Visibility = Visibility.Hidden;
            //show room grid
            this.room.Visibility = Visibility.Visible;
        }
        public void fillSdata()
        {
            SQLQuery mSQLQuery = new SQLQuery();


            firstName.Text = GlobalVariables.globalStaff.firstName;
            lastName.Text  = GlobalVariables.globalStaff.lastName;

            DataTable dt = mSQLQuery.selectUsernameByIDAndType(Convert.ToInt64(GlobalVariables.globalStaff.id), "Staff");

            username.Text     = dt.Rows[0]["userName"].ToString();
            password.Password = dt.Rows[0]["userPassword"].ToString();

            email.Text               = GlobalVariables.globalStaff.email;
            phoneNumber.Text         = GlobalVariables.globalStaff.phoneNumber;
            ID.Text                  = (GlobalVariables.globalStaff.id).ToString();
            staffQualifications.Text = GlobalVariables.globalStaff.qualification;


            signUpButton.Visibility  = Visibility.Hidden;
            signup_elipse.Visibility = Visibility.Hidden;
        }
Beispiel #22
0
        private void adminProfileButton_Click(object sender, RoutedEventArgs e)
        {
            SQLQuery  mSqlquery = new SQLQuery();
            DataTable dt        = new DataTable();

            dt                = mSqlquery.selectUsernameByIDAndType(GlobalVariables.globalAdmin.id, "Admin");
            username.Text     = dt.Rows[0]["userName"].ToString();
            password.Password = dt.Rows[0]["userPassword"].ToString();

            firstName.Text                    = GlobalVariables.globalAdmin.firstName;
            lastName.Text                     = GlobalVariables.globalAdmin.lastName;
            email.Text                        = GlobalVariables.globalAdmin.email;
            phoneNumber.Text                  = GlobalVariables.globalAdmin.phoneNumber;
            ID.Text                           = (GlobalVariables.globalAdmin.id).ToString();
            currentUserName                   = username.Text;
            roomPanel.Visibility              = Visibility.Hidden;
            this.profilePanel.Visibility      = Visibility.Visible;
            AdminFeedback.Visibility          = Visibility.Hidden;
            pendingRequestsPanel.Visibility   = Visibility.Hidden;
            this.editDatabasePanel.Visibility = Visibility.Hidden;
            featuresPanel.Visibility          = Visibility.Hidden;
        }
Beispiel #23
0
        public void fillPdata1()
        {
            addChildButton.Visibility   = Visibility.Hidden;
            addChild_elipse_.Visibility = Visibility.Hidden;
            childrenListView.Visibility = Visibility.Hidden;
            signUpButton.Visibility     = Visibility.Hidden;
            ellipse_sign.Visibility     = Visibility.Hidden;
            OKButton.Visibility         = Visibility.Visible;

            firstName.Text   = GlobalVariables.globalParent.firstName;
            lastName.Text    = GlobalVariables.globalParent.lastName;
            email.Text       = GlobalVariables.globalParent.email;
            ID.Text          = GlobalVariables.globalParent.id.ToString();
            phoneNumber.Text = GlobalVariables.globalParent.phoneNumber;
            address.Text     = GlobalVariables.globalParent.address;
            SQLQuery  mSqlquery   = new SQLQuery();
            DataTable userAndPass = mSqlquery.selectUsernameByIDAndType(Convert.ToInt64(GlobalVariables.globalParent.id), "Parent");

            username.Text     = (userAndPass.Rows[0]["userName"].ToString());
            password.Password = userAndPass.Rows[0]["userPassword"].ToString();
            creditCard.Text   = GlobalVariables.globalParent.creditCard;
        }
Beispiel #24
0
        private void OKButton_Click(object sender, RoutedEventArgs e)
        {
            SQLQuery mSqlQuery = new SQLQuery();

            if (checkEnteredData(true))
            {
                GlobalVariables.globalParent.firstName   = firstName.Text;
                GlobalVariables.globalParent.lastName    = lastName.Text;
                GlobalVariables.globalParent.email       = email.Text;
                GlobalVariables.globalParent.id          = Convert.ToInt64(ID.Text);
                GlobalVariables.globalParent.phoneNumber = phoneNumber.Text;
                GlobalVariables.globalParent.address     = address.Text;

                mSqlQuery.updateParentData(GlobalVariables.globalParent);
                mSqlQuery.updateUsername(GlobalVariables.globalParent.id, "Parent", username.Text, password.Password);
                MessageBox.Show("Updated", "Successfully Updated", MessageBoxButton.OK);
            }
            else
            {
                MessageBox.Show("Check your data", "Update failed", MessageBoxButton.OK, MessageBoxImage.Error);
            }
        }
Beispiel #25
0
        public bool checkEnteredData()
        {
            bool         ans       = true;
            ValidateData validator = new ValidateData();
            SQLQuery     mSql      = new SQLQuery();

            if (!validator.checkCreditCardt(creditCard.Text))
            {
                ans = false;
                creditError.Visibility = Visibility.Visible;
            }
            else
            {
                creditError.Visibility = Visibility.Hidden;
            }

            if (mSql.checkForUsername(username.Text) || username.Text.Equals("Enter username Here"))
            {
                ans = false;
                usernameError.Visibility = Visibility.Visible;
            }
            else
            {
                usernameError.Visibility = Visibility.Hidden;
            }

            if (!validator.verifyField(password.Password))
            {
                ans = false;
                passwordError.Visibility = Visibility.Visible;
            }
            else
            {
                passwordError.Visibility = Visibility.Hidden;
            }

            return(ans);
        }
Beispiel #26
0
        private void staffProfileButton_Click(object sender, RoutedEventArgs e)
        {
            //fill textbox with data
            SQLQuery mSQLQuery = new SQLQuery();

            firstName.Text = GlobalVariables.globalStaff.firstName;
            lastName.Text  = GlobalVariables.globalStaff.lastName;
            DataTable dt = mSQLQuery.selectUsernameByIDAndType(Convert.ToInt64(GlobalVariables.globalStaff.id), "Staff");

            username.Text     = dt.Rows[0]["userName"].ToString();
            password.Password = dt.Rows[0]["userPassword"].ToString();
            currentUserName   = username.Text;
            email.Text        = GlobalVariables.globalStaff.email;
            phoneNumber.Text  = GlobalVariables.globalStaff.phoneNumber;
            ID.Text           = (GlobalVariables.globalStaff.id).ToString();

            //hide all other windows
            //hide all other windows
            this.profile.Visibility       = Visibility.Visible;
            this.feedbackPanel.Visibility = Visibility.Hidden;
            //show room grid
            this.room.Visibility = Visibility.Hidden;
        }
        public bool vaildDataForStaff(string firstName, string email, string ID, string phoneNumber, ref string headProblem, ref string problem)
        {
            SQLQuery mSQLQuery = new SQLQuery();

            if (firstName.Length == 0 || email.Length == 0 || ID.Length == 0 || phoneNumber.Length == 0)
            {
                headProblem = "Wrong in data";
                problem     = "Please continue your data";
                return(true);
            }
            else if (mSQLQuery.checkForUsername(firstName) == true)
            {
                headProblem = "Wrong Username or Password";
                problem     = "Username already exists";
                return(true);
            }
            else if (!checkMails(email))
            {
                problem     = "Please Enter correct email";
                headProblem = "Invaild email";
                return(true);
            }
            else if (!checkNationalID(ID))
            {
                problem     = "Please Enter correct ID";
                headProblem = "Invaild ID";
                return(true);
            }
            else if (!checkPhoneNum(phoneNumber))
            {
                problem     = "Please Enter correct Phone Number";
                headProblem = "Invaild Phone Number";
                return(true);
            }

            return(false);
        }
Beispiel #28
0
        private void acceptButton_Click(object sender, RoutedEventArgs e)
        {
            //set pending to 0 ---> accepted
            SQLQuery mSQLQuery = new SQLQuery();

            if (idx == 0)
            {
                mChild.pending = 0;
                mSQLQuery.updateChildData(mChild);
            }
            else if (idx == 1)
            {
                mParent.pending = 0;
                mSQLQuery.updateParentData(mParent);
            }
            else if (idx == 2)
            {
                mStaff.pending = 0;
                mSQLQuery.updateStaffData(mStaff);
            }


            removeFromParent();
        }
        private void submitFeedback_Click(object sender, RoutedEventArgs e)
        {
            SQLQuery mSQLQuery = new SQLQuery();

            mSQLQuery.insertParentFeedback(GlobalVariables.globalParent.id, feedbackText.Text);
        }
Beispiel #30
0
        public bool checkEnteredData()
        {
            bool         ans       = true;
            ValidateData validator = new ValidateData();
            SQLQuery     mSql      = new SQLQuery();

            if (!validator.verifyField(firstName.Text) || firstName.Text.Equals("Enter First Name Here"))
            {
                ans = false;
                MessageBox.Show("Please Correct Your First Name !", "Error Occur", MessageBoxButton.OK, MessageBoxImage.Hand);
                firstNameError.Visibility = Visibility.Visible;
            }
            else
            {
                firstNameError.Visibility = Visibility.Hidden;
            }

            if (!validator.verifyField(lastName.Text) || lastName.Text.Equals("Enter Last Name Here"))
            {
                ans = false;
                MessageBox.Show("Please Correct Your Last Name !", "Error Occur", MessageBoxButton.OK, MessageBoxImage.Hand);
                lastNameError.Visibility = Visibility.Visible;
            }
            else
            {
                lastNameError.Visibility = Visibility.Hidden;
            }

            if (!validator.checkNationalID(ID.Text))
            {
                ans = false;
                MessageBox.Show("Please Correct Your ID !", "Error Occur", MessageBoxButton.OK, MessageBoxImage.Hand);
                IDError.Visibility = Visibility.Visible;
            }
            else
            {
                IDError.Visibility = Visibility.Hidden;
            }

            if (!validator.checkMails(email.Text))
            {
                ans = false;
                MessageBox.Show("Please Correct Your Email !", "Error Occur", MessageBoxButton.OK, MessageBoxImage.Hand);
                emailError.Visibility = Visibility.Visible;
            }
            else
            {
                emailError.Visibility = Visibility.Hidden;
            }

            if (!validator.checkPhoneNum(phoneNumber.Text))
            {
                ans = false;
                MessageBox.Show("Please Correct Your Phone Number !", "Error Occur", MessageBoxButton.OK, MessageBoxImage.Hand);
                phoneError.Visibility = Visibility.Visible;
            }
            else
            {
                phoneError.Visibility = Visibility.Hidden;
            }

            if ((mSql.checkForUsername(username.Text) && currentUserName != username.Text))
            {
                ans = false;
                MessageBox.Show("Please Correct Your UserName !", "Error Occur", MessageBoxButton.OK, MessageBoxImage.Hand);

                usernameError.Visibility = Visibility.Visible;
            }
            else
            {
                usernameError.Visibility = Visibility.Hidden;
            }

            if (!validator.verifyField(password.Password))
            {
                ans = false;
                MessageBox.Show("Please Correct Your Password !", "Error Occur", MessageBoxButton.OK, MessageBoxImage.Hand);

                passwordError.Visibility = Visibility.Visible;
            }
            else
            {
                passwordError.Visibility = Visibility.Hidden;
            }

            return(ans);
        }