private void BtImpDeletePro_Click(object sender, EventArgs e) { List <DetailImport> List = new List <DetailImport>(); var IdBill = DgvImp.CurrentRow.Cells["ID"].Value.ToString(); int Bill = Convert.ToInt16(IdBill); for (int i = 0; i < DgvImpPro.RowCount; i++) { DetailImport ImpPro = new DetailImport(); var str = DgvImpPro.Rows[i].Cells["ID"].Value.ToString(); ImpPro.IDProduct = Convert.ToInt16(str); ImpPro.IDBill = Bill; var quan = DgvImpPro.Rows[i].Cells["Quantity"].Value.ToString(); ImpPro.Quantity = Convert.ToInt16(quan); List.Add(ImpPro); } var IdPro = DgvImpPro.CurrentRow.Cells["ID"].Value.ToString(); int Pro = Convert.ToInt16(IdPro); var ProImp = List.Where(p => p.IDProduct == Pro).SingleOrDefault(); List.Remove(ProImp); LoadPro(List); TxtImpProCode.Clear(); TxtImpProName.Clear(); TxtImpProUnit.Clear(); TxtImpProQuan.Clear(); }
private void BtImpFresh_Click(object sender, EventArgs e) { TxtImpDeliver.Clear(); TxtImpProCode.Clear(); TxtImpProName.Clear(); TxtImpProQuan.Clear(); TxtImpProUnit.Clear(); var result = db.Storekeepers.Find(Medium.IdSto); TxtImpStoID.Text = result.ID.ToString(); TxtImpStorekeeper.Text = result.Name; DgvImpPro.DataSource = null; }
private void TxtImpProCode_TextChanged(object sender, EventArgs e) { var result = db.Products.Where(p => p.Code == TxtImpProCode.Text).SingleOrDefault(); if (result != null) { TxtImpProName.Text = result.Name; TxtImpProUnit.Text = result.Unit; CbImpProSup.SelectedValue = result.IdCom; } else { TxtImpProName.Clear(); TxtImpProUnit.Clear(); } }