Exemplo n.º 1
0
        //Delete
        public void Delete(string departmentId, string sectionId, string kpiId)
        {
            MenuTable menuTable = db.MenuTables.Find(departmentId, sectionId, kpiId);

            db.MenuTables.Remove(menuTable);
            Save();
        }
Exemplo n.º 2
0
        private void AddMenuItem(ToolStripItemCollection destinationItems, System.Windows.Controls.MenuItem menuItem)
        {
            string MenuHeader = (string)menuItem.Header;

            ToolStripMenuItem NewMenuItem;

            if (menuItem.Icon is Bitmap MenuBitmap)
            {
                NewMenuItem = new ToolStripMenuItem(MenuHeader, MenuBitmap);
            }

            else if (menuItem.Icon is Icon MenuIcon)
            {
                NewMenuItem = new ToolStripMenuItem(MenuHeader, MenuIcon.ToBitmap());
            }

            else
            {
                NewMenuItem = new ToolStripMenuItem(MenuHeader);
            }

            NewMenuItem.Click += OnMenuClicked;
            // See PrepareMenuItem for using the visibility to carry Visible/Enabled flags
            NewMenuItem.Visible = (menuItem.Visibility != System.Windows.Visibility.Collapsed);
            NewMenuItem.Enabled = (menuItem.Visibility == System.Windows.Visibility.Visible);
            NewMenuItem.Checked = menuItem.IsChecked;

            destinationItems.Add(NewMenuItem);
            MenuTable.Add(NewMenuItem, this);
            CommandTable.Add(NewMenuItem, menuItem.Command);
        }
Exemplo n.º 3
0
        public async Task <ActionResult> DeleteConfirmed(int id)
        {
            MenuTable menuTable = await db.MenuTables.FindAsync(id);

            db.MenuTables.Remove(menuTable);
            await db.SaveChangesAsync();

            return(RedirectToAction("Index"));
        }
Exemplo n.º 4
0
        public async Task <ActionResult> Edit([Bind(Include = "Id,CodeId,Name,SuperiorCodeId,MenuPath,CreateTime,IsRemoved")] MenuTable menuTable)
        {
            if (ModelState.IsValid)
            {
                db.Entry(menuTable).State = EntityState.Modified;
                await db.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }
            return(View(menuTable));
        }
Exemplo n.º 5
0
 private static void OnMenuClicked(ToolStripMenuItem menuItem)
 {
     if (MenuTable.ContainsKey(menuItem) && CommandTable.ContainsKey(menuItem))
     {
         TaskbarIcon TaskbarIcon = MenuTable[menuItem];
         if (CommandTable[menuItem] is RoutedCommand Command && TaskbarIcon.Target != null)
         {
             Command.Execute(TaskbarIcon, TaskbarIcon.Target);
         }
     }
 }
Exemplo n.º 6
0
        public List <MenuTable> getListMenuByTable(int id)
        {
            List <MenuTable> menuList = new List <MenuTable>();
            DataTable        data     = DataProvider.Instance.ExecuteQuery("EXEC dbo.USP_GetFood_Bill_InfoBill @idTable", new object[] { id });

            foreach (DataRow item in data.Rows)
            {
                MenuTable menuTable = new MenuTable(item);
                menuList.Add(menuTable);
            }
            return(menuList);
        }
Exemplo n.º 7
0
        public List <MenuTable> GetMenu(int id)
        {
            string           query    = "SELECT dbo.Drinks.name , dbo.Drinks.id, dbo.BillInfo.count, dbo.Drinks.price, dbo.Drinks.price * dbo.BillInfo.count AS TotalPrice FROM dbo.Drinks,dbo.Bill,dbo.BillInfo WHERE dbo.Bill.status = 0 and dbo.Bill.id = dbo.BillInfo.idBill AND dbo.BillInfo.idDrinks = dbo.Drinks.id AND dbo.Bill.idTable = " + id;
            List <MenuTable> listmenu = new List <MenuTable>();
            DataTable        data     = DataProvider.Instance.ExcuteQuery(query);

            foreach (DataRow item in data.Rows)
            {
                MenuTable menu = new MenuTable(item);
                listmenu.Add(menu);
            }
            return(listmenu);
        }
Exemplo n.º 8
0
        // GET: MenuTables/Delete/5
        public async Task <ActionResult> Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            MenuTable menuTable = await db.MenuTables.FindAsync(id);

            if (menuTable == null)
            {
                return(HttpNotFound());
            }
            return(View(menuTable));
        }
Exemplo n.º 9
0
    private IEnumerator InitCo()
    {
        // 카드 생성
        MakeCardGroup();

        // 설명입력
        var menuInfo = MenuTable.GetAt(menuType);

        explaineText.text = menuInfo.Explaine;

        animation.Play("In");
        yield return(new WaitForSeconds(0.5f));

        // 모든 카드 랜덤한 시간에 애니메이션
        AllCardRotation();
    }
Exemplo n.º 10
0
        public AjaxResult Save(MenuTable old, MenuTable model)
        {
            bool addFlag = model.ID < 1;
            var  user    = log.User;

            model.CREATEBY   = user.ACCOUNT;
            model.CREATEDATE = DateTime.Now;
            model.UPDATEBY   = model.CREATEBY;
            model.UPDATEDATE = model.CREATEDATE;
            model.ENABLED    = true;
            if (addFlag)
            {
                bool existFlag = tableRep.Exist(m => m.DBNAME == model.DBNAME && m.TABLENAME == model.TABLENAME && m.ALIASNAME == model.ALIASNAME && m.ENABLED == true);
                if (existFlag)
                {
                    return(new AjaxResult(false, "已经存在该菜单表"));
                }
                int        tableId = tableRep.Add <int>(model);
                bool       flag    = tableId > 0;
                ActionType type    = ActionType.SYS_ADD;
                string     msg     = WebConst.GetActionMsg(type, flag);
                log.AppendAdd("库名", model.DBNAME).AppendAdd("架构名", model.SCHEMANAME).AppendAdd("表名", model.TABLENAME).AppendAdd("别名", model.ALIASNAME).AddSystem(type, tableId);
                return(new AjaxResult(flag, msg));
            }
            else
            {
                bool existFlag = tableRep.Exist(m => m.ID != model.ID && m.DBNAME == model.DBNAME && m.TABLENAME == model.TABLENAME && m.ALIASNAME == model.ALIASNAME && m.ENABLED == true);
                if (existFlag)
                {
                    return(new AjaxResult(false, "已经存在该菜单表"));
                }
                bool flag = tableRep.Update(model, m => new
                {
                    m.DBNAME,
                    m.TABLENAME,
                    m.SCHEMANAME,
                    m.SORTID,
                    m.ALIASNAME
                }, m => m.ID == model.ID);

                ActionType type = ActionType.SYS_UPDATE;
                string     msg  = WebConst.GetActionMsg(type, flag);
                log.AppendUpdate("库名", old.DBNAME, model.DBNAME).AppendUpdate("架构名", old.SCHEMANAME, model.SCHEMANAME).AppendUpdate("表名", old.TABLENAME, model.TABLENAME).AppendUpdate("别名", old.ALIASNAME, model.ALIASNAME).AddSystem(type, model.ID);
                return(new AjaxResult(flag, msg));
            }
        }
Exemplo n.º 11
0
        /*
         * Adds to menu table in azure
         */
        public async void AddItem(object sendeer, EventArgs e)
        {
            PromptConfig popup = new PromptConfig(); // to setup a prompt

            popup.SetOkText("Ok");
            popup.SetMessage("Enter a menu title");
            // Promt user for menu title
            PromptResult test = await UserDialogs.Instance.PromptAsync(popup);

            menuTitle = test.Text;  // get the user input for the menu title field
            // new menuTable object
            MenuTable mt = new MenuTable()
            {
                MenuName   = menuTitle,
                Desc       = foodNames,
                TotalPrice = total
            };
            // add items to azure table
            await AzureManager.AzureManagerInstance.AddMenu(mt);
        }
Exemplo n.º 12
0
        private void updateBtn_Click(object sender, RoutedEventArgs e)
        {
            MenuTable        curDish    = (MenuGrid.SelectedItem as MenuTable);
            Button           btn        = (Button)sender;
            ConfirmReadiness confWindow = new ConfirmReadiness("Ви підтверджуєте зміни?");

            if (confWindow.ShowDialog() == true && btn.IsEnabled)
            {
                menu curMenuItem = _db.getDishInfo(curDish.menu_id).Single();
                curMenuItem.price     = curDish.price;
                curMenuItem.dish_name = curDish.name;
                curMenuItem.size      = curDish.size;
                _db.SaveChanges();
                MenuGrid.ItemsSource = GetItems(typeId);
                MessageBox.Show("Зміни успішно збережено");
            }
            else
            {
                confWindow.Hide();
            }
        }
Exemplo n.º 13
0
        // Read line then Try to parse to int; if exception is thrown call InvalidSelection(); otherwise call Action<int> handler for the menuID given in selector
        static void ReadSelection()
        {
            Console.Write("Selector: ");
            string input    = Console.ReadLine();
            int    selector = -1;

            try {
                Int32.TryParse(input, out selector);
            }
            catch {
                InvalidSelection();
            }
            if (MenuTable.ContainsKey(selector))
            {
                MenuTable[selector].Item2(selector);
                ShowMenu();
            }
            else
            {
                InvalidSelection();
            }
        }
Exemplo n.º 14
0
 //Insert
 public void Insert(MenuTable menuTable)
 {
     objDb.Insert(menuTable);
 }
Exemplo n.º 15
0
        public ActionResult Save(MenuTable old, MenuTable model)
        {
            var result = table.Save(old, model);

            return(Json(result));
        }
Exemplo n.º 16
0
 /**
  * Add a menutable item to the table in azure
  */
 public async Task AddMenu(MenuTable menuTable)
 {
     await this.menuTable.InsertAsync(menuTable);
 }
Exemplo n.º 17
0
 /**
  * Delete data from table
  */
 public async Task RemoveMenu(MenuTable menuTable)
 {
     await this.menuTable.DeleteAsync(menuTable);
 }
Exemplo n.º 18
0
    public static void Main()
    {
        // Mapper config
        Mapper.Initialize(cfg => {});

        // sample Data
        var menuTable1 = new MenuTable()
        {
            MenuProp1 = "Menu1"
        };
        var menuTable2 = new MenuTable()
        {
            MenuProp1 = "Menu2"
        };
        var roleTable1 = new RoleTable()
        {
            RoleProp1 = "Role1"
        };
        var roleTable2 = new RoleTable()
        {
            RoleProp1 = "Role2"
        };

        // Map by property name
        var target = Mapper.Map <Menu>(menuTable1);

        Console.WriteLine("Map by property by name: " + target.MenuProp1);
        Console.WriteLine();
        // result: "Map by property by name: Menu1"
        // Map KeyValuePair
        var kvpSource = new KeyValuePair <MenuTable, RoleTable>(menuTable1, roleTable1);
        var kvpTarget = Mapper.Map <KeyValuePair <Menu, Role> >(kvpSource);

        Console.WriteLine("Map KeyValuePair: " + kvpTarget.Key.MenuProp1 + " - " + kvpTarget.Value.RoleProp1);
        Console.WriteLine();
        // result: "Map KeyValuePair: Menu1 - Role1"

        // Map List
        var listSource = new List <MenuTable>()
        {
            menuTable1, menuTable2
        };
        var listTarget = Mapper.Map <List <Menu> >(listSource);

        foreach (var item in listTarget)
        {
            Console.WriteLine("Map List:" + item.MenuProp1);
        }
        Console.WriteLine();
        // result:
        // Map List:Menu1
        // Map List:Menu2

        // Combination
        var combinedSource = new List <KeyValuePair <MenuTable, List <RoleTable> > >()
        {
            new KeyValuePair <MenuTable, List <RoleTable> >(menuTable1, new List <RoleTable>()
            {
                roleTable1
            }),
            new KeyValuePair <MenuTable, List <RoleTable> >(menuTable2, new List <RoleTable>()
            {
                roleTable2
            })
        };

        var combinedTarget = Mapper.Map <List <KeyValuePair <Menu, List <Role> > > >(combinedSource);

        foreach (var item in combinedTarget)
        {
            Console.WriteLine("Combined: " + item.Key.MenuProp1 + " - " + item.Value.First().RoleProp1);
        }
        // result:
        // Combined: Menu1 - Role1
        // Combined: Menu2 - Role2
    }
Exemplo n.º 19
0
 //Update
 public void Update(MenuTable menuTable)
 {
     db.Entry(menuTable).State = EntityState.Modified;
     Save();
 }
Exemplo n.º 20
0
 //Insert
 public void Insert(MenuTable menuTable)
 {
     db.MenuTables.Add(menuTable);
     Save();
 }
Exemplo n.º 21
0
 //Update
 public void Update(MenuTable menuTable)
 {
     objDb.Update(menuTable);
 }
Exemplo n.º 22
0
 // Add MenuItem to MenuTable using Count+1 as the ID (so the menu begins from 1 instead of 0) and a Tuple made out of String str and Action<int> fn
 static void AddMenuItem(String str, Action <int> fn)
 {
     MenuTable.Add(MenuTable.Count + 1, (str, fn));
 }