//Load danh sách các sản phẩm trong hợp đồng private List <ContractDeteilInformation> LoadListProduct(int idContract) { var temp = detail.GetByIdList(idContract); List <ContractDeteilInformation> product = new List <ContractDeteilInformation>(); foreach (var item in temp) { var pro = new ContractDeteilInformation() { ProductName = this.product.GetById(item.ProductID).ProductName, Quantity = detail.GetByTwoId(item.ContractID, item.ProductID).Quantity, Notes = detail.GetByTwoId(item.ContractID, item.ProductID).Notes }; product.Add(pro); } return(product); }
private List <ContractDeteilInformation> LoadListProduct(int mahd) { var list = new List <ContractDeteilInformation>(); var listDetail = detail.GetByIdList(mahd); foreach (var item in listDetail) { var dt = new ContractDeteilInformation() { ProductName = product.GetById(item.ProductID).ProductName, Quantity = item.Quantity, Notes = item.Notes }; list.Add(dt); } return(list); }
private void gridControl3_Click(object sender, EventArgs e) { try { id = int.Parse(gridView3.GetRowCellValue(gridView3.FocusedRowHandle, gridView3.Columns[0]).ToString()); cbmanv.Text = gridView3.GetRowCellValue(gridView3.FocusedRowHandle, gridView3.Columns[1]).ToString(); cbncc.Text = gridView3.GetRowCellValue(gridView3.FocusedRowHandle, gridView3.Columns[2]).ToString(); datecreate.Text = gridView3.GetRowCellValue(gridView3.FocusedRowHandle, gridView3.Columns[3]).ToString(); datengaygiao.Text = gridView3.GetRowCellValue(gridView3.FocusedRowHandle, gridView3.Columns[4]).ToString(); status = gridView3.GetRowCellValue(gridView3.FocusedRowHandle, gridView3.Columns[5]).ToString(); txtghichu.Text = gridView3.GetRowCellValue(gridView3.FocusedRowHandle, gridView3.Columns[6]).ToString(); int idEmp = int.Parse(gridView3.GetRowCellValue(gridView3.FocusedRowHandle, gridView3.Columns[1]).ToString()); int idSup = int.Parse(gridView3.GetRowCellValue(gridView3.FocusedRowHandle, gridView3.Columns[2]).ToString()); List <Supplier> su = new List <Supplier>(); List <ContractDeteilInformation> detail = new List <ContractDeteilInformation>(); var chitiet = cd.GetByIdList(id); foreach (var item in chitiet) { var proInfomation = new ContractDeteilInformation() { ProductName = pro.GetById(item.ProductID).ProductName, Quantity = item.Quantity, Notes = item.Notes }; detail.Add(proInfomation); } var temp = new UserInfomation() { EmployeeName = emp.GetById(idEmp).EmployeeName, UserName = account.GetById(idEmp).UserName, Role = account.GetById(idEmp).Role }; var ac = new List <UserInfomation>(); ac.Add(temp); gridControl1.DataSource = ac; gridControl2.DataSource = su; gridControl4.DataSource = detail; } catch { XtraMessageBox.Show("Please try again!", "Thông báo"); } }
private TongTienHD TinhTienHD(int idHoaDon) { var listDetail = detail.GetByIdList(idHoaDon); decimal sum = 0; foreach (var item in listDetail) { var product = new Product() { ImportPrice = this.product.GetById(item.ProductID).ImportPrice }; sum += (product.ImportPrice * item.Quantity); } var temp = new TongTienHD() { ContractID = idHoaDon, Moneys = sum }; return(temp); }