public List<ListCategory> GetSelectList() { List<ListCategory> selects = new List<ListCategory>(); for (var i = 1; i <= 10; i++) { ListCategory list = new ListCategory(); list.ID = i; list.Level = 1; list.Name = "Category" + i; list.PID = 0; for (var j = 1; j <= 10; j++) { ListCategory clist = new ListCategory(); clist.ID = 10 * i + j; clist.Name = "Category" + (10 * i + j); clist.Level = 2; clist.PID = list.ID; for (var k = 1; k <= 10; k++) { ListCategory cclist = new ListCategory(); cclist.ID = 100 * i + 10 * j + k; cclist.Name = "Category" + (100 * i + 10 * j + k); cclist.Level = 3; cclist.PID = clist.ID; for (var m = 1; m < 10; m++) { ListCategory ccclist = new ListCategory(); ccclist.ID = 1000 * i + 100 * j + 10 * k + m; ccclist.Name = "Category" + (1000 * i + 100 * j + 10 * k + m); ccclist.Level = 4; ccclist.PID = cclist.ID; selects.Add(ccclist); } selects.Add(cclist); } selects.Add(clist); } selects.Add(list); } return selects; }
public List <ListCategory> GetSelectList() { List <ListCategory> selects = new List <ListCategory>(); for (var i = 1; i <= 10; i++) { ListCategory list = new ListCategory(); list.ID = i; list.Level = 1; list.Name = "Category" + i; list.PID = 0; for (var j = 1; j <= 10; j++) { ListCategory clist = new ListCategory(); clist.ID = 10 * i + j; clist.Name = "Category" + (10 * i + j); clist.Level = 2; clist.PID = list.ID; for (var k = 1; k <= 10; k++) { ListCategory cclist = new ListCategory(); cclist.ID = 100 * i + 10 * j + k; cclist.Name = "Category" + (100 * i + 10 * j + k); cclist.Level = 3; cclist.PID = clist.ID; for (var m = 1; m < 10; m++) { ListCategory ccclist = new ListCategory(); ccclist.ID = 1000 * i + 100 * j + 10 * k + m; ccclist.Name = "Category" + (1000 * i + 100 * j + 10 * k + m); ccclist.Level = 4; ccclist.PID = cclist.ID; selects.Add(ccclist); } selects.Add(cclist); } selects.Add(clist); } selects.Add(list); } return(selects); }
private void LoadCategory() { comboBox1.Text = ""; comboBox1.Items.Clear(); ListCategory = datManage.DeserializeXML <ListCategory>(pat); foreach (var el in ListCategory.SiteAndCategories) { comboBox1.Items.Add(el.Name_Category); } if (comboBox1.Items.Count > 0) { comboBox1.SelectedIndex = 0; } }
private async void GetListCategory() { try { var listData = conn.GetListCategory(); ListCategory.Clear(); foreach (var item in listData) { ListCategory.Add(item); } ; } catch { await new MessageDialog("Get Category Faild ! Something wrong !").ShowAsync(); } }
private async Task <ListCategory> GetCatAsync() { using (HttpClient client = new HttpClient()) { try { ListCategory list = new ListCategory(); var response = await client.GetStringAsync("http://api.mitportals.in/categories/"); list = JsonConvert.DeserializeObject <ListCategory>(response); return(list); } catch { } return(null); } }
private void addNotificationsToolStripMenuItem_Click(object sender, EventArgs e) { try { if (listBox1.SelectedIndex < 0) { throw new Exception("Eror Selected!"); } ListCategory = datManage.DeserializeXML <ListCategory>(pat); if (ListCategory.SiteAndCategories[comboBox1.SelectedIndex].Sites[listBox1.SelectedIndex].Notifications == false) { ListCategory.SiteAndCategories[comboBox1.SelectedIndex].Sites[listBox1.SelectedIndex].Notifications = true; } else { ListCategory.SiteAndCategories[comboBox1.SelectedIndex].Sites[listBox1.SelectedIndex].Notifications = false; } datManage.SerializeXML(ListCategory, pat); // listBox1.Items.Clear(); listBox2.Items.Clear(); ListCategory = datManage.DeserializeXML <ListCategory>(pat); foreach (var el in ListCategory.SiteAndCategories[comboBox1.SelectedIndex].Sites) { var item = listBox1.Items.Add(el.Name_Site); if (el.Notifications == false) { var item2 = listBox2.Items.Add("✗"); } else { var item2 = listBox2.Items.Add("✓"); } } // } catch (Exception er) { MessageBox.Show(er.Message, "Notifications", MessageBoxButtons.RetryCancel, MessageBoxIcon.Information); } }
public async Task <IActionResult> GetCategory(int?BadgeStatus = 0, int?CurrentPage = 0, int?PageSize = 0, int?TotalRecords = 0) { ListCategory oResult = new ListCategory(); try { oResult.listCategory = await _svc.GetAllAsync(CurrentPage, PageSize, TotalRecords); oResult.ErrorCode = (int)ExceptionType.SUCCESS; oResult.ErrorDesc = ExceptionType.SUCCESS.ToString(); } catch (Exception ex) { oResult.ErrorCode = (int)ExceptionType.CATCH; oResult.ErrorDesc = ex.ToString(); } return(Ok(oResult)); }
private void UpdateBook_Load(object sender, EventArgs e) { txtISBN.Text = book.ISBN; txtName.Text = book.Name; txtPrice.Text = book.Price.ToString(); txtQuantity.Text = book.Quantity.ToString(); txtDesc.Text = book.Description; txtPrice.Text = book.Price.ToString(); txtStatus.Text = book.Status; for (int i = 0; i < ListAuthors.Items.Count; i++) { int count = 0; for (int t = count; t < book.Author.Count; t++) { if (book.Author[t].ID == ((AuthorData)ListAuthors.Items[i]).ID) { ListAuthors.SetSelected(i, true); count = t; break; } } } for (int i = 0; i < ListCategory.Items.Count; i++) { for (int t = 0; t < book.Category.Count; t++) { if (((CategoryData)ListCategory.Items[i]).ID == book.Category[t].ID) { ListCategory.SetSelected(i, true); break; } } } for (int i = 0; i < cboPublisher.Items.Count; i++) { if (book.Publisher_ID == ((PublisherData)cboPublisher.Items[i]).ID) { cboPublisher.SelectedIndex = i; } } }
protected async override void OnNavigatedTo(NavigationEventArgs e) { ListCategory list = new ListCategory(); list = await GetCatAsync(); foreach (Category cat in list.data) { cat.Image = "ms-appx:///Assets/Category Icons/TT-" + cat.cname + ".png"; switch (cat.cname) { case "Featured Event-Paper Presentation": cat.Image = "ms-appx:///Assets/Square71x71Logo.scale-100.png"; break; } } Categories.ItemsSource = list.data; }
private void comboBox1_SelectedIndexChanged(object sender, EventArgs e) { listBox1.Items.Clear(); listBox2.Items.Clear(); ListCategory = datManage.DeserializeXML <ListCategory>(pat); foreach (var el in ListCategory.SiteAndCategories[comboBox1.SelectedIndex].Sites) { var item = listBox1.Items.Add(el.Name_Site); if (el.Notifications == false) { var item2 = listBox2.Items.Add("✗"); } else { var item2 = listBox2.Items.Add("✓"); } } }
private void delToolStripMenuItem_Click(object sender, EventArgs e) { try { if (comboBox1.SelectedIndex < 0) { throw new Exception("Eror Selected!"); } ListCategory = datManage.DeserializeXML <ListCategory>(pat); ListCategory.SiteAndCategories.RemoveAt(comboBox1.SelectedIndex); datManage.SerializeXML(ListCategory, pat); LoadCategory(); } catch (Exception er) { MessageBox.Show(er.Message, "Notifications", MessageBoxButtons.RetryCancel, MessageBoxIcon.Information); } }
private void addToolStripMenuItem1_Click(object sender, EventArgs e) { try { if (comboBox1.SelectedIndex < 0) { throw new Exception("Eror Selected!"); } ListCategory = datManage.DeserializeXML <ListCategory>(pat); ListCategory.SiteAndCategories[comboBox1.SelectedIndex].Sites.Add(new Site() { Name_Site = "https://www.google.com/search?q=%D0%B3%D1%83%D0%B3%D0%B4&oq=%D0%B3%D1%83%D0%B3%D0%B4&aqs=chrome..69i57j0l7.6873j0j7&sourceid=chrome&ie=UTF-8", Notifications = false }); datManage.SerializeXML(ListCategory, pat); LoadCategory(); // listBox1.Items.Clear(); listBox2.Items.Clear(); ListCategory = datManage.DeserializeXML <ListCategory>(pat); foreach (var el in ListCategory.SiteAndCategories[comboBox1.SelectedIndex].Sites) { var item = listBox1.Items.Add(el.Name_Site); if (el.Notifications == false) { var item2 = listBox2.Items.Add("✗"); } else { var item2 = listBox2.Items.Add("✓"); } } // } catch (Exception er) { MessageBox.Show(er.Message, "Notifications", MessageBoxButtons.RetryCancel, MessageBoxIcon.Information); } }
private void editToolStripMenuItem1_Click(object sender, EventArgs e) { try { if (listBox1.SelectedIndex < 0) { throw new Exception("Eror Selected!"); } ListCategory = datManage.DeserializeXML <ListCategory>(pat); ListCategory.SiteAndCategories[comboBox1.SelectedIndex].Sites[listBox1.SelectedIndex].Name_Site = (textBox1.Text.Length > 0) ? textBox1.Text:"google.com"; datManage.SerializeXML(ListCategory, pat); LoadCategory(); listBox1.Items.Clear(); } catch (Exception er) { MessageBox.Show(er.Message, "Notifications", MessageBoxButtons.RetryCancel, MessageBoxIcon.Information); } }
/// <summary> /// Populates the page with content passed during navigation. Any saved state is also /// provided when recreating a page from a prior session. /// </summary> /// <param name="sender"> /// The source of the event; typically <see cref="NavigationHelper"/> /// </param> /// <param name="e">Event data that provides both the navigation parameter passed to /// <see cref="Frame.Navigate(Type, Object)"/> when this page was initially requested and /// a dictionary of state preserved by this page during an earlier /// session. The state will be null the first time a page is visited.</param> private async void NavigationHelper_LoadState(object sender, LoadStateEventArgs e) { ListCategory list = new ListCategory(); list = await GetCatAsync(); foreach (Category cat in list.data) { cat.Image = "ms-appx:///Assets/Category Icons/TT-" + cat.cname + ".png"; switch (cat.cname) { case "Chrysalis": case "Featured Event-Paper Presentation": cat.Image = "ms-appx:///Assets/Square71x71Logo.scale-100.png"; break; } } Categories_ListView.ItemsSource = list.data; }
public async Task <IActionResult> OnPostAsync() { if (ModelState.IsValid) { IEnumerable <ListCategory> list = await repository.GetDocuments(s => s.ListName == Category.ListName && s.Category == Category.Category); ListCategory existingOne = list.FirstOrDefault(); if (null != existingOne) { Category.Id = existingOne.Id; } await repository.UpsertDocument(Category); ViewData["Message"] = "Kategorie gespeichert."; return(RedirectToPage("Kategorien")); } else { ViewData["Message"] = "Schiefgegangen"; return(Page()); } }
public UpdateBook(int ID) { InitializeComponent(); ChannelFactory <IBussinessLogic> chanel = new ChannelFactory <IBussinessLogic>("ClientEndPoint"); proxy = chanel.CreateChannel(); book = proxy.GetBookDataByID(ID); ListAuthors.DataSource = proxy.GetAllBookAuthor(); ListAuthors.DisplayMember = "name"; ListAuthors.ValueMember = "id"; ListCategory.DataSource = proxy.GetBookAllCategory(); ListCategory.DisplayMember = "name"; ListCategory.ValueMember = "id"; cboPublisher.DataSource = proxy.getAllPublisher(); cboPublisher.DisplayMember = "name"; cboPublisher.ValueMember = "id"; ListAuthors.ClearSelected(); ListCategory.ClearSelected(); ListAuthors.SelectionMode = SelectionMode.MultiExtended; ListCategory.SelectionMode = SelectionMode.MultiExtended; this.MaximizeBox = false; this.MinimizeBox = false; }
private ListCategory BuildTestCetegory(int rank, string categoryName, string notes = null) { ListCategory listCategory = new ListCategory() { Rank = rank, Category = categoryName, Notes = notes, ToDoItems = new ObservableCollection <ToDoItem>() }; for (int i = 0; i < 11; i++) { ToDoItem item = new ToDoItem() { Rank = i, Item = $"Test Data {i}", //ListCategory = listCategory, ToDoItemSteps = new ObservableCollection <ToDoItemStep>() }; for (int j = 0; j < 11; j++) { ToDoItemStep step = new ToDoItemStep() { Rank = j, Step = $"Test Data {j}", //ToDoItem = item }; item.ToDoItemSteps.Add(step); } listCategory.ToDoItems.Add(item); } return(listCategory); }
public int GetNextItemRank(ListCategory category) { return(category.ToDoItems.OrderByDescending(tdi => tdi.Rank).FirstOrDefault()?.Rank + 1 ?? 1); }
public NodeRecord(Node node, NodeConnection connection, float costSoFar, float estimatedTotalCost, ListCategory category) { this.Node = node; this.Connection = connection; this.CostSoFar = costSoFar; this.EstimatedTotalCost = estimatedTotalCost; this.Category = category; }
private async void DeleteCategory_Click(object sender, RoutedEventArgs e) { Button btn = sender as Button; try { conn.DeleteCategory(new Category() { CategoryID = Int32.Parse(btn.Tag.ToString()) }); ListCategory.Where(x => x.CategoryID == int.Parse(btn.Tag.ToString())).ToList().All(i => ListCategory.Remove(i)); } catch { await new MessageDialog("Something wrong !").ShowAsync(); } }