public void facebook()
        {
            Application.EnableVisualStyles();
            g = new GetTheMail();
            string mail = g.getMail();

            if (dataBaseOperations.facebookUserExist(mail, "Professor"))
            {
                //In perception i thing that its importent to pass
                //user object for the next managing form
                //plese do it in all other form
                ulong i = dataBaseOperations.getIdByMail(mail);
                //here i create new professor obj
                professor prof = new professor(dataBaseOperations.getIdByMail(mail));
                //and then i pass it to the next form
                //i'll catch it in the next form constractor
                teachingStaffMenu instrfMen = new teachingStaffMenu(prof);

                this.Hide();
                instrfMen.ShowDialog();
            }
            else
            {
                MessageBox.Show("the user not exist");
            }
            g.logout();
        }
        private void button1_Click(object sender, EventArgs e)
        {
            //instance of data base managment;
            dataBaseOperations check_user_instance = new dataBaseOperations();
            //instance of cheking class;
            publicChecksAndOperations check_id_if_numeric = new publicChecksAndOperations();

            if (check_id_if_numeric.isNumericUlong(textBox1.Text))
            {
                //turn the string into int;
                ulong id = Convert.ToUInt32(textBox1.Text, 10);

                try
                {
                    //check if user exist in the system;
                    if (check_user_instance.userExist(textBox2.Text, id, "Professor"))
                    {
                        //In perception i thing that its importent to pass
                        //user object for the next managing form
                        //plese do it in all other form

                        //here i create new prof obj
                        professor prof = new professor(id);
                        //and then i pass it to the next form
                        //i'll catch it in the next form constractor
                        teachingStaffMenu porfMen = new teachingStaffMenu(prof);

                        this.Hide();
                        porfMen.ShowDialog();
                    }
                    else
                    {
                        //if lable 3 pop in previous case;
                        label3.Hide();
                        MessageBox.Show("the username or password is incorrect");
                    }
                }
                catch
                {
                    //if lable 3 pop in previous case;
                    label3.Hide();
                    MessageBox.Show("there was a problam with the conection");
                }
            }
            else if (textBox1.Text == "")
            {
                //show allert and paint it;
                label3.Show();
                label3.Text      = "please enter values";
                label3.ForeColor = System.Drawing.Color.Red;
            }
            else
            {
                //show allert and paint it;
                label3.Show();
                label3.Text      = "*there are illegal values";
                label3.ForeColor = System.Drawing.Color.Red;
            }
        }
Beispiel #3
0
        public teachingStaffMenu(user someUser)
        {
            InitializeComponent();

            labelNoSched.Hide();
            //learn more about downcasting here http://stackoverflow.com/questions/1524197/downcast-and-upcast

            if (someUser is professor)
            {
                //make reperance to the object we get
                this.prof    = (professor)someUser;
                theUserWeGot = userType.Professor;
            }

            if (someUser is instructor)
            {
                //make reperance to the object we get
                this.inst    = (instructor)someUser;
                theUserWeGot = userType.Instructor;
            }

            //change this form size
            //see also: https://msdn.microsoft.com/en-us/library/ms229606(v=vs.110).aspx
            this.Size = new System.Drawing.Size(1000, 550);

            //set position in the center;
            //see also: https://msdn.microsoft.com/en-us/library/system.windows.forms.form.startposition(v=vs.110).aspx
            this.StartPosition = FormStartPosition.CenterScreen;

            //set the item in the combo boxes
            setComboBoxes();

            set_account_Management();

            //hide constraints panel;
            panel1.Hide();

            //build schedule if the schedule is published by the secretary
            if (new dataBaseOperations().getPublishedSched(someUser.getid()))
            {
                build_schedule(someUser);
            }
            else
            {
                labelNoSched.Show();
            }

            watch_your_constraints(null, null);
        }
Beispiel #4
0
        //build schedule to professor or instructor
        private void build_schedule(user someUser)
        {
            if (someUser is professor)
            {
                //make reperance to the object we get
                this.prof    = (professor)someUser;
                courses_List = this.prof.getCoursesList();
            }

            if (someUser is instructor)
            {
                //make reperance to the object we get
                this.inst    = (instructor)someUser;
                courses_List = this.inst.getCoursesList();
            }



            //build DataTable
            DataTable tempTable = new DataTable();

            tempTable.Columns.Add(" ", typeof(string));
            tempTable.Columns.Add("Sunday", typeof(string));
            tempTable.Columns.Add("Monday", typeof(string));
            tempTable.Columns.Add("Tuesday", typeof(string));
            tempTable.Columns.Add("Wednesday", typeof(string));
            tempTable.Columns.Add("Thursday", typeof(string));
            tempTable.Columns.Add("Friday", typeof(string));
            tempTable.Rows.Add("07:00", typeof(string));
            tempTable.Rows.Add("08:00", typeof(string));
            tempTable.Rows.Add("09:00", typeof(string));
            tempTable.Rows.Add("10:00", typeof(string));
            tempTable.Rows.Add("11:00", typeof(string));
            tempTable.Rows.Add("12:00", typeof(string));
            tempTable.Rows.Add("13:00", typeof(string));
            tempTable.Rows.Add("14:00", typeof(string));
            tempTable.Rows.Add("15:00", typeof(string));
            tempTable.Rows.Add("16:00", typeof(string));
            tempTable.Rows.Add("17:00", typeof(string));
            tempTable.Rows.Add("18:00", typeof(string));
            tempTable.Rows.Add("19:00", typeof(string));
            tempTable.Rows.Add("20:00", typeof(string));
            tempTable.Rows.Add("21:00", typeof(string));
            string day   = "";
            string start = "";
            string end   = "";
            string room  = "";

            //enter lectures to DataTable
            for (int i = 0; i < courses_List.Count; i++)
            {
                //get the attributes of the lecture from DB
                day   = dataOp.getAttrByName(courses_List[i], 5);
                start = dataOp.getAttrByName(courses_List[i], 6);
                end   = dataOp.getAttrByName(courses_List[i], 7);
                room  = dataOp.getAttrByName(courses_List[i], 4);
                //convert to location in DataTable
                int    location_x   = publicChecksAndOperations.convDayToInt(day);
                int    location_y_s = publicChecksAndOperations.hourConvertFromStringToInt(start);
                int    location_y_e = publicChecksAndOperations.hourConvertFromStringToInt(end);
                string name         = courses_List[i];
                if ((tempTable.Rows[location_y_s][location_x] != null && !tempTable.Rows[location_y_s][location_x].Equals("System.String") && !string.IsNullOrEmpty(tempTable.Rows[location_y_s][location_x].ToString())))
                {
                    tempTable.Rows[location_y_s][location_x] = "Collision courses!Contact the Secretary";
                }
                else
                {
                    tempTable.Rows[location_y_s][location_x] = courses_List[i] + " ( " + room + " )";
                }
                for (int j = location_y_s + 1; j <= (location_y_e); j++)
                {
                    if ((tempTable.Rows[j][location_x] != null && !tempTable.Rows[j][location_x].Equals("System.String") && !string.IsNullOrEmpty(tempTable.Rows[j][location_x].ToString())))
                    {
                        tempTable.Rows[j][location_x] = "Collision courses!Contact the Secretary";
                    }
                    else
                    {
                        tempTable.Rows[j][location_x] = name + " ( " + room + " )";
                    }
                }
            }
            //define empty value in cells which dont have lecture
            for (int i = 0; i < 15; i++)
            {
                for (int j = 1; j < 6; j++)
                {
                    if (tempTable.Rows[i][j] == null || tempTable.Rows[i][j].Equals("System.String") || string.IsNullOrEmpty(tempTable.Rows[i][j].ToString()))
                    {
                        tempTable.Rows[i][j] = " ";
                    }
                }
            }

            dataGridView2.DataSource        = tempTable;
            dataGridView2.RowHeadersVisible = false;
        }