コード例 #1
0
 /// <summary>
 /// add client to system
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void bt_GuestRegist_Click(object sender, RoutedEventArgs e)
 {
     BO.Person person = new BO.Person
     {
         FirstName = tbFirstName.Text,
         LastName  = tbLastName.Text
     };
     if (tbId.Text.Length == 0)
     {
         MessageBox.Show("אחד השדות או יותר חסרים:");
         return;
     }
     if (tbId.Text.Length > 0)
     {
         person.Id = int.Parse(tbId.Text);
     }
     person.Password = tbPassword1.Password;
     person.Phone    = tbPhone.Text;
     person.Status   = BO.PersonStatus.ACTIVE;
     try
     {
         bl.GetPerson(person.Id);
         MessageBox.Show("המשתמש קיים במערכת ");
         ClearTextBox();
         GuestLogBorder.Visibility = Visibility.Hidden;
     }
     catch (Exception)
     {
         bl.AddPerson(person);
         MessageBox.Show("נרשמת בהצלחה למערכת");
         ClearTextBox();
         GuestLogBorder.Visibility = Visibility.Hidden;
     }
 }
コード例 #2
0
 /// <summary>
 /// הירשמות כאורח
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void registGuestButton_Click(object sender, RoutedEventArgs e)
 {
     if (idTextBox.Text == "0" || firstNameTextBox.Text.Length == 0 || lastNameTextBox.Text.Length == 0 ||
         emailTextBox.Text.Length == 0 || passwordPasswordBox.Password.Length == 0)
     {
         MessageBox.Show("אחד השדות או יותר חסרים :");
         return;
     }
     try
     {
         person.Password = passwordPasswordBox.Password;
         bl.AddPerson(person);
         MessageBox.Show("נרשמת בהצלחה למערכת");
         ClearTextBox();
         TabControl_Main.SelectedIndex = 0;
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
         ClearTextBox();
         TabControl_Main.SelectedIndex = 0;
     }
 }