public void AddNewSupplier() { AddNewSupplierWindow supplierWindow = new AddNewSupplierWindow(); supplierWindow.Owner = Application.Current.MainWindow; supplierWindow.WindowStartupLocation = WindowStartupLocation.CenterOwner; SUPPLIER supp = new SUPPLIER(); supplierWindow.DataContext = supp; var result = supplierWindow.ShowDialog(); if (result == true) { supplierNameList.Add(supp); } }
public void RefreshSupplier() { SqlConnection con = SQLCONNECTION.GetConnection(); SqlDataAdapter sda = new SqlDataAdapter("SELECT * From [SUPPLIER]", con); DataTable dt = new DataTable(); sda.Fill(dt); SupplierNameList.Clear(); for (int i = 0; i < dt.Rows.Count; i++) { SUPPLIER supp = new SUPPLIER(); supp.SupplierName = dt.Rows[i]["Supplier_Name"].ToString(); supp.SupplierID = Convert.ToInt16(dt.Rows[i]["Supplier_ID"]); supp.ContactNumber = dt.Rows[i]["Contact_Number"].ToString(); supp.Location = dt.Rows[i]["Location"].ToString(); SupplierNameList.Add(supp); } }