public _Presenter(FormCategory F) { Form = F; string connectionString = ConfigurationManager.ConnectionStrings["Shop"].ConnectionString; Form.ShowBtn += FormShowBtn; Form.DelBtn += FormDel; Form.AddBtn += FormAddBtn; Form.UpdBtn += FormUpdBtn; }
public async Task <List <Form> > ListAsync(FormCategory category) { var subject = _httpContextAccessor.HttpContext.User.GetSubject().AsGuid(); var forms = await _context.Forms .Where(x => x.AuthorId == subject) .Where(x => x.Category == category) .AsNoTracking() .ToListAsync(); return(forms); }
public async Task <IActionResult> CategoryOneAddAsync(FormCategory c, List <FormCategory> SubCategorys) { var category = new CategoryOne() { CategoryOneId = c.Id, Icon = c.Icon, Name = c.Name, url = c.url }; if (c.File != null) { category.ImgUrl = await FilesSave.FileSave(rootPath, @"\Upload\Category\", c.File); } else { category.ImgUrl = c.ImgUrl; } if (SubCategorys != null) { var SubC = new List <Category>(); foreach (var item in SubCategorys) { var cs = new Category() { CategoryId = item.Id, Icon = item.Icon, Name = item.Name, url = item.url }; if (item.File != null) { cs.ImgUrl = await FilesSave.FileSave(rootPath, @"\Upload\Category\", item.File); } else { cs.ImgUrl = item.ImgUrl; } SubC.Add(cs); } category.SubCategory = SubC; } if (c.Id == 0) { await _CategoryText.CategoryOneAddAsync(category); } else { await _CategoryText.CategoryOneAddAsync(category, c.Id); } return(RedirectToAction("Index", "Home")); }
public async Task <JsonHttpResponseMessage <List <Form> > > ListByCategoryAsync(FormCategory category) { var token = await _httpContextAccessor.HttpContext.GetTokenAsync("access_token"); var requestMessage = new HttpRequestMessage(HttpMethod.Get, $"/user/forms/{category.Id}") .SetBearerToken(token); return(await _http.SendAsync <List <Form> >(requestMessage)); }
private void categoriasToolStripMenuItem_Click(object sender, EventArgs e) { FormCategory category = new FormCategory(); category.Show(); }
private void cate_FormClosed(object sender, FormClosedEventArgs e) { categoryForm = null; btnRefresh.PerformClick(); }
private void btnDoClick(object sender, EventArgs e) { /*Check Selected Index*/ int index = 0; if (dgvProduct.Rows.Count > 0) { index = (int)dgvProduct.Rows[dgvProduct.CurrentCell.RowIndex].Cells[0].Value; } if (sender == btnDetails) { if (index != 0) { FormProductDetails proDetails = new FormProductDetails(0, index); proDetails.ShowDialog(); } } else if (sender == btnUpdate) { if (index != 0) { FormProductDetails proDetails = new FormProductDetails(2, index); proDetails.ShowDialog(); if (proDetails.SuccesUpdate == true) { MessageSuccess("Update Success", "Update"); if (!UpdateDataRow()) { LoadDatabase("FillProducData"); } } SetFooter(); } } else if (sender == btnAdd) { if (index != 0) { FormProductDetails frmAdd = new FormProductDetails(1, index); frmAdd.Created += frmAdd_Created; frmAdd.ShowDialog(); } } else if (sender == btnCategory) { if (categoryForm == null) { categoryForm = new FormCategory(); categoryForm.Show(); categoryForm.FormClosed += cate_FormClosed; } else { categoryForm.BringToFront(); } } else if (sender == btnSearch) { if (!string.IsNullOrEmpty(txtSearch.Text)) { searchType = cboTypeSearch.SelectedIndex + 1; searchText = txtSearch.Text; if (searchType == 3) { SearchDatabase("SearchByPrice"); } else { SearchDatabase("SearchProductData"); } searchType = 1; searchText = ""; txtSearch.Text = ""; SetFooter(); } } else if (sender == btnRefresh) { LoadDatabase("FillProductData"); SetFooter(); } }
private void categoriesToolStripMenuItem_Click(object sender, EventArgs e) { FormCategory fc = new FormCategory(CategoryService); fc.ShowDialog(); }
public Task <JsonHttpResponseMessage <List <RepositoryForm> > > ListByCategoryAsync(FormCategory category) { throw new NotImplementedException(); }