private void LoadData() { ListBrands = brandRepository.GetAll(); gvbrand.Rows.Clear(); foreach (var item in ListBrands.OrderBy(x => x.name)) { gvbrand.Rows.Add(item.brandid, item.name, item.remark); } }
public async void ListBrands( EStatusCode expectedStatus, ListBrands query ) { var brand = EntitiesFactory.NewBrand().Save(); var(status, result) = await Request.Get <QueryResultListTest <BrandList> >(Uri, query); Assert.Equal(expectedStatus, status); if (expectedStatus == EStatusCode.Success) { Assert.NotEmpty(result.Data); Assert.Contains(result.Data, d => d.Id == brand.Id); } }
private void btedit_Click(object sender, EventArgs e) { if (gvbrand.SelectedRows.Count == 0) { MessageBox.Show("Tidak ada brand yang akan diubah"); } else { var selectedRowId = (int)gvbrand.SelectedRows[0].Cells["id"].Value; var brand = ListBrands.FirstOrDefault(x => x.brandid == selectedRowId); if (selectedRowId == 1) { MessageBox.Show("Anda tidak dibenarkan mengubah brand Lain-Lain"); } else if (brand != null) { var form = new ManageBrand(); form.userdata = userdata; form.Editmode = true; form.BrandData = brand; form.ShowDialog(); LoadData(); foreach (DataGridViewRow row in gvbrand.Rows) { if (((int)row.Cells["id"].Value) == selectedRowId) { gvbrand.Rows[row.Index].Selected = true; break; } } } } }
public async Task <ActionResult <QueryResultList <BrandList> > > ListAsync([FromQuery] ListBrands query) { return(GetResult(await _queriesHanlder.Handle(query))); }
private void LoadData() { //if (userdata.user_role == "kasir") //{ // btadditem.Visible = false; // btedititem.Visible = false; // btdeleteitem.Visible = false; // btunitmanage.Visible = false; // btmanagebrand.Visible = false; //} try { ListBrands = brandRepository.GetAll().ToList(); ListProducts = productRepository.GetAll().ToList(); ListCategories = categoryRepository.GetAll().ToList(); ListUnits = unitRepository.GetAll().ToList(); var tempproductlist = new List <TempProdColumns>(); if (ListProducts != null) { foreach (var item in ListProducts) { var prodbrand = ListBrands.FirstOrDefault(x => x.brandid == item.brandid); var prodcat = ListCategories.FirstOrDefault(x => x.catid == item.prodcat); var produnit = ListUnits.FirstOrDefault(x => x.unitid == item.produnit); var itemDetail = new TempProdColumns(); itemDetail.prodid = item.prodid; itemDetail.brandid = item.brandid; itemDetail.brand_name = prodbrand != null ? prodbrand.name : " - "; itemDetail.name = item.name; itemDetail.prodcat = item.prodcat; itemDetail.prodcat_name = prodcat != null ? prodcat.name : " - "; itemDetail.prodcode = item.prodcode; itemDetail.produnit = item.produnit; itemDetail.produnit_code = produnit != null ? produnit.unitcode : " - "; itemDetail.purchaseprice = item.purchaseprice; itemDetail.stocks = item.stocks; itemDetail.barcodeno = item.barcodeno; tempproductlist.Add(itemDetail); } gvproducts.Rows.Clear(); foreach (var item in tempproductlist.OrderBy(x => x.prodcat_name).ThenBy(x => x.brand_name).ThenBy(x => x.name)) { gvproducts.Rows.Add( item.prodid, item.prodcat_name, item.brand_name, item.prodcode, item.name, item.produnit_code, Utils.ToRupiah(item.purchaseprice), item.barcodeno, item.stocks ); } } var cbData = ListBrands; cbData.Insert(0, new BrandColumns { brandid = -1, name = "--- Pilih Merek ---" }); cbbrand.DataSource = new BindingSource(ListBrands, null); cbbrand.DisplayMember = "name"; cbbrand.ValueMember = "brandid"; var cbcatdata = ListCategories; cbcatdata.Insert(0, new CategoryColumns { catid = -1, name = "--- Pilih Kategori ---" }); cbcategory.DataSource = new BindingSource(ListCategories, null); cbcategory.DisplayMember = "name"; cbcategory.ValueMember = "catid"; } catch (Exception ex) { var errMsg = "Details : " + ex.Message + Environment.NewLine + "Stacktrace : " + ex.StackTrace; MessageBox.Show(errMsg, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } tbprodname.Focus(); }