예제 #1
0
        protected void Button1_Click(object sender, EventArgs e)
        {
            string _recieverEmail = "";
            string _senderEmail = "";
            string _message = "";
            string _subject = "";
               string calendarValue = DateTime.Now.ToShortDateString();

               if (Calendar1.SelectedDate.ToShortDateString() == "01/01/0001")
               {
               calendarValue = DateTime.Now.AddDays(1).ToShortDateString();
               }
               else
               {
               calendarValue = Calendar1.SelectedDate.ToShortDateString();
               }

            UserDetails _user = (UserDetails)Session["User"];

            UserDetails studentDetails = new UserDetails();
            MeetingDetails meetingInfo = new MeetingDetails();
            meetingInfo.selectMeetingDetailsByMeetingID();

            studentDetails = UserDetails.getUserById(tuteeDdl.SelectedValue);

            _recieverEmail = studentDetails.EmailAddress.ToString().Trim();
            _senderEmail = _user.EmailAddress.ToString();

            _subject = "Meeting Request";
            _message = "Hello " + studentDetails.FirstName.ToString().Trim() + " "+ studentDetails.Surname.ToString().Trim() +", ";
            _message += Environment.NewLine;
            _message += "You have been requested to attend the following meeting at the following location by " + _user.Fullname + ", please respond, thank you.";
            _message += "Location: " + Environment.NewLine;
            _message += TextBox1.Text + Environment.NewLine;
            _message += Environment.NewLine + "Date and Time:";
            _message += Environment.NewLine + calendarValue + " " + DropDownList1.SelectedItem + ":" + DropDownList3.SelectedItem;
            _message += Environment.NewLine + Environment.NewLine;
            _message += "Kind Regards, " + Environment.NewLine + _user.Fullname.ToString();
            general_functions.Instance.email(_recieverEmail, _senderEmail, _message, _subject);
            DateTime dtt = Convert.ToDateTime((DropDownList1.SelectedItem.ToString() + ":" + DropDownList3.SelectedItem.ToString() +":" + "00").ToString());
            TimeSpan TS = new TimeSpan(dtt.Hour, dtt.Minute, dtt.Second);
            string selectedTutee = (String) Session["selectedStudent"];

            MeetingDetails tutorMeetingDetails = new MeetingDetails(selectedTutee,
                _user.UserID,
                Convert.ToDateTime(calendarValue),
                TS,
                DropDownList2.SelectedItem.ToString(),
                TextBox1.Text,
                "-",
                "Accepted");
            tutorMeetingDetails.insertToDatabase();

            populateDropDownList();
            TuteesSelectionPanel.Visible = false;
            appointmentPanel.Visible = true;
            populateTable();
        }
        private void updateMeeting(string MeetingID, string updateType)
        {
            string _recieverEmail = "";
            string _senderEmail = "";
            string _message = "";
            string _subject = "";

            UserDetails _user = (UserDetails)Session["User"];

             UserDetails tutorDetails = new UserDetails();
            MeetingDetails meetingInfo = new MeetingDetails();
            meetingInfo.MeetingID = long.Parse(MeetingID);
            meetingInfo.selectMeetingDetailsByMeetingID();

            tutorDetails= UserDetails.getUserById(meetingInfo.TutorID.ToString());

            _recieverEmail = tutorDetails.EmailAddress.ToString().Trim();
            _senderEmail = _user.EmailAddress.ToString();
            _subject = "Meeting Update";
            _message = "Hello " + tutorDetails.FirstName + " "+tutorDetails.Surname;
            _message += Environment.NewLine;
            _message += "There is a meeting update please login to the eTutor System to view the meeting details, thank you.";
            _message += Environment.NewLine + Environment.NewLine;
            _message += "Kind Regards, " + Environment.NewLine + _user.Fullname.ToString();
            general_functions.Instance.email(_recieverEmail, _senderEmail, _message, _subject);

            if(updateType == "Accepted")
            {
                meetingInfo.StudentStatus = "Accepted";
            }
            else if(updateType == "Declined")
            {
                meetingInfo.StudentStatus = "Declined";
            }

            meetingInfo.updateStudentToDatabase();

            populateDropDownList();
            appointmentPanel.Visible = true;
            populateTable();
        }