private void Categories() { CategoryMenu CategoryMenu = new CategoryMenu(_filteringInstance); CategoryMenu.Display(); CategoryMenu.InvokeAction(UserInput.CatchPositiveInt("Type option: ")); }
protected void Page_Load(object sender, EventArgs e) { //if (!IsPostBack) { AttachPresenter(); Presenter.UpdateTree(); CategoryMenu.DataBind(); } }
private void AddItem_Load(object sender, EventArgs e) { sqlConn.ConnectionString = Properties.Settings.Default.blingdb; SQLiteDataReader reader = null; /* * catkey INTEGER PRIMARY KEY AUTOINCREMENT, * income INTEGER NOT NULL, * name VARCHAR(50) NOT NULL, * descr TEXT */ string command = "select `catkey`, `name` from nts_budget_category where `income` = 0;"; sqlConn.Open(); sqlDoReport.CommandText = command; reader = sqlDoReport.ExecuteReader(); CategoryMenu.BeginUpdate(); ArrayList categories = new ArrayList(); //int i; //string s = ""; //while (reader.Read()) //{ // i = (int)(reader[1]); // s = (string)(reader[2]); // MessageBox.Show(s); // categories.Add(new BudgetCategory(i, s)); //} //MessageBox.Show("test"); categories.Add(new BudgetCategory(1, "Income")); categories.Add(new BudgetCategory(2, "Bills")); categories.Add(new BudgetCategory(3, "Groceries")); categories.Add(new BudgetCategory(4, "Electricity")); categories.Add(new BudgetCategory(5, "Rent/Mortgage")); categories.Add(new BudgetCategory(6, "Entertainment")); categories.Add(new BudgetCategory(7, "Phone")); CategoryMenu.DataSource = categories; CategoryMenu.DisplayMember = "Text"; CategoryMenu.ValueMember = "Value"; //CategoryMenu.Sorted = true; CategoryMenu.EndUpdate(); CategoryMenu.ClearSelected(); reader.Close(); sqlConn.Close(); }
public void PlayButton() { CategoryMenu.SetActive(true); playButton.SetActive(false); AddQuestionButton.SetActive(false); AddCategoryButton.SetActive(false); exitButton.SetActive(false); quiz.SetActive(false); AddQuestionLayout.SetActive(false); AddCategoryLayout.SetActive(false); }
public void ScoreboardButton() { playButton.SetActive(false); AddQuestionButton.SetActive(false); AddCategoryButton.SetActive(false); exitButton.SetActive(false); CategoryMenu.SetActive(false); quiz.SetActive(false); scoreboard.SetActive(true); AddQuestionLayout.SetActive(false); AddCategoryLayout.SetActive(false); }
public ActionResult EditCategory(int?id) { if (id == null) { return(NotFound()); } CategoryMenu category = repository.GetCategory(id.Value); ViewBag.Types = new SelectList(repository.Types, "Id", "Name", category.TypeId); ViewBag.Menu = repository.GetMenuForCategoryId(id.Value); return(View(category)); }
public static void Menu() { bool shouldNotExit = true; while (shouldNotExit) { Clear(); SetCursorPosition(MenuCursorPosLeft, MenuCursorPosTop); WriteLine("1. Products"); SetCursorPosition(MenuCursorPosLeft, MenuCursorPosTop + 1); WriteLine("2. Categories"); SetCursorPosition(MenuCursorPosLeft, MenuCursorPosTop + 2); WriteLine("3. Exit"); ConsoleKeyInfo keyPressed = ReadKey(true); switch (keyPressed.Key) { case ConsoleKey.D1: Clear(); ProductMenu.Menu(); break; case ConsoleKey.D2: Clear(); CategoryMenu.Menu(); break; case ConsoleKey.D3: Clear(); shouldNotExit = false; break; } } }
public ActionResult EditCategory(int id, [Bind("Id,Name, ")] CategoryMenu category) { if (id != category.Id) { return(NotFound()); } if (ModelState.IsValid) { repository.EditCategory(id, category); return(RedirectToAction(nameof(Menu))); } return(View(category)); }
public List <SportMenu> CreateSportMenu() { var sportMenuList = new List <SportMenu>(); foreach (var config in _dataService.EnableConfigurations) { var sportMenu = new SportMenu { ConfigurationId = config.ConfigurationId, ConfigurationName = config.Name }; var sports = _dataService.SportWithMatches; var sportList = new List <SportMenuItem>(sports.Count); foreach (var sport in sports) { var spItem = new SportMenuItem() { SportName = sport.Name, }; var matchCount = 0; var sportCat = sport.Categories.ToList(); var categories = new List <CategoryMenu>(sportCat.Count); foreach (var cat in sportCat) { var matches = _dataService.FilterDisabledMatches(cat.Matches, config.ConfigurationId) .Select(t => t.Name).ToList(); var categoryMenu = new CategoryMenu { CategoryName = cat.Name, Mathces = matches, MatchCount = matches.Count }; categories.Add(categoryMenu); matchCount += matches.Count; } spItem.Categories = categories; spItem.MatchCount = matchCount; sportList.Add(spItem); } sportMenu.SportList = sportList; sportMenuList.Add(sportMenu); } return(sportMenuList); }
public ActionResult CreateCategory(CategoryMenu category, string action) { if (action.Equals("cancel")) { return(RedirectToAction("Types")); } if (action.Equals("Отправить")) { if (ModelState.IsValid) { repository.CreateCategory(category); return(RedirectToAction("Types")); } } return(NotFound()); }
//display categories and init choosing it private void ShowCategoryMenu() { ClearAnswersLabels(); startBTN.Enabled = false; //get page with categories var page = CategoryMenu.GetNextPage(); //walk through ppage and assign categories from page for (int i = 0; i < 4; i++) { if (page.Length > i) { answersTXT[i].Text = page[i]; answersTXT[i].Cursor = Cursors.Hand; } } }
private void AddButton_Click(object sender, EventArgs e) { //MessageBox.Show(CategoryMenu.Text); if (checkInput()) { // create a new BudgetItem BudgetItem newItem = new BudgetItem (Convert.ToDateTime(dateTimePicker1.Text), CategoryMenu.Text, DescriptionTextBox.Text, float.Parse(AmountTextBox.Text)); // add item to DB int ukey = Properties.Settings.Default.userkey; string command = "insert into nts_budget_items(`userkey`, `date`, `name`, `amount`, `catkey`) values(" + ukey + ", " + dateTimePicker1.Value.ToString("yyyyMMdd") + ",\"" + DescriptionTextBox.Text + "\"," + AmountTextBox.Text + ", " + CategoryMenu.SelectedValue + ");"; sqlConn.Open(); SQLiteDataReader reader; sqlDoReport.CommandText = command; reader = sqlDoReport.ExecuteReader(); sqlConn.Close(); // alert user that item was successfully added to DB - this needs an if statement! if (reader.RecordsAffected > 0) { SuccessTextBox.Text = "Item successfully added to your budget!"; } else { SuccessTextBox.Text = "There has been an error in adding your item."; } // reset window dateTimePicker1.ResetText(); CategoryMenu.ResetText(); DescriptionTextBox.ResetText(); AmountTextBox.ResetText(); CategoryMenu.ClearSelected(); } }
protected void save_cateMenu_Click(object sender, EventArgs e) { eWorldEntities db = new eWorldEntities(); var t = db.CategoryMenus; db.CategoryMenus.RemoveRange(t); db.SaveChanges(); foreach (ListItem item in MenuCategory.Items) { if (item.Selected) { var tmp = db.Categories.Where(z => z.CategoryID.ToString() == item.Value).FirstOrDefault(); CategoryMenu cm = new CategoryMenu(); cm.CategoryID = tmp.CategoryID; db.CategoryMenus.Add(cm); } } db.SaveChanges(); MenuCategory.DataSource = GetCategories(); MenuCategory.DataBind(); }
//click on start button start quiz / select category or stop quiz and init category choosing //disabled if any label is not selected during the category choosing private void startBTN_Click(object sender, EventArgs e) { //if user clicked on start if (startBTN.Text == "Start") { startBTN.Text = "Stop"; //find selection foreach (var label in answersTXT) { //if label is checked if (label.ForeColor == CheckedColor) { //apply category CategoryMenu.SelectCategory(label.Text); } } //write question WriteQuestion(); } //if user clicked on stop else if (startBTN.Text == "Stop") { startBTN.Text = "Start"; //disable controls used during the quiz nextBTN.Enabled = false; checkBTN.Enabled = false; ClearAnswersLabels(); //show score and clear table questionTXT.Text = $"Correct: {Scores["correct"],-5} Wrong: {Scores["wrong"],-5} Not answered: {Scores["not answered"]}"; Scores = Scores.ToDictionary(d => d.Key, d => 0); //init category choosing questionTXT.Text += "\n\nChoose a category and click start"; ShowCategoryMenu(); } }
public void EditCategory(int id, CategoryMenu category) { TestMenuStatus = "EdisCategory"; }
// Protected: #region Protected protected override void InstallPatches() { CategoryMenu.Install(); ChestOverlay.Install(); WidgetHost.Install(); }
public void CreateCategory(CategoryMenu category) { throw new NotImplementedException(); }