/* * This method will search supplier info * @author A.K.M. Nazmul Islam on 30th january 2016 */ private void OnSearch() { SupplierManager supplierManager = new SupplierManager(); SupplierList.Clear(); for (Iterator i = supplierManager.searchSuppliers(SearchSupplierByPhone).iterator(); i.hasNext();) { SupplierInfo supplierInfo = (SupplierInfo)i.next(); SupplierInfoNJ supplierInfoNJ = new SupplierInfoNJ(); supplierInfoNJ.ProfileInfoNJ.Id = supplierInfo.getProfileInfo().getId(); supplierInfoNJ.ProfileInfoNJ.FirstName = supplierInfo.getProfileInfo().getFirstName(); supplierInfoNJ.ProfileInfoNJ.LastName = supplierInfo.getProfileInfo().getLastName(); supplierInfoNJ.ProfileInfoNJ.Phone = supplierInfo.getProfileInfo().getPhone(); supplierInfoNJ.ProfileInfoNJ.Fax = supplierInfo.getProfileInfo().getFax(); supplierInfoNJ.ProfileInfoNJ.Email = supplierInfo.getProfileInfo().getEmail(); supplierInfoNJ.ProfileInfoNJ.Website = supplierInfo.getProfileInfo().getWebsite(); supplierInfoNJ.Remarks = supplierInfo.getRemarks(); SupplierList.Add(supplierInfoNJ); } }
public void CreateSupplierList() { SupplierList.Clear(); SqlConnection con = Methods.AccessDatabase(); SqlDataAdapter autoNode = new SqlDataAdapter("SELECT * From [SUPPLIER]", con); DataTable dt = new DataTable(); autoNode.Fill(dt); for (int i = 0; i < dt.Rows.Count; i++) { SUPPLIER newSupplier = new SUPPLIER(); newSupplier.SupplierID = Convert.ToInt16(dt.Rows[i]["Supplier_ID"]); newSupplier.SupplierName = dt.Rows[i]["Supplier_Name"].ToString(); newSupplier.SupplierDetails = dt.Rows[i]["Supplier_Details"].ToString(); SupplierList.Add(newSupplier); } }