public List<OpenImportExport> GetAllOpenIE(List<ImportExport> listIE) { List<OpenImportExport> result = new List<OpenImportExport>(); listIE = GetAllIE(); foreach (var item in listIE) { OpenImportExport openIE = new OpenImportExport(); CustomerDAL customerDAL = new CustomerDAL(); openIE.CheckNo = item.CheckNo; openIE.Date = item.Date; openIE.Type = item.Type; openIE.ImEx = item.ImEx; openIE.CustomerName = customerDAL.GetCustomerbyID(item.CustomerID).CustomerName; result.Add(openIE); } return result; }
public List<OpenImportExport> GetExport() { List<OpenImportExport> list = new List<OpenImportExport>(); ImportExportDAL IEDAL = new ImportExportDAL(); string cs = CocBook.Properties.Settings.Default.connectionString; SqlConnection con = new SqlConnection(cs); SqlCommand cmd = new SqlCommand("Select * from ImportExport where ImportExport = @E", con); cmd.Parameters.AddWithValue("E", "Xuất"); con.Open(); SqlDataReader sdr = cmd.ExecuteReader(); while (sdr.Read()) { OpenImportExport openIE = new OpenImportExport(); CustomerDAL customerDAL = new CustomerDAL(); openIE.CheckNo = (int)sdr["CheckNo"]; openIE.Date = (DateTime)sdr["Date"]; openIE.Type = (string)sdr["Type"]; openIE.ImEx = (string)sdr["ImportExport"]; int customerID = (int)sdr["CustomerID"]; openIE.CustomerName = customerDAL.GetCustomerbyID(customerID).CustomerName; list.Add(openIE); } con.Close(); return list; }