/// <summary> /// add host to system /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void bt_HostRegist_Click(object sender, RoutedEventArgs e) { BO.Host host = new BO.Host(); if (tbIdHost.Text.Length == 0 || tbAccountNum.Text.Length == 0 || tbBranchNum.Text.Length == 0 || tbBankNum.Text.Length == 0) { MessageBox.Show("אחד השדות או יותר חסרים :"); return; } host.AccountDetails = new BankBranch() { AccuontNumber = int.Parse(tbAccountNum.Text), BranchNumber = int.Parse(tbBranchNum.Text), BankNumber = int.Parse(tbBankNum.Text), }; host.CollectionClearance = cb_permission.IsChecked.Value; host.WebSite = tbWebSite.Text; host.MyOrders = new List <BO.Order>(); host.MyUnits = new List <BO.HostingUnit>(); host.HostInfo = new Person() { Email = tbMailHost.Text, Address = "", FirstName = tbFirstNameHost.Text, Id = int.Parse(tbIdHost.Text), LastName = tbLastNameHost.Text, Phone = tbPhoneHost.Text, Password = tbPassword1Host.Password, Status = BO.PersonStatus.ACTIVE, }; try { bl.GetHost(host.HostInfo.Id); MessageBox.Show("המשתמש קיים במערכת "); ClearTextBox(); HostLogBorder.Visibility = Visibility.Hidden; } catch { try { Person per = bl.GetPerson(host.HostInfo.Id); bl.UpdatePerson(host.HostInfo); bl.AddHost(host); } catch { bl.AddPerson(host.HostInfo); bl.AddHost(host); } MessageBox.Show("נרשמת בהצלחה למערכת"); ClearTextBox(); HostLogBorder.Visibility = Visibility.Hidden; } }
private void bt_HostLog_Click(object sender, RoutedEventArgs e) { try { if ((tb_HostId.Text.Length == 0)) { MessageBox.Show("אנא הזן תז"); return; } Host host = bl.GetHost(int.Parse(tb_HostId.Text)); if (host.HostInfo.Password != pb_HostPass.Password) { MessageBox.Show("הסיסמה שגויה אנא הזן שנית:"); return; } myButtons.Visibility = Visibility.Visible; HostPasswordBorder.Visibility = Visibility.Collapsed; } catch { MessageBox.Show("הפרטים שהזנת אינם קיימים במערכת"); } }