public int UpdateMenuCategory(MenuCategoryData menuCategory)
 {
     Dictionary<string, object> sqlStoredProcedureParams = new Dictionary<string, object>();
     sqlStoredProcedureParams.Add("maLoaiMon", menuCategory.MenuCategoryId);
     sqlStoredProcedureParams.Add("tenLoaiMon", menuCategory.MenuCategoryName);
     return provider.ExecuteNonQuery("LOAIMON_proc_update", sqlStoredProcedureParams);
 }
Exemplo n.º 2
0
        public List<MenuItemData> GetAllMenuItem(MenuCategoryData menuCategory)
        {
            List<MenuItemData> listMenuItem = new List<MenuItemData>();
            Dictionary<string, object> sqlStoredProcedureParams = new Dictionary<string, object>();
            sqlStoredProcedureParams.Add("maLoaiMon", menuCategory.MenuCategoryId);
            DataTable dt = provider.ExecuteReader("MONAN_proc_load_with_MaLoaiMon", sqlStoredProcedureParams);

            foreach (DataRow row in dt.Rows)
            {
                MenuItemData MenuItem = new MenuItemData();
                MenuItem.MenuItemId = row["MaMonAn"].ToString();
                MenuItem.MenuItemName = row["TenMonAn"].ToString();
                MenuItem.ImagePath = row["HinhAnh"].ToString();
                MenuItem.Price = Decimal.Parse(row["DonGia"].ToString());

                MenuItem.Unit = new UnitData
                {
                    UnitId = row["MaDonVi"].ToString(),
                    UnitName = row["TenDonVi"].ToString()
                };

                MenuItem.MenuCategory = new MenuCategoryData
                {
                    MenuCategoryId = row["MaLoaiMon"].ToString(),
                    MenuCategoryName = row["TenLoaiMon"].ToString()
                };

                listMenuItem.Add(MenuItem);
            }

            return listMenuItem;
        }
        public List<MenuCategoryData> GetAllMenuCategory()
        {
            List<MenuCategoryData> listMenuCategory = new List<MenuCategoryData>();

            DataTable dt = provider.ExecuteReader("LOAIMON_proc_load");

            foreach (DataRow row in dt.Rows)
            {
                MenuCategoryData menuCategory = new MenuCategoryData();
                menuCategory.MenuCategoryId = row["MaLoaiMon"].ToString();
                menuCategory.MenuCategoryName = row["TenLoaiMon"].ToString();

                listMenuCategory.Add(menuCategory);
            }

            return listMenuCategory;
        }
Exemplo n.º 4
0
        private void btnDongY_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(txtTenLoaiMon.Text.Trim()))
            {
                MessageDialogHelper.CreateErrorMessage("Tên loại món ăn không được để trống.");
                return;
            }

            MenuCategoryData menuCategoryData = new MenuCategoryData();
            menuCategoryData.MenuCategoryName = txtTenLoaiMon.Text.Trim();
            LocatorBll.MenuCategoryAndMenuItemBll.MenuCategoryToSave = menuCategoryData;

            if (LocatorBll.MenuCategoryAndMenuItemBll.AddMenuCategory())
            {
                if (MessageDialogHelper.CreateInformationMessage("Lưu thành công.") == DialogResult.OK)
                    this.Close();
            }
        }