//Création TypeCuisine avec l'objet "t" passé en paramètre public static bool Create(TypeCuisine t) { //Création d'une typescuisineRow et remplissage avec les attributs de "t" OdawaDS.typescuisineRow newRow = DataProvider.odawa.typescuisine.NewtypescuisineRow(); newRow.type = t.type; newRow.description = t.description; //Envoi à la DAL try { DataProvider.CreateTypeCuisine(newRow); //Si création ok, renvoie true return(true); } catch (System.Data.SqlClient.SqlException ex) { //si SqlException, log et renvoie false LogManager.LogSQLException(ex.Message); return(false); } }
//Mise à jour d'un TypeCuisine "t" passé en paramètre public static bool Update(TypeCuisine t) { OdawaDS.typescuisineDataTable dt = DataProvider.GetTypesCuisine(); //Création d'une typescuisineRow et remplissage avec les attributs de "t" OdawaDS.typescuisineRow updRow = DataProvider.odawa.typescuisine.NewtypescuisineRow(); updRow.id = t.id; updRow.type = t.type; updRow.description = t.description; //Envoi à la DAL try { DataProvider.UpdateTypeCuisine(updRow); //Si update ok, renvoie true return(true); } catch (System.Data.SqlClient.SqlException ex) { //Si SqlException, log et renvoie false LogManager.LogSQLException(ex.Message); return(false); } }
//Mise à jour d'un type de cuisine public static void UpdateTypeCuisine(OdawaDS.typescuisineRow t) { odawa.typescuisine.FindByid(t.id).type = t.type; odawa.typescuisine.FindByid(t.id).description = t.description; WriteToDB("typescuisine"); }
//Création d'un type de cuisine public static void CreateTypeCuisine(OdawaDS.typescuisineRow t) { odawa.typescuisine.Rows.Add(t); WriteToDB("typescuisine"); }