Пример #1
0
 public Customer()
 {
     currentUser = DataStore.Store.CurrentUser;
     InitializeComponent();
     LoadItems();
     row = 0;
 }
Пример #2
0
        private void Save_Click(object sender, RoutedEventArgs e)
        {
            firstName = FirstName.Text;
            middleName = MiddleName.Text;
            lastName = LastName.Text;
            city = CityName.Text;

            if (Birthdate.SelectedDate != null)
                birthDay = (DateTime)Birthdate.SelectedDate;

            userId = UserID.Text;
            passWord = PassWord.Password;

            string reConfirmed = RePassWord.Password;

            bool passed = true;

            if (!passWord.Equals(reConfirmed))
            {
                MessageBox.Show("Password not matched");
                passed=false;
            }
            if(birthDay.Equals(new DateTime()))
            {
                MessageBox.Show("Please put birthday");
                passed=false;
            }

            if(userId.Equals(""))
            {
                MessageBox.Show("Please Provide A user Name");
                passed=false;
            }

            if (passed)
            {
                User singleUser = new User();

                singleUser.FirstName = firstName;
                singleUser.MiddleName = middleName;
                singleUser.LastName = lastName;
                singleUser.City = city;
                singleUser.Birthday = birthDay;
                singleUser.UserID = userId;
                singleUser.PassWord = passWord;

                DataStore.Store.AllUser.Add(singleUser);
                MessageBox.Show("User Added Sucessfully");

                Uri uri = new Uri("MainWindow.xaml", UriKind.RelativeOrAbsolute);
                this.NavigationService.Navigate(uri);
            }
        }