Exemple #1
0
        public void DataMaintenance(Customer aCust, DB.DBOperation operation)
        {
            int index = 0;

            //perform a given database operation to the dataset in meory;
            customerDB.DataSetChange(aCust, operation);

            //perform operations on the collection
            switch (operation)
            {
            case DB.DBOperation.Add:
                //*** Add the employee to the Collection
                customers.Add(aCust);
                break;

            case DB.DBOperation.Edit:
                index            = FindIndex(aCust);
                customers[index] = aCust;      // replace employee at this index with the updated employee
                break;

            case DB.DBOperation.Delete:
                index = FindIndex(aCust);      // find the index of the specific employee in collection
                customers.RemoveAt(index);     // remove that employee form the collection
                break;
            }
        }
Exemple #2
0
        public void DataMaintenance(Customer myCustomer, DB.DBOperation operation)
        {
            int index = 0;

            //perform a given database operation to the dataset in meory;
            CustomerDB.DataSetChange(myCustomer, operation);
            //perform operations on the collection
            switch (operation)
            {
            case DB.DBOperation.Add:
                //*** Add the Customer to the Collection
                Customers.Add(myCustomer);
                break;

            case DB.DBOperation.Edit:
                index            = FindIndex(myCustomer);
                Customers[index] = myCustomer;      // replace Customer at this index with the updated Customer
                break;

            case DB.DBOperation.Delete:
                index = FindIndex(myCustomer);  // find the index of the specific Customer in collection
                Customers.RemoveAt(index);      // remove that Customer form the collection
                break;
            }
        }