Ejemplo n.º 1
0
        private void changeMyPassbutton_Click(object sender, EventArgs e)
        {
            if (newPassConfirm.Text == "" || newPassChange.Text == "" || oldPassTextBox.Text == "")
            {
                MessageBox.Show("Error: Must fill all fields");
                return;
            }

            if (newPassChange.Text != newPassConfirm.Text)
            {
                MessageBox.Show("Error: Passwords doesn't match");
                return;
            }

            if (oldPassTextBox.Text != sec.getPassword())
            {
                MessageBox.Show("Error: Incorrect old password");
                return;
            }

            if (newPassChange.Text == oldPassTextBox.Text)
            {
                MessageBox.Show("Error: New password must be different than old password");
                return;
            }

            dataBaseOperations db = new dataBaseOperations();

            db.updateUserPassword(newPassChange.Text, sec.getid());
            MessageBox.Show("Password changed succesfully");
            oldPassTextBox.Text = "";
            newPassChange.Text  = "";
            newPassConfirm.Text = "";
            return;
        }
Ejemplo n.º 2
0
        public List <techingStaffConstraints> CreateConstraintList(ulong id)
        {
            List <techingStaffConstraints> constList = new List <techingStaffConstraints>();
            dataBaseOperations             db        = new dataBaseOperations();

            int[] cList = db.getConstraints(id);
            db.CloseConn(true);

            if (cList.Length > 1)
            {
                for (int i = 0; i < cList.Length; i += 4)
                {
                    constList.Add(new techingStaffConstraints(cList[i + 1], cList[i + 2], cList[i + 3]));
                }
            }

            return(constList);
        }
Ejemplo n.º 3
0
        public void createStaffList()
        {
            List <ulong> profID = dataBaseOperations.getProfessorIdList();
            List <ulong> instID = dataBaseOperations.getInstructorIdList();

            dataBaseOperations db = new dataBaseOperations();

            profList = new List <Staff>();
            instList = new List <Staff>();

            foreach (ulong id in profID)
            {
                profList.Add(new Staff(id, db.getUserNameById(id), db.getUserLastNameById(id), "Professor"));
            }

            foreach (ulong id in instID)
            {
                instList.Add(new Staff(id, db.getUserNameById(id), db.getUserLastNameById(id), "Instructor"));
            }
        }
Ejemplo n.º 4
0
        public void buildSchedule(string type)
        {
            ulong              id;
            List <string>      courseList;
            dataBaseOperations dataOp = new dataBaseOperations();

            if (type == "Professor")
            {
                id = UInt64.Parse(comboBoxProfList.Text.Split()[comboBoxProfList.Text.Split().Length - 1]);
                professor prof = new professor(id);
                courseList = prof.getCoursesList();
            }
            else
            {
                id = UInt64.Parse(comboBoxInstList.Text.Split()[comboBoxInstList.Text.Split().Length - 1]);
                instructor inst = new instructor(id);
                courseList = 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 < courseList.Count; i++)
            {
                //get the attributes of the lecture from DB
                day   = dataOp.getAttrByName(courseList[i], 5);
                start = dataOp.getAttrByName(courseList[i], 6);
                end   = dataOp.getAttrByName(courseList[i], 7);
                room  = dataOp.getAttrByName(courseList[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         = courseList[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] = courseList[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] = " ";
                    }
                }
            }

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