// set event to enable category button public void EnableDeleteCategoryButton() { if (_eventMealButtonClick != null) { _eventMealButtonClick(_orderControl.GetOrderList(), new EventArgs()); } }
// update data grid view public void UpdateDataGridView() { _recordDataGridView.Rows.Clear(); foreach (Order item in _orderControl.GetOrderList()) { _recordDataGridView.Rows.Add(item.GetMeal().Title, item.GetMeal().Category, item.GetMeal().Price, Convert.ToInt16(item.Quantity), item.Total, "x"); } _totalLabel.Text = "Total : " + _orderControl.CalculateTotal().ToString() + " NTD."; }
// is 未分類 or not //public void IsDefaultCategory(string name) //{ // const string CATEGORY_NAME = "未分類"; // if (name.Equals(CATEGORY_NAME)) // { // _isDeleteCategoryEnabled = _isSaveCategoryEnabled = false; // _isCategoryTextBoxReadOnly = true; // } // else // { // _isDeleteCategoryEnabled = _isSaveCategoryEnabled = true; // _isCategoryTextBoxReadOnly = false; // } // IsEmptyMealOfCategory(name); //} // check if order have meal in the category -- public void CheckOrderIfHaveMeal(string name) { _isDeleteCategoryEnabled = true; foreach (Order item in _orderControl.GetOrderList()) { if (item.GetMeal().Category.Equals(name)) { _isDeleteCategoryEnabled = false; } } }
public void GetOrderListTest() { List <Order> orderList = _orderControl.GetOrderList(); }