//Tiaan private void dataGridView1_SelectionChanged(object sender, EventArgs e) { try { if (dataGridView1.SelectedRows.Count >= 1) { using (DataGridViewRow item = this.dataGridView1.SelectedRows[0]) { ItemMain itemi = new ItemMain(); itemi = imList[this.dataGridView1.SelectedRows[0].Index]; current = itemi; storeName.Text = itemi.StoreName; StoreLoc.Text = itemi.StoreLocation; barcode.Text = itemi.BarcodeNumber; productName.Text = itemi.ProductName; ProductDesc.Text = itemi.ProductDescription; ProductBrand.Text = itemi.BrandName; ProductCat.Text = itemi.ProductDescription; EPC.Text = itemi.EPC; } } } catch (Exception ex) { MessageBox.Show("Sorry Something went wrong, the action was not completed!"); } }
//Margo private void button4_Click(object sender, EventArgs e) { try { lblerrorEPC.Visible = false; if (txtEPC.Text != "") { ItemMain boo = new ItemMain(); boo = imList.Where(u => u.EPC == txtEPC.Text).FirstOrDefault(); if (boo != null) { int index = imList.IndexOf(boo); if (dataGridView1.SelectedRows.Count != 0) { dataGridView1.ClearSelection(); } dataGridView1.Rows[index].Selected = true; } else { lblerrorEPC.Visible = true; } } else { lblerrorEPC.Visible = true; } } catch (Exception ex) { MessageBox.Show("Sorry Something went wrong, the action was not completed!"); } }
private void updateItem_search_click(object sender, EventArgs e) { Log.WriteLog(LogType.Trace, "come in updateItem_search_click"); string epc = textBox3.Text; if (epc != "") { //在内存数组中根据epc找到指定的item ItemMain find = imList.Where(i => i.EPC == epc).FirstOrDefault(); if (null == find) { Log.WriteLog(LogType.Trace, "can not find item with epc[" + epc + "]"); return; } //返回item在数组中的下标 int index = imList.IndexOf(find); if (index != -1) { Log.WriteLog(LogType.Trace, "success to find item[" + find.itemID + "] with ecp[" + epc + "], its array index is:" + index + ""); dgvItem.Rows[index].Selected = true; //dataGridView2.SelectedRows.Clear(); } else { Log.WriteLog(LogType.Error, "can not find item[" + find.itemID + "] array index with ecp[" + epc + "]"); } return; } }
void Update() { if (PauseMenu_HTML.IsPaused) { return; } if (GroupUtil.IsNeutral(Group)) { return; } if (SoloEvolution) { UnitEvolution.Update(this); } if (!GroupUtil.isCreatureGroup(Group)) { return; } ItemMain.Update(this); UnitEvolution.Update(this); }
//Devon private void dataGridView2_SelectionChanged(object sender, EventArgs e) { try { if (dataGridView2.SelectedRows.Count >= 1) { using (DataGridViewRow item = this.dataGridView2.SelectedRows[0]) { ItemMain itemi = new ItemMain(); itemi = imList[this.dataGridView2.SelectedRows[0].Index]; current = imList[this.dataGridView2.SelectedRows[0].Index]; int sIndex = listS.IndexOf(listS.Where(u => u.StoreID == itemi.StoreID).FirstOrDefault()); comboBoxStore.SelectedIndex = sIndex; int i = item.Index; string itemID = dataGridView2.Rows[i].Cells[0].Value.ToString(); string rfTag = dataGridView2.Rows[i].Cells[1].Value.ToString(); string barNum = dataGridView2.Rows[i].Cells[4].Value.ToString(); oldEPC = rfTag; label5.Text = itemID; textBox2.Text = rfTag; comboBox1.Text = barNum; } } else { } } catch (Exception ex) { MessageBox.Show("Sorry Something went wrong, the action was not completed!"); } }
//Devon and Margo public bool Search(string epc) { try { if (epc != "") { ItemMain find = imList.Where(i => i.EPC == epc).FirstOrDefault(); if (find != null) { int index = imList.IndexOf(find); if (dataGridView2.SelectedRows.Count != 0) { dataGridView2.ClearSelection(); } dataGridView2.Rows[index].Selected = true; return(true); } else { return(false); } } else { return(false); } } catch (Exception ex) { MessageBox.Show("Sorry Something went wrong, the action was not completed!"); return(false); } }
//Hàm lưu item public JsonResult CreateItem(string[] price, string[] confidence, int[] x0, int[] y0, int[] x1, int[] y1, object[] target, string[] itemcode) { var code = Session["key"]; FileMain file = db.FileMains.SingleOrDefault(n => n.file_key == code.ToString()); Image img = Image.FromFile(Request.MapPath("~/IMG/img/" + file.file_img)); for (var i = 0; i < price.Length - 1; i++) { var codekey = Guid.NewGuid().ToString(); var pa = Path.Combine(Server.MapPath("~/IMG/Img"), codekey + ".png"); SaveResizeImage(file.file_img, pa, x0[i], y0[i], x1[i], y1[i]); ItemMain itemMain = new ItemMain { item_mvo = price[i], item_pro = float.Parse(confidence[i]), item_datecreate = DateTime.Now, file_id = file.file_id, item_x0 = x0[i], item_y0 = y0[i], item_x1 = x1[i], item_y1 = y1[i], table_id = 1, item_watched = false, notSee = false, item_mvi = price[i], item_img = codekey + ".png", item_target = (string)target[i], item_codeitem = itemcode[i], file_key = file.file_key }; db.ItemMains.Add(itemMain); } db.SaveChanges(); History history2 = new History { file_id = file.file_id, his_title = "đã đọc xong", his_datecreate = DateTime.Now, his_status = 1 }; db.Historys.Add(history2); db.SaveChanges(); return(Json(null)); }
//当点解dgv控件时,触发该函数进行处理 private void updateItem_dgvItem_SelectionChanged(object sender, EventArgs e) { Log.WriteLog(LogType.Trace, "come in updateItem_dgvItem_SelectionChanged"); if (dgvItem.SelectedRows.Count >= 1) { using (DataGridViewRow item = this.dgvItem.SelectedRows[0]) { //根据被选中的控件获得item在内存的数据 int iItemIdx = item.Index; ItemMain itemi = new ItemMain(); itemi = imList[iItemIdx]; //提取指定信息 string itemID = itemi.itemID.ToString(); string sEpc = itemi.EPC; //通过控件保存住item信息,供后面使用 oldEPC = sEpc; //label5.Text = itemID; giItemId = Int32.Parse(itemID); tbEpc.Text = sEpc; //修改store下拉框当前值 int sIndex = listS.IndexOf(listS.Where(u => u.StoreID == itemi.StoreID).FirstOrDefault()); cbStore.SelectedIndex = sIndex; //修改barcode下拉框当前值 int iBarcodeIdx = listBar.IndexOf(listBar.Where(v => v.BarcodeNumber == itemi.BarcodeNumber).FirstOrDefault()); cbBarcode.SelectedIndex = iBarcodeIdx; Log.WriteLog(LogType.Trace, "success to printf item[" + itemID + "] with barcode[" + itemi.BarcodeID + "] in store[" + itemi.StoreID + "] info into controls "); } } else { Log.WriteLog(LogType.Error, "error to update item info into controller."); return; } }
//Tiaan private void BookStockOut_Load(object sender, EventArgs e) { try { imList = new List <ItemMain>(); item = DAT.DataAccess.GetItem().Where(u => u.ItemStatus == true).ToList(); if (item != null) { for (int x = 0; x < item.Count; x++) { ItemMain im = new ItemMain(); //assign the item info to the ItemMain object im.itemID = item[x].ItemID; im.EPC = item[x].TagEPC; im.ItemStatus = item[x].ItemStatus; im.ProductID = item[x].ProductID; im.StoreID = item[x].StoreID; //get the specific product and assign the info to the ItemMain object LTS.Product p = new LTS.Product(); p = DAT.DataAccess.GetProduct().Where(h => h.ProductID == im.ProductID).FirstOrDefault(); im.ProductName = p.ProductName; im.ProductDescription = p.ProductDescription; im.BrandID = p.BrandID; im.CategoryID = p.CategoryID; im.BarcodeID = p.BarcodeID; //get the specific store and assign the info to the ItemMain object LTS.Store s = new LTS.Store(); s = DAT.DataAccess.GetStore().Where(j => j.StoreID == im.StoreID).FirstOrDefault(); im.StoreName = s.StoreName; im.StoreLocation = s.StoreLocation; //get the specific brand and assign the info to the ItemMain object LTS.Brand b = new LTS.Brand(); b = DAT.DataAccess.GetBrand().Where(y => y.BrandID == im.BrandID).FirstOrDefault(); im.BrandName = b.BrandName; im.BrandDescription = b.BrandDescription; //get the sepcific category and assign the info to the ItemMain object LTS.Category c = new LTS.Category(); c = DAT.DataAccess.GetCategory().Where(z => z.CategoryID == im.CategoryID).FirstOrDefault(); im.CategoryName = c.CategoryName; im.CategoryDescription = c.CategoryDescription; //get the sepcific category and assign the info to the ItemMain object LTS.Barcode ba = new LTS.Barcode(); ba = DAT.DataAccess.GetBarcode().Where(a => a.BarcodeID == im.BarcodeID).FirstOrDefault(); im.BarcodeNumber = ba.BarcodeNumber; imList.Add(im); dataGridView1.Rows.Add(im.itemID, im.EPC, im.ProductName, im.ProductDescription, im.BarcodeNumber, im.BrandName, im.CategoryName , im.ItemStatus, im.StoreName); } } st = new List <LTS.Store>(); st = DAT.DataAccess.GetStore().ToList(); List <string> S = new List <string>(); for (int x = 0; x < st.Count; x++) { S.Add(st[x].StoreName); } comboBoxStore.DataSource = S; } catch (Exception ex) { MessageBox.Show("Sorry Something went wrong, the action was not completed!"); } }
//Devon private void radioButton4_CheckedChanged(object sender, EventArgs e) { try { if (radioButton4.Checked) { whatCheck = "OutOfStock"; dataGridView2.Rows.Clear(); List <LTS.Item> i = new List <LTS.Item>(); i = DAT.DataAccess.GetItem().Where(s => s.ItemStatus == false).ToList();//list from db List <ItemMain> imList = new List <ItemMain>(); for (int x = 0; x < i.Count; x++) { ItemMain im = new ItemMain(); //assign the item info to the ItemMain object im.itemID = i[x].ItemID; im.EPC = i[x].TagEPC; im.ItemStatus = i[x].ItemStatus; im.ProductID = i[x].ProductID; im.StoreID = i[x].StoreID; //get the specific product and assign the info to the ItemMain object LTS.Product p = new LTS.Product(); p = DAT.DataAccess.GetProduct().Where(h => h.ProductID == im.ProductID).FirstOrDefault(); im.ProductName = p.ProductName; im.ProductDescription = p.ProductDescription; im.BrandID = p.BrandID; im.CategoryID = p.CategoryID; im.BarcodeID = p.BarcodeID; //get the specific store and assign the info to the ItemMain object LTS.Store s = new LTS.Store(); s = DAT.DataAccess.GetStore().Where(j => j.StoreID == im.StoreID).FirstOrDefault(); im.StoreName = s.StoreName; im.StoreLocation = s.StoreLocation; //get the specific brand and assign the info to the ItemMain object LTS.Brand b = new LTS.Brand(); b = DAT.DataAccess.GetBrand().Where(y => y.BrandID == im.BrandID).FirstOrDefault(); im.BrandName = b.BrandName; im.BrandDescription = b.BrandDescription; //get the sepcific category and assign the info to the ItemMain object LTS.Category c = new LTS.Category(); c = DAT.DataAccess.GetCategory().Where(z => z.CategoryID == im.CategoryID).FirstOrDefault(); im.CategoryName = c.CategoryName; im.CategoryDescription = c.CategoryDescription; //get the sepcific category and assign the info to the ItemMain object LTS.Barcode ba = new LTS.Barcode(); ba = DAT.DataAccess.GetBarcode().Where(a => a.BarcodeID == im.BarcodeID).FirstOrDefault(); im.BarcodeNumber = ba.BarcodeNumber; imList.Add(im); dataGridView2.Rows.Add(im.itemID, im.EPC, im.ProductName, im.ProductDescription, im.BarcodeNumber, im.BrandName, im.CategoryName , im.ItemStatus, im.StoreName); } } else { dataGridView2.Rows.Clear(); } } catch (Exception ex) { MessageBox.Show("Sorry Something went wrong, the action was not completed!"); } }
private void updateItem_load(object sender, EventArgs e) { Log.WriteLog(LogType.Trace, "come in updateItem_load"); //load store names into combo box from db listS = DAT.DataAccess.GetStore().ToList(); List <string> S = new List <string>(); for (int x = 0; x < listS.Count; x++) { S.Add(listS[x].StoreName); } cbStore.DataSource = S; if (listS.Count > 1) { cbStore.SelectedIndex = 0; } //load barcode into combo box from db listBar = DAT.DataAccess.GetBarcode().ToList(); List <string> Ba = new List <string>(); for (int x = 0; x < listBar.Count; x++) { Ba.Add(listBar[x].BarcodeNumber); } cbBarcode.DataSource = Ba; //会触发select index change 事件 if (listBar.Count > 1) { cbBarcode.SelectedIndex = 0; } List <LTS.Item> i = new List <LTS.Item>(); i = DAT.DataAccess.GetItem().ToList();//list from db imList = new List <ItemMain>(); for (int x = 0; x < i.Count; x++) { ItemMain im = new ItemMain(); //assign the item info to the ItemMain object im.itemID = i[x].ItemID; im.EPC = i[x].TagEPC; im.ItemStatus = i[x].ItemStatus; im.ProductID = i[x].ProductID; im.StoreID = i[x].StoreID; Log.WriteLog(LogType.Trace, "goto load item[" + im.itemID + "] detail info from database, the summary info is:epc[" + im.EPC + "], item status[" + im.ItemStatus + "]," + "product id[" + im.ProductID + "], store id[" + im.StoreID + "]"); //get the specific product and assign the info to the ItemMain object LTS.Product p = new LTS.Product(); p = DAT.DataAccess.GetProduct().Where(h => h.ProductID == im.ProductID).FirstOrDefault(); if (null == p) { Log.WriteLog(LogType.Error, "error to get product[" + im.ProductID + "] info while loading item[" + im.itemID + "] detail info."); continue; } im.ProductName = p.ProductName; im.ProductDescription = p.ProductDescription; im.BrandID = p.BrandID; im.CategoryID = p.CategoryID; im.BarcodeID = p.BarcodeID; //get the specific store and assign the info to the ItemMain object LTS.Store s = new LTS.Store(); s = DAT.DataAccess.GetStore().Where(j => j.StoreID == im.StoreID).FirstOrDefault(); if (null == s) { Log.WriteLog(LogType.Error, "error to get store[" + im.StoreID + "] info while loading item[" + im.itemID + "] detail info."); continue; } im.StoreName = s.StoreName; im.StoreLocation = s.StoreLocation; //get the specific brand and assign the info to the ItemMain object LTS.Brand b = new LTS.Brand(); b = DAT.DataAccess.GetBrand().Where(y => y.BrandID == im.BrandID).FirstOrDefault(); if (null == b) { Log.WriteLog(LogType.Error, "error to get brand[" + im.BrandID + "] info while loading item[" + im.itemID + "] detail info."); continue; } im.BrandName = b.BrandName; im.BrandDescription = b.BrandDescription; //get the sepcific category and assign the info to the ItemMain object LTS.Category c = new LTS.Category(); c = DAT.DataAccess.GetCategory().Where(z => z.CategoryID == im.CategoryID).FirstOrDefault(); if (null == c) { Log.WriteLog(LogType.Error, "error to get category[" + im.CategoryID + "] info while loading item[" + im.itemID + "] detail info."); continue; } im.CategoryName = c.CategoryName; im.CategoryDescription = c.CategoryDescription; //get the sepcific category and assign the info to the ItemMain object LTS.Barcode ba = new LTS.Barcode(); ba = DAT.DataAccess.GetBarcode().Where(a => a.BarcodeID == im.BarcodeID).FirstOrDefault(); if (null == ba) { Log.WriteLog(LogType.Error, "error to get barcode[" + im.BarcodeID + "] info while loading item[" + im.itemID + "] detail info."); continue; } im.BarcodeNumber = ba.BarcodeNumber; imList.Add(im); dgvItem.Rows.Add(im.itemID, im.EPC, im.ProductName, im.ProductDescription, im.BarcodeNumber, im.BrandName, im.CategoryName , im.ItemStatus, im.StoreName); Log.WriteLog(LogType.Trace, "success to load item[" + im.itemID + "] detail info:epc[" + im.EPC + "], productName[" + im.ProductName + "], productDesciption[" + im.ProductDescription + "]" + "barcode[" + im.BarcodeNumber + "], brandName[" + im.BrandName + "], categoryName[" + im.CategoryName + "], itemStatus[" + im.ItemStatus + "], storeName[" + im.StoreName + "]"); } }
private void item_radioAll_click(object sender, EventArgs e) { Log.WriteLog(LogType.Trace, "come in item_radioAll_click"); if (radioAll.Checked) { try { //从数据库中读取item记录到内存 List <LTS.Item> i = new List <LTS.Item>(); i = DAT.DataAccess.GetItem().ToList(); List <ItemMain> imList = new List <ItemMain>(); //根据item记录字段,组装厂家,类型等信息到内存 for (int x = 0; x < i.Count; x++) { ItemMain im = new ItemMain(); //将item记录信息保存到内存 im.itemID = i[x].ItemID; im.EPC = i[x].TagEPC; im.ItemStatus = i[x].ItemStatus; im.ProductID = i[x].ProductID; im.StoreID = i[x].StoreID; Log.WriteLog(LogType.Trace, "goto get item[" + im.itemID + "] info into memery:epc[" + im.EPC + "], status[{" + im.ItemStatus + "}], pruduct id[{" + im.ProductID + "}], store id[{" + im.StoreID + "}]"); //组装item的产品信息 LTS.Product p = new LTS.Product(); p = DAT.DataAccess.GetProduct().Where(h => h.ProductID == im.ProductID).FirstOrDefault(); im.ProductName = p.ProductName; im.ProductDescription = p.ProductDescription; im.BrandID = p.BrandID; im.CategoryID = p.CategoryID; im.BarcodeID = p.BarcodeID; //组装item的store信息 LTS.Store s = new LTS.Store(); s = DAT.DataAccess.GetStore().Where(j => j.StoreID == im.StoreID).FirstOrDefault(); im.StoreName = s.StoreName; im.StoreLocation = s.StoreLocation; //组装item的厂家信息 LTS.Brand b = new LTS.Brand(); b = DAT.DataAccess.GetBrand().Where(y => y.BrandID == im.BrandID).FirstOrDefault(); im.BrandName = b.BrandName; im.BrandDescription = b.BrandDescription; //组装item的类型信息 LTS.Category c = new LTS.Category(); c = DAT.DataAccess.GetCategory().Where(z => z.CategoryID == im.CategoryID).FirstOrDefault(); im.CategoryName = c.CategoryName; im.CategoryDescription = c.CategoryDescription; //组装item的条形码信息 LTS.Barcode ba = new LTS.Barcode(); ba = DAT.DataAccess.GetBarcode().Where(a => a.BarcodeID == im.BarcodeID).FirstOrDefault(); im.BarcodeNumber = ba.BarcodeNumber; //item完整信息添加到list中,并在控件中展示 imList.Add(im); dataGridView1.Rows.Add(im.itemID, im.EPC, im.ProductName, im.ProductDescription, im.BarcodeNumber, im.BrandName, im.CategoryName , im.ItemStatus, im.StoreName); } } catch (Exception ex) { Log.WriteLog(LogType.Error, "error to show item info into data grid view for all"); } } else { dataGridView1.Rows.Clear(); } }
//Devon private void UpdateStock_Load(object sender, EventArgs e) { try { ChangeView <SearchWithEPC>(); //load store names into combo box from db listS = DAT.DataAccess.GetStore().ToList(); List <string> S = new List <string>(); for (int x = 0; x < listS.Count; x++) { S.Add(listS[x].StoreName); } comboBoxStore.DataSource = S; //load barcode into combo box from db listBar = DAT.DataAccess.GetBarcode().ToList(); List <string> Ba = new List <string>(); for (int x = 0; x < listBar.Count; x++) { Ba.Add(listBar[x].BarcodeNumber); } comboBox1.DataSource = Ba; List <LTS.Item> i = new List <LTS.Item>(); i = DAT.DataAccess.GetItem().ToList();//list from db imList = new List <ItemMain>(); for (int x = 0; x < i.Count; x++) { ItemMain im = new ItemMain(); //assign the item info to the ItemMain object im.itemID = i[x].ItemID; im.EPC = i[x].TagEPC; im.ItemStatus = i[x].ItemStatus; im.ProductID = i[x].ProductID; im.StoreID = i[x].StoreID; //get the specific product and assign the info to the ItemMain object LTS.Product p = new LTS.Product(); p = DAT.DataAccess.GetProduct().Where(h => h.ProductID == im.ProductID).FirstOrDefault(); im.ProductName = p.ProductName; im.ProductDescription = p.ProductDescription; im.BrandID = p.BrandID; im.CategoryID = p.CategoryID; im.BarcodeID = p.BarcodeID; //get the specific store and assign the info to the ItemMain object LTS.Store s = new LTS.Store(); s = DAT.DataAccess.GetStore().Where(j => j.StoreID == im.StoreID).FirstOrDefault(); im.StoreName = s.StoreName; im.StoreLocation = s.StoreLocation; //get the specific brand and assign the info to the ItemMain object LTS.Brand b = new LTS.Brand(); b = DAT.DataAccess.GetBrand().Where(y => y.BrandID == im.BrandID).FirstOrDefault(); im.BrandName = b.BrandName; im.BrandDescription = b.BrandDescription; //get the sepcific category and assign the info to the ItemMain object LTS.Category c = new LTS.Category(); c = DAT.DataAccess.GetCategory().Where(z => z.CategoryID == im.CategoryID).FirstOrDefault(); im.CategoryName = c.CategoryName; im.CategoryDescription = c.CategoryDescription; //get the sepcific category and assign the info to the ItemMain object LTS.Barcode ba = new LTS.Barcode(); ba = DAT.DataAccess.GetBarcode().Where(a => a.BarcodeID == im.BarcodeID).FirstOrDefault(); im.BarcodeNumber = ba.BarcodeNumber; imList.Add(im); dataGridView2.Rows.Add(im.itemID, im.EPC, im.ProductName, im.ProductDescription, im.BarcodeNumber, im.BrandName, im.CategoryName , im.ItemStatus, im.StoreName); } } catch (Exception ex) { MessageBox.Show("Sorry Something went wrong, the action was not completed!"); } }
public override void OnEnter() { base.OnEnter(); itemMain = Owner.GetComponent <ItemMain>(); }
//Devon private void button1_Click(object sender, EventArgs e) { dataGridView2.Rows.Clear(); string comboVal = comboBoxStore.SelectedItem.ToString(); int sIndex = comboBoxStore.SelectedIndex; LTS.Store st = listS[sIndex]; int storeID = st.StoreID; List <LTS.Item> i; if (whatCheck == "OutOfStock") { i = DAT.DataAccess.GetItem().Where(f => f.StoreID == storeID && f.ItemStatus == false).ToList(); } else if (whatCheck == "InStock") { i = DAT.DataAccess.GetItem().Where(f => f.StoreID == storeID && f.ItemStatus == true).ToList(); } else { i = DAT.DataAccess.GetItem().Where(f => f.StoreID == storeID).ToList(); } for (int x = 0; x < i.Count; x++) { ItemMain im = new ItemMain(); //assign the item info to the ItemMain object im.itemID = i[x].ItemID; im.EPC = i[x].TagEPC; im.ItemStatus = i[x].ItemStatus; im.ProductID = i[x].ProductID; im.StoreID = i[x].StoreID; //get the specific product and assign the info to the ItemMain object LTS.Product p = new LTS.Product(); p = DAT.DataAccess.GetProduct().Where(h => h.ProductID == im.ProductID).FirstOrDefault(); im.ProductName = p.ProductName; im.ProductDescription = p.ProductDescription; im.BrandID = p.BrandID; im.CategoryID = p.CategoryID; im.BarcodeID = p.BarcodeID; //get the specific store and assign the info to the ItemMain object LTS.Store s = new LTS.Store(); s = DAT.DataAccess.GetStore().Where(j => j.StoreID == im.StoreID).FirstOrDefault(); im.StoreName = s.StoreName; im.StoreLocation = s.StoreLocation; //get the specific brand and assign the info to the ItemMain object LTS.Brand b = new LTS.Brand(); b = DAT.DataAccess.GetBrand().Where(y => y.BrandID == im.BrandID).FirstOrDefault(); im.BrandName = b.BrandName; im.BrandDescription = b.BrandDescription; //get the sepcific category and assign the info to the ItemMain object LTS.Category c = new LTS.Category(); c = DAT.DataAccess.GetCategory().Where(z => z.CategoryID == im.CategoryID).FirstOrDefault(); im.CategoryName = c.CategoryName; im.CategoryDescription = c.CategoryDescription; //get the sepcific category and assign the info to the ItemMain object LTS.Barcode ba = new LTS.Barcode(); ba = DAT.DataAccess.GetBarcode().Where(a => a.BarcodeID == im.BarcodeID).FirstOrDefault(); im.BarcodeNumber = ba.BarcodeNumber; imList.Add(im); dataGridView2.Rows.Add(im.itemID, im.EPC, im.ProductName, im.ProductDescription, im.BarcodeNumber, im.BrandName, im.CategoryName , im.ItemStatus, im.StoreName); } }
//Devon private void radioButton1_CheckedChanged(object sender, EventArgs e) { if (radioButton1.Checked) { whatCheck = "All"; dataGridView2.Rows.Clear(); List <LTS.Item> i = new List <LTS.Item>(); i = DAT.DataAccess.GetItem().ToList();//list from db for (int x = 0; x < i.Count; x++) { ItemMain im = new ItemMain(); //assign the item info to the ItemMain object im.itemID = i[x].ItemID; im.EPC = i[x].TagEPC; im.ItemStatus = i[x].ItemStatus; im.ProductID = i[x].ProductID; im.StoreID = i[x].StoreID; //get the specific product and assign the info to the ItemMain object LTS.Product p = new LTS.Product(); p = DAT.DataAccess.GetProduct().Where(h => h.ProductID == im.ProductID).FirstOrDefault(); im.ProductName = p.ProductName; im.ProductDescription = p.ProductDescription; im.BrandID = p.BrandID; im.CategoryID = p.CategoryID; im.BarcodeID = p.BarcodeID; //get the specific store and assign the info to the ItemMain object LTS.Store s = new LTS.Store(); s = DAT.DataAccess.GetStore().Where(j => j.StoreID == im.StoreID).FirstOrDefault(); im.StoreName = s.StoreName; im.StoreLocation = s.StoreLocation; //get the specific brand and assign the info to the ItemMain object LTS.Brand b = new LTS.Brand(); b = DAT.DataAccess.GetBrand().Where(y => y.BrandID == im.BrandID).FirstOrDefault(); im.BrandName = b.BrandName; im.BrandDescription = b.BrandDescription; //get the sepcific category and assign the info to the ItemMain object LTS.Category c = new LTS.Category(); c = DAT.DataAccess.GetCategory().Where(z => z.CategoryID == im.CategoryID).FirstOrDefault(); im.CategoryName = c.CategoryName; im.CategoryDescription = c.CategoryDescription; //get the sepcific category and assign the info to the ItemMain object LTS.Barcode ba = new LTS.Barcode(); ba = DAT.DataAccess.GetBarcode().Where(a => a.BarcodeID == im.BarcodeID).FirstOrDefault(); im.BarcodeNumber = ba.BarcodeNumber; imList.Add(im); dataGridView2.Rows.Add(i[x].ItemID, i[x].TagEPC, p.ProductName, p.ProductDescription, ba.BarcodeNumber, b.BrandName, c.CategoryName , i[x].ItemStatus, s.StoreName); } } else { dataGridView2.Rows.Clear(); } }
private void item_radioOutStock_click(object sender, EventArgs e) { Log.WriteLog(LogType.Trace, "come in item_radioOutStock_click"); if (radioOutStock.Checked) { try { List <LTS.Item> i = new List <LTS.Item>(); i = DAT.DataAccess.GetItem().Where(s => s.ItemStatus == false).ToList(); //list from db List <ItemMain> imList = new List <ItemMain>(); for (int x = 0; x < i.Count; x++) { ItemMain im = new ItemMain(); //assign the item info to the ItemMain object im.itemID = i[x].ItemID; im.EPC = i[x].TagEPC; im.ItemStatus = i[x].ItemStatus; im.ProductID = i[x].ProductID; im.StoreID = i[x].StoreID; //get the specific product and assign the info to the ItemMain object LTS.Product p = new LTS.Product(); p = DAT.DataAccess.GetProduct().Where(h => h.ProductID == im.ProductID).FirstOrDefault(); im.ProductName = p.ProductName; im.ProductDescription = p.ProductDescription; im.BrandID = p.BrandID; im.CategoryID = p.CategoryID; im.BarcodeID = p.BarcodeID; //get the specific store and assign the info to the ItemMain object LTS.Store s = new LTS.Store(); s = DAT.DataAccess.GetStore().Where(j => j.StoreID == im.StoreID).FirstOrDefault(); im.StoreName = s.StoreName; im.StoreLocation = s.StoreLocation; //get the specific brand and assign the info to the ItemMain object LTS.Brand b = new LTS.Brand(); b = DAT.DataAccess.GetBrand().Where(y => y.BrandID == im.BrandID).FirstOrDefault(); im.BrandName = b.BrandName; im.BrandDescription = b.BrandDescription; //get the sepcific category and assign the info to the ItemMain object LTS.Category c = new LTS.Category(); c = DAT.DataAccess.GetCategory().Where(z => z.CategoryID == im.CategoryID).FirstOrDefault(); im.CategoryName = c.CategoryName; im.CategoryDescription = c.CategoryDescription; //get the sepcific category and assign the info to the ItemMain object LTS.Barcode ba = new LTS.Barcode(); ba = DAT.DataAccess.GetBarcode().Where(a => a.BarcodeID == im.BarcodeID).FirstOrDefault(); im.BarcodeNumber = ba.BarcodeNumber; imList.Add(im); dataGridView1.Rows.Add(im.itemID, im.EPC, im.ProductName, im.ProductDescription, im.BarcodeNumber, im.BrandName, im.CategoryName , im.ItemStatus, im.StoreName); } } catch (Exception ex) { Log.WriteLog(LogType.Error, "error to show item info into data grid view for out stock "); } } else { dataGridView1.Rows.Clear(); } }