public ACTHome(TOUser u) { user = u; InitializeComponent(); //hidding the menu Canvas.Visibility = Visibility.Hidden; Configuration.Visibility = Visibility.Hidden; //setting house logo. if (user.House == 2) { imgS.Visibility = Visibility.Visible; } if (user.House == 1) { imgG.Visibility = Visibility.Visible; } if (user.House == 3) { imgH.Visibility = Visibility.Visible; } if (user.House == 4) { imgR.Visibility = Visibility.Visible; } //loading menu info lblUserName.Content = user.Name + " " + user.SirName; lblMoney.Content = "R$ " + user.Credit + ",00"; lblEmail.Content = user.Email; //Loading the image. if (!System.IO.File.Exists(@"C:\eBuy\" + user.Account + ".png")) { //The image does not exists. } else { if (System.IO.File.Exists(@"C:\eBuy\" + user.Account + "Temp.png")) { File.Copy(@"C:\eBuy\" + user.Account + ".png", @"C:\eBuy\" + user.Account + "Temp" + i + ".png", true); if (System.IO.File.Exists(@"C:\eBuy\" + user.Account + "Temp" + i + ".png")) { i = Directory.GetFiles(@"C:\eBuy\", "*", SearchOption.TopDirectoryOnly).Length; i++; File.Copy(@"C:\eBuy\" + user.Account + ".png", @"C:\eBuy\" + user.Account + "Temp" + i + ".png", true); imgUser.Source = new BitmapImage(new Uri(@"C:\eBuy\" + user.Account + "Temp" + i + ".png")); } } else { File.Copy(@"C:\eBuy\" + user.Account + ".png", @"C:\eBuy\" + user.Account + "Temp.png", true); imgUser.Source = new BitmapImage(new Uri(@"C:\eBuy\" + user.Account + "Temp.png")); } } //load recents on quick menu. LoadScreen(user, status); }
private void btnDeleteUser_Click(object sender, RoutedEventArgs e) { if (TableValues(0) != null) { MessageBoxResult result = Xceed.Wpf.Toolkit.MessageBox.Show("Você tem certeza de que gostaria de excluir este usuário? AVISO! Se o usuário for um professor todas suas turmas serão excluídas.", "Aviso!", MessageBoxButton.YesNoCancel); if (result == MessageBoxResult.Yes) { DAOUser dao = new DAOUser(); TOUser u = new TOUser(); u = dao.Selection(Int16.Parse(TableValues(0))); if (dao.DeleteUser(u)) { Xceed.Wpf.Toolkit.MessageBox.Show("Usuário excluído com sucesso.", "Sucesso!", MessageBoxButton.OK, MessageBoxImage.Information, MessageBoxResult.OK); } else { Xceed.Wpf.Toolkit.MessageBox.Show("Algo errado aconteceu durante a exclusão.", "Erro!", MessageBoxButton.OK, MessageBoxImage.Error, MessageBoxResult.OK); } } else { //Do nothing. } } else { } LoadScreen(); }
private void btnRegister_Click(object sender, RoutedEventArgs e) { View.ACTProductRegistration productRegistration = new ACTProductRegistration(user); productRegistration.ShowDialog(); user = productRegistration.ReturnUser; LoadScreen(user, status); }
private void btnSaturdayVacancys_Click(object sender, RoutedEventArgs e) { DAOClass dao = new DAOClass(); if (dao.VacancyCount("sábado") == 0) { Xceed.Wpf.Toolkit.MessageBox.Show("Não há vagas disponíveis.", "MC Sales", MessageBoxButton.OK, MessageBoxImage.Information, MessageBoxResult.OK); tblStudents.ItemsSource = null; lblCount_Vacancy.Content = "0"; lblCount.Content = "10"; lblNoVancacys.Visibility = Visibility.Visible; } else { //class info. _class = dao.LoadQuickMenu("sábado"); lblClass_Time.Content = _class.Class_TotalHours; //teacher info. TOUser u = new TOUser(); DAOUser daoU = new DAOUser(); u = daoU.Selection(_class.User_id); lblTeacher_Name.Content = u.User_name; btnViewCurrentClass.Visibility = Visibility.Visible; btnResetTable.Visibility = Visibility.Visible; LoadTable(_class.Class_id); lblDay.Visibility = Visibility.Visible; lblDay.Content = "Sábado"; } }
int op = 0; //operação de cadastro. public REG_user(TOUser i) { InitializeComponent(); user = i; if (i == null) { } else { op = 1; this.Title = "Editar Usuário"; txtUser.IsEnabled = false; psbPassword.IsEnabled = false; comboBox.IsEnabled = false; TOUser user = new TOUser(); user = i; txtUser.Text = user.User_name; psbPassword.Password = user.User_password; comboBox.SelectedIndex = user.Permission_id; //set to edit. btnRegisterUser.Content = "Editar"; } }
public bool DeleteProduct(string product, TOUser user) { bool i = false; try { string sql = "delete from tbl_product where product_name = '" + product + "' and user_id = " + user.Id + ";"; con = ConnectionFactory.Connection(); MySqlCommand cmd = new MySqlCommand(sql, con); con.Open(); MySqlDataReader dtreader = cmd.ExecuteReader(); if (dtreader.Read()) { i = false; } else { i = true; } } catch (MySqlException e) { throw new Exception(e.Message); } finally { con.Close(); } return(i); }
public TOProduct LoadRecent(TOUser user, int recent) { TOProduct i = new TOProduct(); try { string sql = "select * from tbl_product where product_id = (select (max(product_id)-" + recent + ") from tbl_product) and product_status = true;"; con = ConnectionFactory.Connection(); MySqlCommand cmd = new MySqlCommand(sql, con); con.Open(); MySqlDataReader dtreader = cmd.ExecuteReader(); while (dtreader.Read()) //If there's any data. { i.Id = dtreader.GetInt16("product_id"); i.Link = dtreader.GetString("product_link"); i.Name = dtreader.GetString("product_name"); i.Type = dtreader.GetString("product_type"); i.Price = dtreader.GetDouble("product_price"); i.Store = dtreader.GetString("product_store"); i.BuyingDate = dtreader.GetDateTime("product_buyingDate").ToString("dd-MM-yyyy"); } con.Close(); } catch (MySqlException e) { throw new Exception(e.Message); } return(i); }
public ACTProductRegistration(TOUser u, TOProduct p) { i = 2; product = p; //setting textboxes. InitializeComponent(); user = u; txtLink.Text = p.Link; txtPrice.Text = p.Price.ToString(); txtProduct.Text = p.Name; txtStore.Text = p.Store; txtType.Text = p.Type; //set comboboxes. if (product.Priority == 1) { cbxPriority.SelectedValue = "Muito baixa"; } else if (product.Priority == 2) { cbxPriority.SelectedValue = "Baixa"; } else if (product.Priority == 3) { cbxPriority.SelectedValue = "Normal"; } else if (product.Priority == 4) { cbxPriority.SelectedValue = "Alta"; } else if (product.Priority == 5) { cbxPriority.SelectedValue = "Muito Alta"; } //setting radioButton. if (product.Status == true) { rdbComprado.IsChecked = true; } else { rdbListaDesejo.IsChecked = true; } //disabling all components. txtLink.IsEnabled = false; txtPrice.IsEnabled = false; txtProduct.IsEnabled = false; txtStore.IsEnabled = false; txtType.IsEnabled = false; cbxPriority.IsEnabled = false; rdbComprado.IsEnabled = false; rdbListaDesejo.IsEnabled = false; btnRegister.IsEnabled = false; btnEdit.Visibility = Visibility.Visible; }
public TOUser Selection(int id) { MySqlConnection con = null; TOUser i = new TOUser(); try { string sql = "select * from tbl_user where user_id = " + id + ";"; con = ConnectionFactory.Connection(); MySqlCommand cmd = new MySqlCommand(sql, con); con.Open(); MySqlDataReader dtreader = cmd.ExecuteReader(); if (dtreader.Read())//If there's any data. { i.User_id = dtreader.GetInt16("user_id"); i.User_name = dtreader.GetString("user_name"); i.User_password = dtreader.GetString("user_password"); i.Permission_id = dtreader.GetInt16("permission_id"); if (i.Permission_id == 1) { i.Permission_desc = "Administrador"; } else if (i.Permission_id == 2) { i.Permission_desc = "Administração"; } else if (i.Permission_id == 3) { i.Permission_desc = "Vendas"; } else { i.Permission_desc = "Professor"; } } else { } } catch (MySqlException e) { throw new Exception(e.Message); } finally { con.Close(); } return(i); }
public TOUser Update(TOUser user) { MySqlConnection con = null; TOUser i = new TOUser(); try { string sql = @"update tbl_user set user_name = '" + user.Name + "', user_sirName = '" + user.SirName + "', user_account = '" + user.Account + "', user_password = '******', user_email = '" + user.Email + "', user_credit = " + user.Credit + ", user_creditSpent = " + user.CreditSpent + ", user_creditAvaliable = " + user.CreditAvaliable + " where user_id = " + user.Id + ";"; con = ConnectionFactory.Connection(); MySqlCommand cmd = new MySqlCommand(sql, con); con.Open(); cmd.ExecuteNonQuery(); string select = "select * from tbl_user where user_id = " + user.Id + ";"; MySqlCommand command = new MySqlCommand(select, con); MySqlDataReader dtreader = command.ExecuteReader(); if (dtreader.Read())//If there's any data. { i.Id = dtreader.GetInt16("user_id"); i.Name = dtreader.GetString("user_name"); i.SirName = dtreader.GetString("user_sirName"); i.Account = dtreader.GetString("user_account"); i.House = dtreader.GetInt16("house_id"); i.Password = dtreader.GetString("user_password"); i.Email = dtreader.GetString("user_email"); i.Credit = dtreader.GetDouble("user_credit"); i.CreditSpent = dtreader.GetDouble("user_creditSpent"); i.CreditAvaliable = dtreader.GetDouble("user_creditAvaliable"); } else { } } catch (MySqlException e) { throw new Exception(e.Message); } finally { con.Close(); } return(i); }
private void btnEdit_Click(object sender, RoutedEventArgs e) { if (TableValues(1) != null) { TOProduct product = new TOProduct(); product = DAOProd.Selection(TableValues(1)); ACTProductRegistration pr = new ACTProductRegistration(user, product); pr.ShowDialog(); user = pr.ReturnUser; LoadScreen(user, status); } }
public List <TOUser> LoadUsers() { List <TOUser> i = new List <TOUser>(); try { string sql = "select * from tbl_user;"; con = ConnectionFactory.Connection(); MySqlCommand cmd = new MySqlCommand(sql, con); con.Open(); MySqlDataReader dtreader = cmd.ExecuteReader(); while (dtreader.Read()) //If there's any data. { TOUser x = new TOUser(); x.User_id = dtreader.GetInt16("user_id"); x.User_name = dtreader.GetString("user_name"); x.User_password = dtreader.GetString("user_password"); x.Permission_id = dtreader.GetInt16("permission_id"); if (x.Permission_id == 1) { x.Permission_desc = "Administrador"; } else if (x.Permission_id == 2) { x.Permission_desc = "Administração"; } else if (x.Permission_id == 3) { x.Permission_desc = "Vendas"; } else { x.Permission_desc = "Professor"; } i.Add(x); } con.Close(); } catch (MySqlException e) { throw new Exception(e.Message); } return(i); }
public TOUser CreditSpent(TOUser i, double value) { TOUser user = new TOUser(); MySqlConnection con = null; try { string sql = "update tbl_user set user_creditSpent = user_creditSpent + " + value + " where user_id = " + i.Id + ";"; con = ConnectionFactory.Connection(); MySqlCommand cmd = new MySqlCommand(sql, con); con.Open(); cmd.ExecuteNonQuery(); con.Close(); string select = "select * from tbl_user where user_id = " + i.Id + ";"; MySqlCommand comando = new MySqlCommand(select, con); con.Open(); MySqlDataReader dtreader = comando.ExecuteReader(); if (dtreader.Read()) { user.Id = dtreader.GetInt16("user_id"); user.Name = dtreader.GetString("user_name"); user.SirName = dtreader.GetString("user_sirName"); user.Account = dtreader.GetString("user_account"); user.House = dtreader.GetInt16("house_id"); user.Password = dtreader.GetString("user_password"); user.Email = dtreader.GetString("user_email"); user.Credit = dtreader.GetDouble("user_credit"); user.CreditSpent = dtreader.GetDouble("user_creditSpent"); user.CreditAvaliable = dtreader.GetDouble("user_creditAvaliable"); } } catch (MySqlException e) { throw new Exception(e.Message); } finally { con.Close(); } return(user); }
private void tblUser_MouseDoubleClick(object sender, MouseButtonEventArgs e) { if (TableValues(0) != null) { DAOUser dao = new DAOUser(); TOUser i = new TOUser(); i = dao.Selection(Int16.Parse(TableValues(0))); REG_user reg_u = new REG_user(i); reg_u.ShowDialog(); LoadScreen(); } }
private void btnViewUser_Click(object sender, RoutedEventArgs e) { if (TableValues(0) != null) { DAOUser dao = new DAOUser(); TOUser i = new TOUser(); i = dao.Selection(Int16.Parse(TableValues(0))); REG_user reg_u = new REG_user(i); reg_u.ShowDialog(); LoadScreen(); } }
public bool HouseSelection(TOUser user, int house) { MySqlConnection con = null; bool i = false; try { string sql = "update tbl_user set house_id = " + house + " where user_account = '" + user.Account + "';"; con = ConnectionFactory.Connection(); MySqlCommand cmd = new MySqlCommand(sql, con); con.Open(); cmd.ExecuteNonQuery(); con.Close(); string select = "select house_id from tbl_user where user_account = '" + user.Account + "';"; con.Open(); MySqlCommand command = new MySqlCommand(select, con); MySqlDataReader dtreader = command.ExecuteReader(); if (dtreader.Read())//If there's any data. { user.House = dtreader.GetInt16("house_id"); if (user.House == house) { i = true; } } } catch (MySqlException e) { throw new Exception(e.Message); } finally { con.Close(); } return(i); }
private void btnLogin_Click(object sender, RoutedEventArgs e) { DAOUser dao = new DAOUser(); TOUser ver = new TOUser(); ver = dao.Login(user.User_name, user.User_password); if (ver.User_id != 0) { ACTIndex index = new ACTIndex(ver); index.Show(); this.Close(); } else { Xceed.Wpf.Toolkit.MessageBox.Show("Crecendicais incorretas ou não cadastradas.", "Erro!", MessageBoxButton.OK, MessageBoxImage.Error, MessageBoxResult.OK); } }
public TOUser Login(string account, string password) { MySqlConnection con = null; TOUser i = new TOUser(); try { string sql = "select * from tbl_user where user_account = '" + account + "' and user_password = '******';"; con = ConnectionFactory.Connection(); MySqlCommand cmd = new MySqlCommand(sql, con); con.Open(); MySqlDataReader dtreader = cmd.ExecuteReader(); if (dtreader.Read())//If there's any data. { i.Id = dtreader.GetInt16("user_id"); i.Name = dtreader.GetString("user_name"); i.SirName = dtreader.GetString("user_sirName"); i.Account = dtreader.GetString("user_account"); i.House = dtreader.GetInt16("house_id"); i.Password = dtreader.GetString("user_password"); i.Email = dtreader.GetString("user_email"); i.Credit = dtreader.GetDouble("user_credit"); i.CreditSpent = dtreader.GetDouble("user_creditSpent"); i.CreditAvaliable = dtreader.GetDouble("user_creditAvaliable"); } else { } } catch (MySqlException e) { throw new Exception(e.Message); } finally { con.Close(); } return(i); }
public void LoadScreen(TOUser i, bool status) { //loads the quick menu. LoadMenu(); //loads the table. tblProduct.AutoGenerateColumns = false; tblProduct.ItemsSource = DAOProd.LoadProduct(i, status); lblCount.Content = tblProduct.Items.Count; if (status == false) { tblProduct.Columns[6].Visibility = Visibility.Hidden; } else { tblProduct.Columns[6].Visibility = Visibility.Visible; } }
public bool Registration(TOUser user) { MySqlConnection con = null; bool i = false; try { string sql = "insert into tbl_user(user_name, user_password, permission_id) values('" + user.User_name + "', '" + user.User_password + "', " + user.Permission_id + ");"; con = ConnectionFactory.Connection(); MySqlCommand cmd = new MySqlCommand(sql, con); con.Open(); cmd.ExecuteNonQuery(); con.Close(); string select = "select * from tbl_user where user_name = '" + user.User_name + "';"; con.Open(); MySqlCommand command = new MySqlCommand(select, con); MySqlDataReader dtreader = command.ExecuteReader(); if (dtreader.Read())//If there's any data. { //registration sucessful i = true; } } catch (MySqlException e) { throw new Exception(e.Message); } finally { con.Close(); } return(i); }
public bool Registration(TOProduct product, TOUser user) { bool i = false; try { string sql = @"insert into tbl_product(product_name, product_status, product_type, product_description, product_link, product_store, product_price, product_buyingDate, user_id, priority_id) values( '" + product.Name + "', " + product.Status + ", '" + product.Type + "', '" + product.Description + "', '" + product.Link + "', '" + product.Store + "', " + product.Price + ", '" + product.BuyingDate + "', " + user.Id + ", " + product.Priority + ");"; con = ConnectionFactory.Connection(); MySqlCommand cmd = new MySqlCommand(sql, con); con.Open(); cmd.ExecuteNonQuery(); con.Close(); string select = "select * from tbl_product where product_name = '" + product.Name + "';"; con.Open(); MySqlCommand command = new MySqlCommand(select, con); MySqlDataReader dtreader = command.ExecuteReader(); if (dtreader.Read())//If there's any data. { //registration sucessful i = true; } } catch (MySqlException e) { throw new Exception(e.Message); } finally { con.Close(); } return(i); }
public bool Update(TOUser user) { MySqlConnection con = null; bool i = false; try { string sql = @"update tbl_user set user_name = '" + user.User_name + "', user_password = '******', permission_id = " + user.Permission_id + " where user_id = " + user.User_id + ";"; con = ConnectionFactory.Connection(); MySqlCommand cmd = new MySqlCommand(sql, con); con.Open(); cmd.ExecuteNonQuery(); string select = "select * from tbl_user where user_name = '" + user.User_name + "';"; MySqlCommand command = new MySqlCommand(select, con); MySqlDataReader dtreader = command.ExecuteReader(); if (dtreader.Read())//If there's any data. { i = true; } else { i = false; } } catch (MySqlException e) { throw new Exception(e.Message); } finally { con.Close(); } return(i); }
public bool Registration(TOUser user) { MySqlConnection con = null; bool i = false; try { string sql = "insert into tbl_user(user_name, user_sirName, user_account, user_password, user_email, user_credit, user_creditSpent, user_creditAvaliable, house_id) values('" + user.Name + "', '" + user.SirName + "', '" + user.Account + "', '" + user.Password + "', '" + user.Email + "', " + user.Credit + ", 0, " + user.CreditAvaliable + ", 0)"; con = ConnectionFactory.Connection(); MySqlCommand cmd = new MySqlCommand(sql, con); con.Open(); cmd.ExecuteNonQuery(); con.Close(); string select = "select * from tbl_user where user_account = '" + user.Account + "';"; con.Open(); MySqlCommand command = new MySqlCommand(select, con); MySqlDataReader dtreader = command.ExecuteReader(); if (dtreader.Read()) //If there's any data. { //registration sucessful i = true; } } catch (MySqlException e) { throw new Exception(e.Message); } finally { con.Close(); } return(i); }
public bool Update(TOProduct product, TOUser user) { bool i = false; try { string sql = @"update tbl_product set product_id = " + product.Id + ", product_name = '" + product.Name + "', product_status = " + product.Status + ", product_type = '" + product.Type + "', product_description = '', product_link = '" + product.Link + "', product_store = '" + product.Store + "', product_price = " + product.Price + ", user_id = " + user.Id + ", priority_id = " + product.Priority + " where product_id = " + product.Id + ";"; con = ConnectionFactory.Connection(); MySqlCommand cmd = new MySqlCommand(sql, con); con.Open(); cmd.ExecuteNonQuery(); con.Close(); string select = "select * from tbl_product where product_id = '" + product.Id + "';"; con.Open(); MySqlCommand command = new MySqlCommand(select, con); MySqlDataReader dtreader = command.ExecuteReader(); if (dtreader.Read())//If there's any data. { //registration sucessful i = true; } } catch (MySqlException e) { throw new Exception(e.Message); } finally { con.Close(); } return(i); }
public ACTIndex(TOUser i) { user = i; InitializeComponent(); lblWellcome.Content = "Bem-vindo, " + user.User_name + "!"; if (user.Permission_id == 1) { } else if (user.Permission_id == 2) { btnCRUD_user.Visibility = Visibility.Hidden; } else if (user.Permission_id == 3) { btnCRUD_user.Visibility = Visibility.Hidden; btnCRUD_class.Visibility = Visibility.Hidden; } LoadIndex(); }
public List <TOProduct> SearchPrice(TOUser user, bool status, double lowPrice, double highPrice) { List <TOProduct> i = new List <TOProduct>(); string sql = @"select * from tbl_product where user_id = " + user.Id + " and product_status = " + status + " and product_price between " + lowPrice + " and " + highPrice + ";"; try { con = ConnectionFactory.Connection(); con.Open(); MySqlCommand cmd = new MySqlCommand(sql, con); MySqlDataReader dtreader = cmd.ExecuteReader(); while (dtreader.Read()) { TOProduct p = new TOProduct(); p.Id = dtreader.GetInt16("product_id"); p.Type = dtreader.GetString("product_type"); p.Name = dtreader.GetString("product_name"); p.Link = dtreader.GetString("product_link"); p.Store = dtreader.GetString("product_store"); p.Price = dtreader.GetDouble("product_price"); p.BuyingDate = dtreader.GetDateTime("product_buyingDate").ToString("dd-MM-yyyy"); i.Add(p); } con.Close(); } catch (MySqlException e) { throw new Exception(e.Message); } return(i); }
public TOUser Login(string name, string password) { TOUser i = new TOUser(); try { string sql = "select * from tbl_user where user_name = '" + name + "' and user_password = '******';"; con = ConnectionFactory.Connection(); MySqlCommand cmd = new MySqlCommand(sql, con); con.Open(); MySqlDataReader dtreader = cmd.ExecuteReader(); if (dtreader.Read())//If there's any data. { i.User_id = dtreader.GetInt16("user_id"); i.User_name = dtreader.GetString("user_name"); i.User_password = dtreader.GetString("user_password"); i.Permission_id = dtreader.GetInt16("permission_id"); } else { } } catch (MySqlException e) { throw new Exception(e.Message); } finally { con.Close(); } return(i); }
private void btnRegisterUser_Click(object sender, RoutedEventArgs e) { if (btnRegisterUser.Content.ToString() == "Editar") { txtUser.IsEnabled = true; psbPassword.IsEnabled = true; comboBox.IsEnabled = true; btnRegisterUser.Content = "Cadastrar"; } else { if (op != 0) { DAOUser dao = new DAOUser(); //setting values to user. user.User_name = txtUser.Text; user.User_password = psbPassword.Password; if (comboBox.SelectedItem == Administrador) { user.Permission_id = 1; } else if (comboBox.SelectedItem == Administração) { user.Permission_id = 2; } else if (comboBox.SelectedItem == Vendas) { user.Permission_id = 3; } else { user.Permission_id = 4; } if (dao.Update(user)) { Xceed.Wpf.Toolkit.MessageBox.Show("Usuário editado com sucesso!", "Sucesso!", MessageBoxButton.OK, MessageBoxImage.Information, MessageBoxResult.OK); this.Close(); } else { Xceed.Wpf.Toolkit.MessageBox.Show("Algo errado aconteceu durante a edição.", "Erro!", MessageBoxButton.OK, MessageBoxImage.Error, MessageBoxResult.OK); this.Close(); } } else { DAOUser dao = new DAOUser(); TOUser user = new TOUser(); //setting values to user. user.User_name = txtUser.Text; user.User_password = psbPassword.Password; if (comboBox.SelectedItem == Administrador) { user.Permission_id = 1; } else if (comboBox.SelectedItem == Administração) { user.Permission_id = 2; } else if (comboBox.SelectedItem == Vendas) { user.Permission_id = 3; } else { user.Permission_id = 4; } if (dao.Registration(user)) { Xceed.Wpf.Toolkit.MessageBox.Show("Usuário cadastrado com sucesso!", "Sucesso!", MessageBoxButton.OK, MessageBoxImage.Information, MessageBoxResult.OK); this.Close(); } else { Xceed.Wpf.Toolkit.MessageBox.Show("Algo errado aconteceu durante o cadastro.", "Erro!", MessageBoxButton.OK, MessageBoxImage.Error, MessageBoxResult.OK); this.Close(); } } } }
public ACTMessages(TOUser TOUser, string title, string message, int type) { InitializeComponent(); lblTitle.Content = title; lblMessage.Content = message; if (type == 1) { imgSucess.Visibility = Visibility.Visible; } else if (type == 2) { imgInformation.Visibility = Visibility.Visible; } else if (type == 3) { imgError.Visibility = Visibility.Visible; } if (TOUser.House == 1) { //background var a = new SolidColorBrush(Color.FromArgb(255, 212, 64, 64)); this.Background = a; //label var b = new SolidColorBrush(Color.FromArgb(255, 255, 209, 1)); lblColor.Background = b; //hermione. img1.Visibility = Visibility.Visible; } else if (TOUser.House == 2) { //background var a = new SolidColorBrush(Color.FromArgb(255, 200, 200, 200)); this.Background = a; //label var b = new SolidColorBrush(Color.FromArgb(255, 12, 63, 6)); lblColor.Background = b; //hermione. img2.Visibility = Visibility.Visible; } else if (TOUser.House == 3) { //background var a = new SolidColorBrush(Color.FromArgb(255, 0, 0, 0)); this.Background = a; //label var b = new SolidColorBrush(Color.FromArgb(255, 255, 243, 0)); lblColor.Background = b; //hermione. img3.Visibility = Visibility.Visible; } else if (TOUser.House == 4) { //background var a = new SolidColorBrush(Color.FromArgb(255, 200, 200, 200)); this.Background = a; //label var b = new SolidColorBrush(Color.FromArgb(255, 6, 9, 64)); lblColor.Background = b; //hermione. img4.Visibility = Visibility.Visible; } else { //background var a = new SolidColorBrush(Color.FromArgb(255, 58, 58, 60)); this.Background = a; //label var b = new SolidColorBrush(Color.FromArgb(255, 58, 58, 60)); lblColor.Background = b; } }
public ACTHouseSelection(TOUser user) { TOUser = user; InitializeComponent(); }