private void AdvancedRequest_FormClosed(object sender, FormClosedEventArgs e)
        {
            StudentMain g = new StudentMain(ACCID);

            g.Show();
            this.Dispose();
        }
        private void btnExit_Click(object sender, EventArgs e)
        {
            StudentMain g = new StudentMain(ACCID);

            g.Show();
            this.Dispose();
        }
Example #3
0
        public ActionResult Delete(Student student)
        {
            StudentMain SM = new StudentMain();

            SM.DeleteStudent(student);
            return(RedirectToAction("AllStudentList"));
        }
Example #4
0
        private void StndtLoginBtn_Click(object sender, EventArgs e)
        {
            // Personel Nesnesi Üreterek gerekli atamaları yapıyoruz
            // Önce Mantıksal Katmanda gelen veriler doğru formatta gelmiş mi kontrol etmek üzere logic katmana gönderiyoruz
            EntityStudent student = new EntityStudent();

            student.StudentUserName = TxtStudentUserName.Text;
            student.Password        = TxtStudentPassword1.Text;
            student.Repassword      = TxtStudentPassword2.Text;
            if (TxtStudentPassword1.Text == TxtStudentPassword2.Text)
            {
                if (LogicStudent.LLStudentLogIn(student))
                {
                    StudentMain studentMainForm = new StudentMain(student);
                    studentMainForm.Show();
                }
                else
                {
                    MessageBox.Show("Böyle Bir Kullanıcı Yok Kayıt Olunuz ");
                }
            }
            else
            {
                MessageBox.Show("Şifreleriniz Uyuşmuyor Lütfen Kontrol Ediniz");
            }
        }
        //exit button
        private void btnExit_Click(object sender, EventArgs e)
        {
            StudentMain f = new StudentMain(id);

            f.Show();
            this.Dispose();
        }
Example #6
0
 private void btnSumbit_Click(object sender, EventArgs e)
 {
     if (string.IsNullOrWhiteSpace(txtLoc.Text))                                                                 //make sure the user has put in a location
     {
         MessageBox.Show("Please write a location you would like to propose for each of the selected sites");    //if not, ask them to
     }
     else if (txtLoc.Text.Contains('?'))                                                                         //make sure they didn't put a question mark
     {
         MessageBox.Show("Please do not put in any question marks into your proposed location");
     }
     else
     {
         setTutorLocations();                                                                                    //set the tutor commitment locations where necessary
         setTuteeLocations();                                                                                    //set the tutee commitment locations where necessary
         if (!admin)
         {
             MessageBox.Show("The location has been recorded. The appointment(s) must be accepted by the tutee before being finalized");
             StudentMain g = new StudentMain(id);                                                                    //send the student back to student main
             g.Show();
             this.Dispose();
         }
         else
         {
             MessageBox.Show("The location has been set and the appointment(s) have been finalized in both student's schedules");
             this.Dispose();
         }
     }
 }
Example #7
0
        private void barButtonItem1_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            StudentMain stuForm = StudentMain.GetStuForm();

            stuForm.MdiParent = this;
            stuForm.Show();
            stuForm.Activate();
        }
Example #8
0
 private void btnCancel_Click(object sender, EventArgs e)
 {
     if (!admin)
     {
         StudentMain g = new StudentMain(id);
         g.Show();
         this.Dispose();
     }
     else
     {
         this.Dispose();
     }
 }
Example #9
0
        public void ShowStudents()
        {
            var NewWindow = new StudentMain();

            NewWindow.Top    = Application.Current.MainWindow.Top;
            NewWindow.Left   = Application.Current.MainWindow.Left;
            NewWindow.Height = Application.Current.MainWindow.ActualHeight;
            NewWindow.Width  = Application.Current.MainWindow.ActualWidth;

            NewWindow.Show();
            Application.Current.MainWindow.Close();
            Application.Current.MainWindow = NewWindow;
        }
Example #10
0
        private void btnSignIn_Click(object sender, EventArgs e)
        {
            string username = txtUsername.Text;
            string password = txtPassword.Text;

            if (string.IsNullOrWhiteSpace(username) || string.IsNullOrWhiteSpace(password))             //make sure both fields are filled in
            {
                MessageBox.Show("Please enter in both a username and password.");
            }
            else if (isValidUser(username, password)) //checks to see if the account is valid
            {
                if (username.Contains('?'))           //usernames can't contain '?'
                {
                    lblErrMsg.Text = "Invalid Username or Password. Try again.";
                }
                else
                {
                    string accType = getAccType(username);
                    int    accID   = getID(username);
                    //lblErrMsg.Text = accType + accID.ToString();
                    switch (accType)
                    {
                    case "Student":
                        //send ID to student form
                        StudentMain a = new StudentMain(accID);
                        a.Show();
                        this.Hide();
                        break;

                    case "Faculty":
                        //send ID to faculty form
                        FacultyMain g = new FacultyMain(accID);

                        g.Show();
                        this.Hide();
                        break;

                    default:            //Admin account
                        //open admin form (shouldn't need ID?)
                        AdminMain f = new AdminMain();
                        f.Show();
                        this.Hide();
                        break;
                    }
                }
            }
            else
            {
                lblErrMsg.Text = "Invalid Username or Password. Try again.";
            }
        }
        private void btnRemove_Click(object sender, EventArgs e)
        {
            DialogResult sureDelete = MessageBox.Show("Are you sure you want to delete all of the selected timeslots?", "Deletion confirmation", MessageBoxButtons.YesNo);

            if (sureDelete == DialogResult.Yes)
            {
                bool weeklyChoice = checkChecked();
                setPreviousWeekliesToFalse();                                //set the previous weeklies to false
                if (weeklyChoice)
                {
                    DialogResult choice = MessageBox.Show("Would you like to delete the weekly time slots until the end of the semester?", "Delete weekly timeslots?", MessageBoxButtons.YesNo);
                    if (choice == DialogResult.Yes)                         //if the user says yes
                    {
                        deleteAvail(true);                                  //delete the time block and all of its weekly future ones
                    }
                    else if (choice == DialogResult.No)                     //if they say no
                    {
                        deleteAvail(false);                                 //delete the time slots of only the ones that have checked off
                    }
                }
                else
                {
                    deleteAvail(false);
                }

                for (int c = 0; c < lvTimeSlots.CheckedItems.Count; c++)    //remove all of the selected time slots from the listview
                {
                    lvTimeSlots.CheckedItems[c].Remove();
                    c--;
                }

                if (!admin)
                {
                    StudentMain g = new StudentMain(id);                    //send the user back to the student main
                    g.Show();
                    this.Dispose();
                }
                else
                {
                    AdminSeeSchedule g = new AdminSeeSchedule(id);         //send the user to admin
                    g.Show();
                    this.Dispose();
                }
            }
            else
            {
                MessageBox.Show("Cancellation confirmed, the selected time slots have not been deleted from your availability.");
            }
        }
 private void btnCancel_Click(object sender, EventArgs e)
 {
     if (!admin)//send the user to student main
     {
         StudentMain g = new StudentMain(id);
         g.Show();
         this.Dispose();
     }
     else//otherwise, send the user to admin
     {
         AdminSeeSchedule g = new AdminSeeSchedule(id);
         g.Show();
         this.Dispose();
     }
 }
Example #13
0
 private void backToMain(string accountType)
 {                                                                                                                                     //check the user's accountType and use that to take them to the right main form
     if (accountType == "Student")
     {
         StudentMain g = new StudentMain(id);
         g.Show();
         this.Dispose();
     }
     else if (accountType == "Faculty")
     {
         FacultyMain g = new FacultyMain(id);
         g.Show();
         this.Dispose();
     }
     else if (accountType == "Administrator")
     {
         AdminMain g = new AdminMain();
         g.Show();
         this.Dispose();
     }
 }
Example #14
0
        private void LogAndPassToDatabase()
        {
            sqlcon.DBase.ChangeTracker.DetectChanges();

            var s = (from g in sqlcon.DBase.Users where g.UserName == this.Login select g).ToList();

            string str  = GetHashString(Password);
            bool   flag = false;

            if (str.Equals(s[0].Password.ToString().Replace("-", String.Empty)))
            {
                flag = true;
            }
            if (flag)
            {
                switch (s[0].Acceslevel)
                {
                case 1: { AccesLevel = AccesLevels.User; StudNumber = _login; } break;

                case 2: AccesLevel = AccesLevels.Teacher; break;

                case 3: AccesLevel = AccesLevels.Dean; break;

                default: MessageBox.Show("Error in database"); Application.Current.MainWindow.Close(); break;
                }

                var NewWindow = new StudentMain();
                NewWindow.Show();
                Application.Current.MainWindow.Close();
                Application.Current.MainWindow = NewWindow;
            }
            else
            {
                MessageBox.Show("Неверный пароль");
            }
        }
Example #15
0
        private void btnRequest_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrWhiteSpace(combCourseName.Text))                                                                         //check if anything necessary is null
            {
                MessageBox.Show("Please select a course for the session.");
            }
            else if (string.IsNullOrWhiteSpace(combHours.Text) || string.IsNullOrWhiteSpace(combMins.Text))
            {
                MessageBox.Show("Please input values for the hours and minutes dropdown boxes");
            }
            else if (((Convert.ToInt32(combHours.Text) * 4 + (Convert.ToInt32(combMins.Text) / 15)) == 0) ||                            //check that the appointment is between 15 minutes and 3 hours
                     ((Convert.ToInt32(combHours.Text) * 4 + (Convert.ToInt32(combMins.Text) / 15)) > 12))
            {
                MessageBox.Show("Please input values for the hours and minutes that are between a length of 15 minutes and 3 hours");
            }
            else
            {
                bool     weekly           = cbxWeekly.Checked;                                                                                 //get whether this is weekly
                DateTime start            = DateTime.Now;                                                                                      //set start to now
                TutorMasterDBEntities4 db = new TutorMasterDBEntities4();                                                                      //connect to database

                string classCode = (from row in db.Classes where combCourseName.Text == row.ClassName select row.ClassCode).First();           //get the class code

                var approvedTutorIds = (from row in db.StudentClasses.AsEnumerable() where classCode == row.ClassCode select row.ID).ToList(); //get all of the approved tutors
                if (approvedTutorIds.Count() == 0)
                {
                    MessageBox.Show("There are currently no tutors approved to tutor this course. Sorry.");
                }
                else
                {
                    List <Commitment> tuteeCommits = (from stucmt in db.StudentCommitments.AsEnumerable()                               //get the tutee commitments
                                                      where stucmt.ID == id
                                                      join cmt in db.Commitments.AsEnumerable() on stucmt.CmtID equals cmt.CmtID
                                                      select cmt).ToList();


                    int sessionLength = Convert.ToInt32(combHours.Text) * 4 + (Convert.ToInt32(combMins.Text) / 15);                   //get the number of 15 minute time blocks of the session

                    SortsAndSearches.QuickSort(ref tuteeCommits, tuteeCommits.Count());                                                //sort the tutee commit list

                    checkMax(ref tuteeCommits);                                                                                        //check if there are any 3 hour time blocks

                    removeNotOpens(ref tuteeCommits, start, weekly);                                                                   //remove the commitments that are not open

                    if (tuteeCommits.Count == 0)
                    {
                        MessageBox.Show("You currently have no available slots, please add some availability before attempting to schedule a session of this length");
                    }
                    else
                    {
                        List <string> tuteeValidSlots = getValidSlots(ref tuteeCommits, sessionLength);                                //get the tutee's valid time slots for the length of the session we're looking for

                        bool done = false;
                        for (int i = 0; i < approvedTutorIds.Count(); i++)                                                            //go through each tutor in the approved tutor list
                        {
                            if (approvedTutorIds[i] != id)                                                                            //don't let a tutor tutor him/herself
                            {
                                var tutorFirstName = (from row in db.Users.AsEnumerable() where row.ID == approvedTutorIds[i] select row.FirstName).First();
                                var tutorLastName  = (from row in db.Users.AsEnumerable() where row.ID == approvedTutorIds[i] select row.LastName).First();

                                List <TutorMaster.Commitment> tutorCommits = (from stucmt in db.StudentCommitments.AsEnumerable()     //get the tutor's commitments
                                                                              where stucmt.ID == approvedTutorIds[i]
                                                                              join cmt in db.Commitments.AsEnumerable() on stucmt.CmtID equals cmt.CmtID
                                                                              select cmt).ToList();

                                SortsAndSearches.QuickSort(ref tutorCommits, tutorCommits.Count());                                   //sort them

                                checkMax(ref tutorCommits);                                                                           //check for 3 tutoring blocks

                                removeNotOpens(ref tutorCommits, start, weekly);                                                      //remove the not opens

                                List <string> tutorValidSlots = getValidSlots(ref tutorCommits, sessionLength);                       //get the valid time slots for the tutors

                                for (int j = 0; j < tutorValidSlots.Count(); j++)                                                     //iterate through the valid tutor time slots
                                {
                                    if (SortsAndSearches.BinarySearch(tuteeValidSlots, tutorValidSlots[j]))                           //see if the tutorvalid slot is in the tutee list
                                    {                                                                                                 //if it is, ask the user if they'd this appointment
                                        DialogResult choice = MessageBox.Show("You have been matched with " + tutorFirstName + " " + tutorLastName +
                                                                              " for a time at: " + tutorValidSlots[j].Split(',')[0] + " - " + tutorValidSlots[j].Split(',')[1], "You've got a match!", MessageBoxButtons.YesNo);
                                        if (choice == DialogResult.Yes)                                                               //if they say yes, get their ids and add the commitments to their schedules
                                        {
                                            int tutorId = Convert.ToInt32(approvedTutorIds[i]);
                                            int tuteeId = Convert.ToInt32(id);
                                            addCommits(tutorValidSlots[j], tutorId, tuteeId, tutorCommits, tuteeCommits, classCode, db, weekly, sessionLength);
                                            done = true;
                                            break;
                                        }
                                        else if (choice == DialogResult.No)                                                           //if no, break out of this loop and repeat the same process with another approved tutor if there is one
                                        {
                                            break;
                                        }
                                    }
                                }
                                if (done)                                                                                             //if they picked this tutor and we're done, break out of this large for loop
                                {
                                    break;
                                }
                            }
                        }
                        if (!done)                                                                                                    //if we go through every tutor and do not pick one, put the message up
                        {
                            MessageBox.Show("There are no more tutors that meet your request requirements.");
                        }
                    }
                    StudentMain g = new StudentMain(id);                                                                              //return to student main
                    g.Show();
                    this.Dispose();
                }
            }
        }
Example #16
0
        public ActionResult AllStudentList()
        {
            StudentMain SM = new StudentMain();

            return(View(SM.GetAllStudent().ToList()));
        }
Example #17
0
        public ActionResult Delete(string StudentID)
        {
            StudentMain SM = new StudentMain();

            return(View(SM.GetStudent(StudentID)));
        }