//构造函数 public MenuCatgoryForm(BathDBDataContext dc, Catgory curCat) { db = dc; if (curCat != null) { newCat = false; m_cat = curCat; } InitializeComponent(); }
partial void DeleteCatgory(Catgory instance);
partial void UpdateCatgory(Catgory instance);
partial void InsertCatgory(Catgory instance);
//创建菜单类别界面 private void createMenuTypePanel() { cPanel.Controls.Clear(); bool first = true; int x = 10; int y = 9; //createButton(x, y, "技师", cPanel, 1, Color.Blue); //x += 80; //var typeLst = db.Catgory.Select(s => s.name); for (int i = m_index; i < typeList.Count(); i++ ) { Color color = first ? Color.Orange : Color.Blue; first = false; createButton(x, y, typeList.ToArray()[i], cPanel, 1, color); x += 80; } m_Catgory = db.Catgory.FirstOrDefault(z => z.name == typeList[0]); createMenuPanel(); }
//点击菜式类别 private void btnType_Click(object sender, EventArgs e) { Button btn = sender as Button; foreach (Control c in cPanel.Controls) c.BackColor = Color.Blue; btn.BackColor = Color.Orange; m_Catgory = db.Catgory.FirstOrDefault(x => x.name == btn.Text); createMenuPanel(); }