示例#1
0
        private void editDatabase_Click(object sender, EventArgs e)
        {
            this.Hide();
            SQLQuery mSQLQuery = new SQLQuery();

            Program.editDataBaseForm.staffTable.DataSource    = mSQLQuery.getAllStaff();
            Program.editDataBaseForm.parentsTable.DataSource  = mSQLQuery.getAllParent();
            Program.editDataBaseForm.childrenTable.DataSource = mSQLQuery.getAllChildren();
            Program.editDataBaseForm.roomsTable.DataSource    = mSQLQuery.getAllRooms();

            Program.editDataBaseForm.Show();
        }
示例#2
0
        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);
        }
示例#3
0
        private void addChildButton_Click(object sender, EventArgs e)
        {
            SQLQuery     mSQLQuery = new SQLQuery();
            ValidateData vaild = new ValidateData();
            string       headProblemOfData = "", promblemInData = "";

            if (vaild.vaildDataForParent(username.Text, email.Text, ID.Text, phoneNumber.Text, creditCard.Text, ref headProblemOfData, ref promblemInData))
            {
                MessageBox.Show(promblemInData, headProblemOfData, MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            else
            {
                Program.childSignUpForm.Show();
                Program.childSignUpForm.enableEditing("parentSignUp");
            }
        }
        private void saveButton_Click(object sender, EventArgs e)
        {
            SQLQuery mSQLQuery = new SQLQuery();

            if (childName.Text.Length >= 2)
            {
                Child child = new Child(childName.Text, Program.globalParent.firstName, Program.globalParent.id, -1, Gender, DOBpicker.Value, location, Program.globalParent.pending);
                mSQLQuery.insertChildData(child);

                MessageBox.Show("Requset has been sent", "Request sent", MessageBoxButtons.OK, MessageBoxIcon.None);
            }
            else
            {
                MessageBox.Show("Please Enter atleast 2 letter", "Invaild Child Name", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
        private void saveButton_Click(object sender, EventArgs e)
        {
            SQLQuery mSQLQuery = new SQLQuery();

            if (childName.Text.Length >= 2)
            {
                ImageOperation OP = new ImageOperation();
                Program.parentSignUpForm.ChildOfParent(childName.Text, DOBpicker.Value, Gender, OP.ImageToBinary(image));

                MessageBox.Show("Requset has been sent", "Request sent", MessageBoxButtons.OK, MessageBoxIcon.None);
                this.Hide();
            }
            else
            {
                MessageBox.Show("Please Enter atleast 2 letter", "Invaild Child Name", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
示例#6
0
        private void signUpButton_Click(object sender, EventArgs e)
        {
            SQLQuery     mSQLQuery = new SQLQuery();
            ValidateData vaild = new ValidateData();
            string       headProblemOfData = "", promblemInData = "";

            if (vaild.vaildDataForStaff(firstName.Text, email.Text, ID.Text, phoneNumber.Text, ref headProblemOfData, ref promblemInData))
            {
                MessageBox.Show(promblemInData, headProblemOfData, MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            else
            {
                Staff staff = new Staff(Convert.ToInt64(ID.Text), firstName.Text, lastName.Text, phoneNumber.Text, email.Text, -1, 1, "Staff");
                mSQLQuery.insertStaffData(staff, "Staff");

                mSQLQuery.insertUser(username.Text, password.Text, "Staff", staff.id);
                MessageBox.Show("Requset has been sent", "Request sent", MessageBoxButtons.OK, MessageBoxIcon.None);
            }
        }
示例#7
0
        private void signUpButton_Click(object sender, EventArgs e)
        {
            SQLQuery     mSQLQuery = new SQLQuery();
            ValidateData vaild = new ValidateData();
            int          numberOfChildren = mSQLQuery.childToLinkedList(mSQLQuery.getChildByParentID(Convert.ToInt64(ID.Text))).Count;
            string       headProblemOfData = "", promblemInData = "";

            if (vaild.vaildDataForParent(firstName.Text, email.Text, ID.Text, phoneNumber.Text, creditCard.Text, numberOfChildren, ref headProblemOfData, ref promblemInData))
            {
                MessageBox.Show(promblemInData, headProblemOfData, MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            else
            {
                Parent parent = new Parent(Convert.ToInt64(ID.Text), firstName.Text, lastName.Text, phoneNumber.Text, email.Text, address.Text, creditCard.Text, 1);
                mSQLQuery.insertParentData(parent);

                Program.globalParent = parent;

                mSQLQuery.insertUser(username.Text, password.Text, "Parent", parent.id);
                MessageBox.Show("Requset has been sent", "Request sent", MessageBoxButtons.OK, MessageBoxIcon.None);
            }
        }
示例#8
0
        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);
        }
        public editDatabase()
        {
            InitializeComponent();

            SQLQuery mSQLQuery = new SQLQuery();
        }
示例#10
0
        private void viewGride()
        {
            DataTable pennding  = new DataTable();
            DataTable pennding2 = new DataTable();
            SQLQuery  MyQuery   = new SQLQuery();


            // staff pennding list veiw load
            pennding = MyQuery.getPendingStaff();
            foreach (DataRow row in pennding.Rows)
            {
                ListViewItem item = new ListViewItem(row[1].ToString());
                for (int i = 2; i <= 4; i++)
                {
                    item.SubItems.Add(row[i].ToString());
                }
                staffListView.Items.Add(item);
            }
            staffListView.View          = View.Details;
            staffListView.FullRowSelect = true;

            // parents pennding list veiw  laod
            pennding = MyQuery.getPendingParent();
            foreach (DataRow row in pennding.Rows)
            {
                ListViewItem item = new ListViewItem(row[1].ToString());

                item.SubItems.Add(row[2].ToString());
                item.SubItems.Add(row[4].ToString());
                item.SubItems.Add(row[6].ToString());

                parentsListView.Items.Add(item);
            }
            parentsListView.View          = View.Details;
            parentsListView.FullRowSelect = true;

            // Child Pending listview laod
            pennding = MyQuery.getPendingChild();

            foreach (DataRow row in pennding.Rows)
            {
                ListViewItem item = new ListViewItem(row[0].ToString());

                item.SubItems.Add(row[1].ToString());
                Int64 x = Int64.Parse(row[2].ToString());
                pennding2 = MyQuery.getParentByID(x);
                string parentName = "";
                foreach (DataRow row2 in pennding2.Rows)
                {
                    parentName = row[1].ToString();
                }
                item.SubItems.Add(parentName);
                ImageOperation OP       = new ImageOperation();
                byte[]         location = (byte[])(row[7]);
                Image          img      = OP.BinaryToImage(location);
                childImageList.Images.Add(row[0].ToString(), img);
                childImage.Image = img;
                childListView.Items.Add(item);
            }
            childListView.View          = View.Details;
            childListView.FullRowSelect = true;
        }