private void BtnLogin_Click(object sender, RoutedEventArgs e) { TxtID_TextChanged(null, null); TxtPassword_PasswordChanged(null, null); if (errID.Visibility == Visibility.Visible || errPassword.Visibility == Visibility.Visible) { return; } int id = Convert.ToInt32(txtID.Text); if (clr.Login(id, Something.MD5Encrypt(txtPassword.Password)) == 1) { parentWindow.user = clr.QueryProfile(id); if (parentWindow.user.privilege == 1) { parentWindow.HideAnimation(); parentWindow.GotoUser(0); } else if (parentWindow.user.privilege == 2) { parentWindow.GotoAdmin(0); } } else { Dialogs.Dialog dg = new Dialogs.Dialog("", TryFindResource("pglog.failed") as string); dg.ShowDialog(); } }
private void BtnQuery_Click(object sender, RoutedEventArgs e) { if (txtLoc1.Text == "" || txtLoc2.Text == "" || txtLoc1.Text.Contains(" ") || txtLoc2.Text.Contains(" ") || date.SelectedDate == null) { Dialogs.Dialog dg = new Dialogs.Dialog("", TryFindResource("pgquery.failed") as string); dg.ShowDialog(); return; } string catalog = ""; foreach (CheckBox ch in stack.Children) { if (ch.Content.ToString().Length == 1 && ch.IsChecked == true) { catalog += ch.Content; } } List <Ticket> list = clr.QueryTicket(txtLoc1.Text, txtLoc2.Text, ((DateTime)(date.SelectedDate)).ToString("yyyy-MM-dd"), catalog, chTransfer.IsChecked == true); Something.Merge(list); lst.Items.Clear(); if (list != null && list.Count > 0) { foreach (Ticket t in list) { lst.Items.Add(new ListItem(t, clr, parentWindow.user.ID, 0)); } } }
/// <summary> /// Create empty response /// </summary> public BotResponse(IUser user) { Data = null; Type = ResponseType.Null; User = user; Dialog = null; }
public BotResponse(object data, ResponseType type, IUser user) { Data = data; Type = type; User = user; Dialog = null; }
private void btnSale_Click(object sender, RoutedEventArgs e) { if (clr.SaleTrain(train.trainID) == 1) { Dialogs.Dialog dg = new Dialogs.Dialog("", TryFindResource("pgtrain.saleok") as string); dg.ShowDialog(); } else { Dialogs.Dialog dg = new Dialogs.Dialog("", TryFindResource("pgtrain.saleerr") as string); dg.ShowDialog(); } }
private void BtnRegister_Click(object sender, RoutedEventArgs e) { TxtName_TextChanged(null, null); PasswordChanged(txtConfirm, null); TxtEmail_TextChanged(null, null); TxtPhone_TextChanged(null, null); TxtValid_TextChanged(null, null); if (errConfirm.Visibility == Visibility.Visible || errEmail.Visibility == Visibility.Visible || errName.Visibility == Visibility.Visible || errPhone.Visibility == Visibility.Visible || errValid.Visibility == Visibility.Visible) { return; } User u = new User { name = txtName.Text, password = Something.MD5Encrypt(txtPassword.Password), email = txtEmail.Text, phone = txtPhone.Text }; clr.Register(u); if (u.ID >= 2018) { Clear(); Dialogs.DgReg dg = new Dialogs.DgReg(u.ID); dg.ShowDialog(); if (dg.Return == 0) { u.privilege = u.ID == 2018 ? 2 : 1; parentWindow.user = u; if (parentWindow.user.privilege == 1) { parentWindow.HideAnimation(); parentWindow.GotoUser(0); } else if (parentWindow.user.privilege == 2) { parentWindow.GotoAdmin(0); } } else { BtnBack_Click(null, null); } } else { Dialogs.Dialog dg = new Dialogs.Dialog("", TryFindResource("pgreg.failed") as string); dg.ShowDialog(); } Generate(); }
private void btnDelete_Click(object sender, RoutedEventArgs e) { if (clr.DeleteTrain(train.trainID) == 1) { Dialogs.Dialog dg = new Dialogs.Dialog("", TryFindResource("pgtrain.deleteok") as string); dg.ShowDialog(); btnBack_Click(null, null); } else { Dialogs.Dialog dg = new Dialogs.Dialog("", TryFindResource("pgtrain.deleteerr") as string); dg.ShowDialog(); } }
private void btnSubmit_Click(object sender, RoutedEventArgs e) { if (GetTrain() && clr.AddTrain(tmpTrain) == 1) { train = tmpTrain; Dialogs.Dialog dg = new Dialogs.Dialog("", TryFindResource("pgtrain.addok") as string); dg.ShowDialog(); btnBack_Click(null, null); } else { Dialogs.Dialog dg = new Dialogs.Dialog("", TryFindResource("pgtrain.adderr") as string); dg.ShowDialog(); } }
private void btnQuery_Click(object sender, RoutedEventArgs e) { if (txtID.Text == "" || txtID.Text.Contains(" ")) { Dialogs.Dialog dg = new Dialogs.Dialog("", TryFindResource("pgtrains.failed") as string); dg.ShowDialog(); return; } Train t = clr.QueryTrain(txtID.Text); if (t.trainID == "0") { Dialogs.Dialog dg = new Dialogs.Dialog("", TryFindResource("pgtrains.failed") as string); dg.ShowDialog(); return; } parentWindow.GotoTrain(0, t); }
private void BtnModify_Click(object sender, RoutedEventArgs e) { TxtUserID_TextChanged(null, null); if (errID.Visibility == Visibility.Visible) { return; } if (clr.ModifyPrivilege(parentWindow.user.ID, Convert.ToInt32(txtUserID.Text), 2) == 1) { Dialogs.Dialog dg = new Dialogs.Dialog("", TryFindResource("pgusers.ok") as string); dg.ShowDialog(); } else { Dialogs.Dialog dg = new Dialogs.Dialog("", TryFindResource("pgusers.failed") as string); dg.ShowDialog(); } }
private void BtnModify_Click(object sender, RoutedEventArgs e) { TxtName_TextChanged(null, null); PasswordChanged(txtConfirm, null); TxtOld_PasswordChanged(null, null); TxtEmail_TextChanged(null, null); TxtPhone_TextChanged(null, null); TxtValid_TextChanged(null, null); if (errConfirm.Visibility == Visibility.Visible || errEmail.Visibility == Visibility.Visible || errName.Visibility == Visibility.Visible || errPhone.Visibility == Visibility.Visible || errValid.Visibility == Visibility.Visible || errOld.Visibility == Visibility.Visible) { return; } User u = new User { ID = parentWindow.user.ID, name = txtName.Text, password = Something.MD5Encrypt(txtPassword.Password), email = txtEmail.Text, phone = txtPhone.Text }; if (clr.Login(u.ID, Something.MD5Encrypt(txtOld.Password)) != 1) { Dialogs.Dialog dg = new Dialogs.Dialog("", TryFindResource("pgpro.failed1") as string); dg.ShowDialog(); return; } if (clr.ModifyProfile(u) == 1) { Clear(); parentWindow.user = u; Dialogs.Dialog dg = new Dialogs.Dialog("", TryFindResource("pgpro.success") as string); dg.ShowDialog(); } else { Dialogs.Dialog dg = new Dialogs.Dialog("", TryFindResource("pgpro.failed2") as string); dg.ShowDialog(); } Generate(); }
private void btnModify_Click(object sender, RoutedEventArgs e) { modified = !modified; if (modified) { btnModify.Content = TryFindResource("pgtrain.btnmodify2") as string; btnSale.IsEnabled = false; btnDelete.IsEnabled = false; grid.IsReadOnly = false; txtName.IsEnabled = true; stack.IsEnabled = true; stack2.IsEnabled = true; btnAdd.IsEnabled = true; btnRemove.IsEnabled = true; } else { btnModify.Content = TryFindResource("pgtrain.btnmodify1") as string; btnSale.IsEnabled = true; btnDelete.IsEnabled = true; grid.IsReadOnly = true; txtName.IsEnabled = false; stack.IsEnabled = false; stack2.IsEnabled = false; btnAdd.IsEnabled = false; btnRemove.IsEnabled = false; if (GetTrain() && clr.ModifyTrain(tmpTrain) == 1) { train = tmpTrain; Dialogs.Dialog dg = new Dialogs.Dialog("", TryFindResource("pgtrain.modok") as string); dg.ShowDialog(); } else { Dialogs.Dialog dg = new Dialogs.Dialog("", TryFindResource("pgtrain.moderr") as string); dg.ShowDialog(); SetTrain(); } } }
public BotResponse(object data, ResponseType type, IUser user, Dialogs.Dialog dialog) : this(data, type, user) { Dialog = dialog; }