private void PopulateMenu(int IdReception) { using (ProjetSGBDEntities context = new ProjetSGBDEntities()) { IQueryable <GetMenu_Result> Starters = context.GetMenu(IdReception, DishTypeStarter); IQueryable <GetMenu_Result> MainCourse = context.GetMenu(IdReception, DishTypeMainDish); IQueryable <GetMenu_Result> Desserts = context.GetMenu(IdReception, DishTypeDessert); dataGridViewDessert.DataSource = Desserts.ToList(); foreach (DataGridViewColumn colum in dataGridViewDessert.Columns) { colum.Visible = false; } dataGridViewDessert.Columns[1].Visible = true; dataGridViewMainCourse.DataSource = MainCourse.ToList(); foreach (DataGridViewColumn colum in dataGridViewMainCourse.Columns) { colum.Visible = false; } dataGridViewMainCourse.Columns[1].Visible = true; dataGridViewStarter.DataSource = Starters.ToList(); foreach (DataGridViewColumn colum in dataGridViewStarter.Columns) { colum.Visible = false; } dataGridViewStarter.Columns[1].Visible = true; } }
public void PopulateList(int recId, int dtyId, ClientSelection client) { IQueryable <GetMenu_Result> dishes; CurrentClient = client; int DishTypeStarter = Int32.Parse(ConfigurationManager.AppSettings["DishTypeStarter"]); int DishTypeMainDish = Int32.Parse(ConfigurationManager.AppSettings["DishTypeMainDish"]); int DishTypeDessert = Int32.Parse(ConfigurationManager.AppSettings["DishTypeDessert"]); using (ProjetSGBDEntities context = new ProjetSGBDEntities()) { dishes = context.GetMenu(recId, dtyId); dataGridViewDish.DataSource = dishes.ToList(); foreach (DataGridViewColumn colum in dataGridViewDish.Columns) { colum.Visible = false; } dataGridViewDish.Columns[1].Visible = true; } if (dtyId == DishTypeStarter) { labelSelection.Text = "Nouvelle entrée :"; } else if (dtyId == DishTypeMainDish) { labelSelection.Text = "Nouveau plat principal :"; } else if (dtyId == DishTypeDessert) { labelSelection.Text = "Nouveau dessert :"; } }
private void PopulateStarters() { using (ProjetSGBDEntities context = new ProjetSGBDEntities()) { dataGridViewStarters.DataSource = context.GetMenu(currentReception.ReceptionId, DishTypeStarter).ToList(); } foreach (DataGridViewColumn colum in dataGridViewStarters.Columns) { colum.Visible = false; } dataGridViewStarters.Columns[1].Visible = true; }