public Dialog_AddEditSubFamily() { InitializeComponent(); ControllerManagement = new ControllerManagement(); ControllerFurniture = new ControllerFurniture(); SetComboBox(); }
public Dialog_SelectionXML() { InitializeComponent(); ControllerFurniture = new ControllerFurniture(); DialogSelectionXML = this; ListException = new List <Exception>(); }
public Dialog_AddEditFamily(int RefFamily, string NameFamily) { InitializeComponent(); TextRefFamily.Text = RefFamily.ToString(); TextBox.Text = NameFamily; ControllerManagement = new ControllerManagement(); ControllerFurniture = new ControllerFurniture(); }
public Dialog_AddEditBrand(int RefBrand, string NameBrand) { InitializeComponent(); TextRefBrand.Text = RefBrand.ToString(); TextBox.Text = NameBrand; ControllerManagement = new ControllerManagement(); ControllerFurniture = new ControllerFurniture(); }
public Dialog_AddEditSubFamily(int RefSubFamily, string NameFamily, string NameSubFamily) { InitializeComponent(); TextRefSubFamily.Text = RefSubFamily.ToString(); SetComboBox(); Combobox.SelectedIndex = Combobox.FindStringExact(NameFamily); TextBox.Text = NameSubFamily; ControllerManagement = new ControllerManagement(); ControllerFurniture = new ControllerFurniture(); }
/// <summary> /// Get or create a sub family /// </summary> /// <param name="RefSubFamily"> The SubFamily id </param> /// <returns> The id of sub family </returns> public int GetOrCreateSubFamily(string SubFamilyName, string FamilyName) { // Check SubFamily syntax SubFamily SubFamily; SubFamily = ControllerFurniture.CheckSubFamilySyntax(SubFamilyName); int LastRefSubFamily = 0; // Create if it does not exist if (SubFamily == null) { SQLiteCommand QueryTestExist = new SQLiteCommand(); QueryTestExist.Connection = SingletonBD.GetInstance.GetDB(); QueryTestExist.CommandText = "SELECT COUNT(*) FROM SousFamilles;"; SQLiteDataReader TestExistReader = QueryTestExist.ExecuteReader(); TestExistReader.Read(); if (TestExistReader.GetInt32(0) != 0) { SQLiteCommand QueryLastInsertId = new SQLiteCommand(); QueryLastInsertId.Connection = SingletonBD.GetInstance.GetDB(); QueryLastInsertId.CommandText = "SELECT MAX(RefSousFamille) FROM SousFamilles;"; SQLiteDataReader LastIdReader = QueryLastInsertId.ExecuteReader(); LastIdReader.Read(); LastRefSubFamily = LastIdReader.GetInt32(0); } else { LastRefSubFamily = 0; } // Get Family for this SubFamily int IdFamily = GetOrCreateFamily(FamilyName); SQLiteCommand QueryCreateModify = new SQLiteCommand(); QueryCreateModify.Connection = SingletonBD.GetInstance.GetDB(); // Insert new sub family QueryCreateModify.CommandText = "INSERT INTO SousFamilles (RefSousFamille, RefFamille, Nom) VALUES (@RefSousFamille, @RefFamille, @RefNom);"; QueryCreateModify.Parameters.AddWithValue("@RefSousFamille", LastRefSubFamily + 1); QueryCreateModify.Parameters.AddWithValue("@RefFamille", IdFamily); QueryCreateModify.Parameters.AddWithValue("@RefNom", SubFamilyName); QueryCreateModify.ExecuteNonQuery(); LastRefSubFamily++; return(LastRefSubFamily); } return(SubFamily.GetSetIdSubFamily); }
public Dialog_AddEditArticle(string RefArticle, string Description, string Brand, string Family, string SubFamily, double Price, int Quantity) { InitializeComponent(); ControllerFurniture = new ControllerFurniture(); InitTextBox(); TextBoxRefArticle.Enabled = false; TextBoxRefArticle.Text = RefArticle; TextBoxDescription.Text = Description; ComboBoxBrand.SelectedIndex = ComboBoxBrand.FindStringExact(Brand); ComboBoxFamily.SelectedIndex = ComboBoxFamily.FindStringExact(Family); ComboBoxSubFamily.SelectedIndex = ComboBoxSubFamily.FindStringExact(SubFamily); TextBoxPrice.Text = Price.ToString(); TextBoxQuantity.Text = Quantity.ToString(); }
public MainWindow() { InitializeComponent(); MainWindowForm = this; // Initialise the ListView ListViewArticles.Columns.Add("RefArticle"); ListViewArticles.Columns.Add("Description"); ListViewArticles.Columns.Add("Brand"); ListViewArticles.Columns.Add("SubFamily"); ListViewArticles.Columns.Add("Price"); ListViewArticles.Columns.Add("Quantity"); ControllerFurniture = new ControllerFurniture(); ControllerFurniture.RefreshListView(-1); }
/// <summary> /// Get or create brand /// </summary> /// <param name="BrandName"> The brand name </param> /// <returns> The brand id </returns> public int GetOrCreateBrand(string BrandName) { // Check family syntax Brand Brand; Brand = ControllerFurniture.CheckBrandSyntax(BrandName); int LastRefBrand = 0; // Create if it does not exist if (Brand == null) { SQLiteCommand QueryTestExist = new SQLiteCommand(); QueryTestExist.Connection = SingletonBD.GetInstance.GetDB(); QueryTestExist.CommandText = "SELECT COUNT(*) FROM Marques;"; SQLiteDataReader TestExistReader = QueryTestExist.ExecuteReader(); TestExistReader.Read(); if (TestExistReader.GetInt32(0) != 0) { SQLiteCommand QueryLastInsertId = new SQLiteCommand(); QueryLastInsertId.Connection = SingletonBD.GetInstance.GetDB(); QueryLastInsertId.CommandText = "SELECT MAX(RefMarque) FROM Marques;"; SQLiteDataReader LastIdReader = QueryLastInsertId.ExecuteReader(); LastIdReader.Read(); LastRefBrand = LastIdReader.GetInt32(0); } else { LastRefBrand = 0; } // Insert new brand SQLiteCommand QueryInsertBrand = new SQLiteCommand(); QueryInsertBrand.Connection = SingletonBD.GetInstance.GetDB(); QueryInsertBrand.CommandText = "INSERT INTO Marques (RefMarque, Nom) VALUES (@RefMarque, @RefNom);"; QueryInsertBrand.Parameters.AddWithValue("@RefMarque", ++LastRefBrand); QueryInsertBrand.Parameters.AddWithValue("@RefNom", BrandName); QueryInsertBrand.ExecuteNonQuery(); return(LastRefBrand); } return(Brand.GetSetIdBrand); }
/// <summary> /// Get of create family /// </summary> /// <param name="FamilyName"> The Family name </param> /// <returns> The id of family </returns> public int GetOrCreateFamily(string FamilyName) { // Check family syntax Family Family; Family = ControllerFurniture.CheckFamilySyntax(FamilyName); int LastRefFamily = 0; if (Family == null) { SQLiteCommand QueryTestExist = new SQLiteCommand(); QueryTestExist.Connection = SingletonBD.GetInstance.GetDB(); QueryTestExist.CommandText = "SELECT COUNT(*) FROM Familles;"; SQLiteDataReader TestExistReader = QueryTestExist.ExecuteReader(); TestExistReader.Read(); if (TestExistReader.GetInt32(0) != 0) { SQLiteCommand QueryLastInsertId = new SQLiteCommand(); QueryLastInsertId.Connection = SingletonBD.GetInstance.GetDB(); QueryLastInsertId.CommandText = "SELECT MAX(RefFamille) FROM Familles;"; SQLiteDataReader LastIdReader = QueryLastInsertId.ExecuteReader(); LastIdReader.Read(); LastRefFamily = LastIdReader.GetInt32(0); } else { LastRefFamily = 0; } SQLiteCommand QueryCreateModify = new SQLiteCommand(); QueryCreateModify.Connection = SingletonBD.GetInstance.GetDB(); // Insert new family QueryCreateModify.CommandText = "INSERT INTO Familles (RefFamille, Nom) VALUES (@RefFamille, @RefNom);"; QueryCreateModify.Parameters.AddWithValue("@RefFamille", ++LastRefFamily); QueryCreateModify.Parameters.AddWithValue("@RefNom", FamilyName); QueryCreateModify.ExecuteNonQuery(); return(LastRefFamily); } return(Family.GetSetIdFamily); }
public Dialog_AddEditArticle() { InitializeComponent(); ControllerFurniture = new ControllerFurniture(); InitTextBox(); }
public Dialog_AddEditBrand() { InitializeComponent(); ControllerManagement = new ControllerManagement(); ControllerFurniture = new ControllerFurniture(); }