private void PO_Click(object sender, RoutedEventArgs e) { if (pO_d) { // fix prev windows OD.IsEnabled = false; O_D.Text = "\uf058"; O_D.Foreground = new System.Windows.Media.SolidColorBrush(color); // open a new one Window done = new Done(); P_O.Foreground = new System.Windows.Media.SolidColorBrush(color); PresentationSource ScreenPos = PresentationSource.FromVisual(this); done.Left = (370.0 * ScreenPos.CompositionTarget.TransformToDevice.M11); done.Top = (560.0 * ScreenPos.CompositionTarget.TransformToDevice.M22); done.Topmost = true; done.Show(); if (MainWindow.client.get_member_b) { Window looged = new Logged(); looged.Show(); } else { Window mainwindow = new MainWindow(); mainwindow.Show(); } Close(); } }
private void LogIn_Click(object sender, RoutedEventArgs e) { myBL = FactorySingletonBl.getInstanceBl(); string Signin = sign.Text; bool is_member = false; bool exists = false; Client tmp = new Client(); foreach (var item in myBL.get_client_list()) // find user by name { if (Signin == item.get_name) // found { if (item.get_member_b == true) { // if he's a member (not a guest) is_member = true; tmp = item; break; } else { exists = true; // if he's a member of course he exists } } } if (exists) // meaning he's not a member but a guest once more { ; } if (is_member) { client = tmp; Window logged = new Logged(); logged.Show(); base.Close(); } }
private void Settings_Click(object sender, RoutedEventArgs e) { bool good = true; if ((Tools.isNumeric(u_ca.Text)) && (Tools.isNumeric(u_id.Text)) && (Tools.isNumeric(u_tel.Text))) { New.get_card = long.Parse(u_ca.Text); New.Get_Cus_id = int.Parse(u_id.Text); New.get_phone = int.Parse(u_tel.Text); } else { good = false; } if ((!Tools.isNumeric(u_add.Text)) && (!Tools.isNumeric(u_em.Text)) && (!Tools.isNumeric(u_n.Text))) { New.get_add = u_add.Text; New.get_email = u_em.Text; New.get_name = u_n.Text; New.get_member_b = true; } else { good = false; } if (good && (u_lo.SelectedItem != null)) { New.get_cus_lo = ((Location)u_lo.SelectedItem); mybl.update_client(New); MainWindow.client = New; Window loggedin = new Logged(); loggedin.Topmost = true; loggedin.Show(); Close(); } }