예제 #1
0
        /// <summary>
        /// This function handles updating the user info when update
        /// button is pressed.
        /// </summary>
        /// <param name="a_sender">It holds the sender.</param>
        /// <param name="a_event">It holds the event args.</param>
        private void UpdateInfoTile_Click(object a_sender, EventArgs a_event)
        {
            /// Starts the new form to get the information.
            FacultyProfile profile = FacultyProfile.getInstance(m_emailID);

            UpdateInfo update = new UpdateInfo(profile.m_faculty, false);

            update.ShowDialog();

            FacultyProfile.getInstance(m_emailID).GetFacultyInfo();
        }
예제 #2
0
        /// <summary>
        /// This function handles the log in functionality of the user.
        /// </summary>
        private void ExecuteLogin()
        {
            /// Forms a model with the user provided information.
            ClientUserLoginModel loginInfo = new ClientUserLoginModel();

            loginInfo.Pswd        = passwordText.Text;
            loginInfo.Email       = emailText.Text;
            loginInfo.Member_type = m_isStudent ? (sbyte)1:(sbyte)0;

            HttpClient client = NetworkClient.getInstance().getHttpClient();

            /// List data response. This is the blocking call.
            HttpResponseMessage response = client.PostAsJsonAsync(BaseConnection.g_loginPostString, loginInfo).Result;

            if (response.IsSuccessStatusCode)
            {
                /// Here, open the new relevant form according to student or professor.
                this.Hide();

                /// Opens the student/professor profile according to the information provided.
                if (m_isStudent)
                {
                    StudentProfile studentProfile = StudentProfile.GetInstance(loginInfo.Email);
                    studentProfile.ShowDialog();
                }
                else
                {
                    FacultyProfile studentProfile = FacultyProfile.getInstance(loginInfo.Email);
                    studentProfile.ShowDialog();
                }
                this.Close();
            }
            else
            {
                MetroMessageBox.Show(this, "Cannot find the specified user", "Log in info incorrect", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }