private void btnFind_Click(object sender, RoutedEventArgs e) //Find a module & display it { DataFacadeSingleton df = DataFacadeSingleton.getInstance(); //Get access to te the data layer myModule = df.getModule(Int32.Parse(txtCode.Text)); //find module if (myModule != null) //if module found { update(); //display details } }
private void btnSave_Click(object sender, RoutedEventArgs e) { //Save the existing module to the DataLayer try { myModule.code = Int32.Parse(txtCode.Text); } catch (Exception ex) { Console.WriteLine(ex.Message); } myModule.name = txtName.Text; //Get access to the datalayer DataFacadeSingleton df = DataFacadeSingleton.getInstance(); //Save the module df.addModule(myModule); }
public static DataFacadeSingleton GetInstance() { return(reference ?? (reference = new DataFacadeSingleton())); }