예제 #1
0
        private void AddUser_Click(object sender, RoutedEventArgs e)
        {
            string      temp  = "";
            ServicesXml sx    = new ServicesXml();
            Tbl_User    tuser = new Tbl_User();

            tuser.UserId   = rand.Next();
            tuser.UserName = string.Format("{0}{1}",
                                           tbFName.Text, tbLName.Text.Substring(0, 1));
            tuser.Password       = rand.Next().ToString();
            tuser.DateOfBirthday = (DateTime)dpDoB.SelectedDate;
            tuser.Gender         = (Gender)(lbGender.SelectedIndex);

            if (!sx.AddUser(tuser, out temp))
            {
                errorMesage.Foreground = new SolidColorBrush(Colors.Red);
                errorMesage.Content    = temp;
            }
            else
            {
                errorMesage.Foreground = new SolidColorBrush(Colors.Green);
                errorMesage.Content    = temp;
                Thread.Sleep(3000);
                AdminWindow.mf.Source = new Uri("Pages/ListUsersPage.xaml", UriKind.RelativeOrAbsolute);
            }
        }
예제 #2
0
        private void btnLogOn_Click(object sender, RoutedEventArgs e)
        {
            ServicesXml service = new ServicesXml("users.xml");

            if (service.GetUser(txbLogin.Text, txbPassword.Password))
            {
                AdminWindow aw = new AdminWindow();
                aw.Show();

                this.Close();
            }
        }
예제 #3
0
        public UsersInfoPage()
        {
            InitializeComponent();

            ServicesXml sx = new ServicesXml();

            users = sx.getUser();

            foreach (Tbl_User item in users)
            {
                Expander exp = new Expander();
                exp.Header = item.UserName;

                MainGridInfo.Children.Add(exp);
            }
        }