예제 #1
0
        private void SaveUserSession(finalproject.User.Users user)
        {
            XmlWriterSettings settings = new XmlWriterSettings();

            settings.Indent      = true;
            settings.IndentChars = "\t";
            XmlWriter xmlObject = XmlWriter.Create(USER_SESSION, settings);

            xmlObject.WriteStartDocument();

            xmlObject.WriteStartElement("session");

            xmlObject.WriteStartElement("user");
            xmlObject.WriteElementString("firstName", user.FirstName);
            xmlObject.WriteElementString("lastName", user.LastName);
            xmlObject.WriteElementString("email", user.Email);
            xmlObject.WriteElementString("phone", user.PhoneNumber);
            xmlObject.WriteElementString("address1", user.Address1);
            xmlObject.WriteElementString("address2", user.Address2);
            xmlObject.WriteElementString("city", user.City);
            xmlObject.WriteElementString("province", user.Province);
            xmlObject.WriteElementString("zipCode", user.ZipCode);
            xmlObject.WriteElementString("education", user.Education);
            xmlObject.WriteElementString("jobType", user.JobType);
            xmlObject.WriteElementString("userId", user.UserId);
            xmlObject.WriteEndElement();
            xmlObject.WriteEndElement();
            xmlObject.Close();
        }
예제 #2
0
        private void LoginUser_Click(object sender, RoutedEventArgs e)
        {
            Authonticate authonticate = new Authonticate();

            logIn = authonticate.AuthonticateUser(LoginEmail.Text, LoginPassword.Text);
            if (logIn.FirstName.ToString() != "")
            {
                if (logIn.AccountType.ToString() == "admin")
                {
                    finalproject.Admin.Dashboard dash = new finalproject.Admin.Dashboard(GetUsersDetails());
                    this.Hide();
                    dash.ShowDialog();
                }
                else
                {
                    finalproject.User.UserDashbaord userDash = new finalproject.User.UserDashbaord(logIn.UserId.ToString());
                    this.Hide();
                    userDash.Show();
                }
            }
            else
            {
                MessageBox.Show("Not valid logins");
            }
        }