示例#1
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;
            }
        }
示例#2
0
        private void Check_Click(object sender, EventArgs e)
        {
            ShowAll(true);
            customer = new Customer();
            customer = customerController.Find(Identity.Text);
            if (customerController.Contains(Identity.Text))
            {
                idEdit                         = customer.CustomerID;
                label1.Text                    = "Guest Found";
                overView.myCustomer            = new Customer();
                overView.myCustomer.CustomerID = Identity.Text;
                PopulateTextBoxes(customer);
                state   = FormStates.Edit;
                dbState = DB.DBOperation.Edit;

                ContinueB.Enabled = true;
            }
            else
            {
                label1.Text         = "Guest Not Found! Add new Guest";
                overView.myCustomer = new Customer();
                state   = FormStates.Add;
                dbState = DB.DBOperation.Add;
                //PopulateObject();
                ContinueB.Enabled = true;
            }
        }
示例#3
0
 private void FillRow(DataRow aRow, Payment aPayment, DB.DBOperation operation)
 {
     aRow["Id"]        = aPayment.PaymentID; //NOTE square brackets to indicate index of collections of fields in row.
     aRow["ACCOUNTID"] = aPayment.AccountID;
     aRow["TYPE"]      = aPayment.Type;
     aRow["AMOUNT"]    = aPayment.Amount;
 }
示例#4
0
        public void DataMaintenance(Guest aGuest, DB.DBOperation operation)
        {
            int index = 0;

            //perform a given database operation to the dataset in meory;
            hotelDB.DataSetChange(aGuest, operation);
            //perform operations on the collection
            switch (operation)
            {
            case DB.DBOperation.Add:
                //*** Add the guest to the Collection
                guests.Add(aGuest);
                break;

            case DB.DBOperation.Edit:
                index         = FindIndex(aGuest);
                guests[index] = aGuest;      // replace guest at this index with the updated guest
                break;

            case DB.DBOperation.Delete:
                index = FindIndex(aGuest);   // find the index of the specific guest in collection
                guests.RemoveAt(index);      // remove that guest form the collection
                break;
            }
        }
示例#5
0
        public void DataMaintenance(Charge aAccount, DB.DBOperation operation)
        {
            int index = 0;

            //perform a given database operation to the dataset in meory;
            chargeDB.DataSetChange(aAccount, operation);
            //perform operations on the collection
            switch (operation)
            {
            case DB.DBOperation.Add:
                //*** Add the Guest to the Collection
                charges.Add(aAccount);
                break;

            case DB.DBOperation.Edit:
                index          = FindIndex(aAccount);
                charges[index] = aAccount;      // replace Guest at this index with the updated Guest
                break;

            case DB.DBOperation.Delete:
                index = FindIndex(aAccount);  // find the index of the specific Guest in collection
                charges.RemoveAt(index);      // remove that Guest form the collection
                break;
            }
        }
示例#6
0
        public void DataMaintenance(Booking myBooking, DB.DBOperation operation)
        {
            int index = 0;

            //perform a given database operation to the dataset in meory;
            BookingDB.DataSetChange(myBooking, operation);
            //perform operations on the collection
            switch (operation)
            {
            case DB.DBOperation.Add:
                //*** Add the Booking to the Collection
                Bookings.Add(myBooking);
                break;

            case DB.DBOperation.Edit:
                index           = FindIndex(myBooking);
                Bookings[index] = myBooking;      // replace Booking at this index with the updated Booking
                break;

            case DB.DBOperation.Delete:
                index = FindIndex(myBooking);  // find the index of the specific Booking in collection
                Bookings.RemoveAt(index);      // remove that Booking form the collection
                break;
            }
        }
示例#7
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;
            }
        }
示例#8
0
        public void DataSetChange(Guest aGuest, DB.DBOperation operation)
        {
            DataRow aRow      = null;
            string  dataTable = table1;

            //***In this case the dataset change refers to adding to a database table
            //***We now have  3 tables.. once they are placed in an array .. this becomes easier

            switch (operation)
            {
            case DB.DBOperation.Add:
                aRow = dsMain.Tables[dataTable].NewRow();
                FillRow(aRow, aGuest, operation);
                //Add to the dataset
                dsMain.Tables[dataTable].Rows.Add(aRow);
                break;

            case DB.DBOperation.Edit:
                // to Edit
                aRow = dsMain.Tables[dataTable].Rows[FindRow(aGuest, dataTable)];
                FillRow(aRow, aGuest, operation);
                break;

            case DB.DBOperation.Delete:
                //to delete
                aRow = dsMain.Tables[dataTable].Rows[FindRow(aGuest, dataTable)];
                aRow.Delete();
                break;
            }
        }
示例#9
0
        public void DataSetChange(Booking myBooking, DB.DBOperation operation)
        {
            DataRow aRow = null;

            switch (operation)
            {
            case DB.DBOperation.Add:
                aRow = dsMain.Tables[table1].NewRow();
                FillRow(aRow, myBooking, operation);
                //Add to the dataset
                dsMain.Tables[table1].Rows.Add(aRow);
                break;

            case DB.DBOperation.Edit:
                // to Edit
                aRow = dsMain.Tables[table1].Rows[FindRow(myBooking)];
                FillRow(aRow, myBooking, operation);
                break;

            case DB.DBOperation.Delete:
                //to delete
                aRow = dsMain.Tables[table1].Rows[FindRow(myBooking)];
                aRow.Delete();
                break;
            }
        }
示例#10
0
        public void DataMaintenance(PaymentDetail myPaymentDetail, DB.DBOperation operation)
        {
            int index = 0;

            //perform a given database operation to the dataset in meory;
            PaymentDetailDB.DataSetChange(myPaymentDetail, operation);
            //perform operations on the collection
            switch (operation)
            {
            case DB.DBOperation.Add:
                //*** Add the PaymentDetail to the Collection
                PaymentDetails.Add(myPaymentDetail);
                break;

            case DB.DBOperation.Edit:
                index = FindIndex(myPaymentDetail);
                PaymentDetails[index] = myPaymentDetail;      // replace PaymentDetail at this index with the updated PaymentDetail
                break;

            case DB.DBOperation.Delete:
                index = FindIndex(myPaymentDetail);  // find the index of the specific PaymentDetail in collection
                PaymentDetails.RemoveAt(index);      // remove that PaymentDetail form the collection
                break;
            }
        }
示例#11
0
 private void FillRow(DataRow aRow, Account aAccount, DB.DBOperation operation)
 {
     aRow["Id"]             = aAccount.AccountID; //NOTE square brackets to indicate index of collections of fields in row.
     aRow["IDPASSPORT"]     = aAccount.IDPassport;
     aRow["RESERVATIONREF"] = aAccount.ReservationRef;
     aRow["ACCSTATUS"]      = aAccount.Status;
     aRow["BALANCE"]        = aAccount.Balance;
 }
示例#12
0
 private void FillRow(DataRow aRow, Reservation aReservation, DB.DBOperation operation)
 {
     aRow["ID"]         = aReservation.Id; //NOTE square brackets to indicate index of collections of fields in row.
     aRow["STARTDATE"]  = aReservation.StartDate;
     aRow["ENDDATE"]    = aReservation.EndDate;
     aRow["IDPASSPORT"] = aReservation.IdPassport;
     aRow["ROOM"]       = aReservation.RoomNumber;
 }
示例#13
0
 private void FillRow(DataRow aRow, Guest aGuest, DB.DBOperation operation)
 {
     aRow["ID"]           = aGuest.GuestID; //NOTE square brackets to indicate index of collections of fields in row.
     aRow["IDPASSPORT"]   = aGuest.IdPassport;
     aRow["FIRSTNAME"]    = aGuest.FirstName;
     aRow["LASTNAME"]     = aGuest.LastName;
     aRow["GUESTADDRESS"] = aGuest.GuestAddress;
     aRow["EMAIL"]        = aGuest.EmailAddress;
 }
示例#14
0
 public Form1(Overview overView)
 {
     InitializeComponent();
     this.overView      = overView;
     customerController = overView.customerController;
     state             = FormStates.Add;
     dbState           = DB.DBOperation.Add;
     ContinueB.Enabled = false;
 }
 private void FillRow(DataRow aRow, PaymentDetail myPaymentDetail, DB.DBOperation operation)
 {
     if (operation == DB.DBOperation.Add)
     {
         aRow["PaymentID"] = myPaymentDetail.PaymentID;
     }
     aRow["CreditCardNumber"] = myPaymentDetail.CreditCardNumber;
     aRow["ExpiryMonth"]      = myPaymentDetail.ExpiryMonth;
     aRow["ExpiryYear"]       = myPaymentDetail.ExpiryYear;
     aRow["CVC"] = myPaymentDetail.CVC;
 }
        private void FillRow(DataRow aRow, OrderItems aItem, DB.DBOperation operation)
        {
            if (operation == DB.DBOperation.Add)
            {
                aRow["OrderItemID"] = aItem.OrderItemID;  //NOTE square brackets to indicate index of collections of fields in row.
            }

            aRow["OrderID"]   = aItem.OrderID;
            aRow["ProductID"] = aItem.ProductID;
            aRow["Quantity"]  = aItem.Quantity;
        }
 private void FillRow(DataRow aRow, Employee anEmployee, DB.DBOperation operation)
 {
     if (operation == DB.DBOperation.Add)
     {
         aRow["EmpID"] = anEmployee.EmployeeID;  //NOTE square brackets to indicate index of collections of fields in row.
     }
     aRow["Name"]     = anEmployee.Name;
     aRow["Phone"]    = anEmployee.Phone;
     aRow["Role"]     = (int)anEmployee.RoleValue;
     aRow["Password"] = anEmployee.Password;
 }
示例#18
0
 private void FillRow(DataRow aRow, Customer myCustomer, DB.DBOperation operation)
 {
     if (operation == DB.DBOperation.Add)
     {
         aRow["CustomerID"] = myCustomer.CustomerID;
     }
     aRow["Name"]         = myCustomer.Name;
     aRow["Surname"]      = myCustomer.Surname;
     aRow["Address"]      = myCustomer.Address;
     aRow["EmailAddress"] = myCustomer.EmailAddress;
     aRow["Phone"]        = myCustomer.Phone;
 }
        private void FillRow(DataRow aRow, Order anOrder, DB.DBOperation operation)
        {
            if (operation == DB.DBOperation.Add)
            {
                aRow["OrderID"] = anOrder.OrderID;  //NOTE square brackets to indicate index of collections of fields in row.
            }

            aRow["CustomerID"]  = anOrder.CustomerID;
            aRow["OrderDate"]   = anOrder.OrderDate;
            aRow["TotalCost"]   = anOrder.TotalCost;
            aRow["SpecialNote"] = anOrder.SpecialNote;
            aRow["OrderStatus"] = (byte)anOrder.OrderValue;
        }
示例#20
0
        private void FillRow(DataRow aRow, Product aProduct, DB.DBOperation operation)
        {
            if (operation == DB.DBOperation.Add)
            {
                aRow["ProductID"] = aProduct.ProductID;  //NOTE square brackets to indicate index of collections of fields in row.
            }

            aRow["ProductName"]     = aProduct.ProductName;
            aRow["ExpiryDate"]      = aProduct.ExpiryDate;
            aRow["QuantityInStock"] = aProduct.QuantityInStock;
            aRow["Price"]           = aProduct.Price;
            aRow["ExpiredProduct"]  = aProduct.ProductValue;
        }
        private void FillRow(DataRow aRow, Customer aCust, DB.DBOperation operation)
        {
            //Customer aCust;

            if (operation == DB.DBOperation.Add)
            {
                aRow["CustomerID"] = aCust.CustomerID;  //NOTE square brackets to indicate index of collections of fields in row.
            }

            aRow["CustomerName"]          = aCust.Name;
            aRow["CustomerSurname"]       = aCust.Surname;
            aRow["CustomerPhone"]         = aCust.Phone;
            aRow["CustomerIDNumber"]      = aCust.IDNumber1;
            aRow["CustomerCurrentCredit"] = aCust.CurrentCredit;
            aRow["CustomerCreditStatus"]  = aCust.CreditStatus;
            aRow["CustomerAddress"]       = aCust.CustomerAddress;
            //*** For each role add the specific data variables
        }
        public void DataSetChange(Employee anEmp, DB.DBOperation operation)
        {
            DataRow aRow      = null;
            string  dataTable = table1;

            //***In this case the dataset change refers to adding to a database table
            //***We now have  3 tables.. once they are placed in an array .. this becomes easier
            switch (anEmp.role.RoleValue)
            {
            case Role.RoleType.Headwaiter:
                dataTable = table1;
                break;

            case Role.RoleType.Waiter:
                dataTable = table2;
                break;

            case Role.RoleType.Runner:
                dataTable = table3;
                break;
            }
            switch (operation)
            {
            case DB.DBOperation.Add:
                aRow = dsMain.Tables[dataTable].NewRow();
                FillRow(aRow, anEmp, operation);
                //Add to the dataset
                dsMain.Tables[dataTable].Rows.Add(aRow);
                break;

            case DB.DBOperation.Edit:
                // to Edit
                aRow = dsMain.Tables[dataTable].Rows[FindRow(anEmp, dataTable)];
                FillRow(aRow, anEmp, operation);
                break;

            case DB.DBOperation.Delete:
                //to delete
                aRow = dsMain.Tables[dataTable].Rows[FindRow(anEmp, dataTable)];
                aRow.Delete();
                break;
            }
        }
        public void DataMaintenance(Order anOrder, DB.DBOperation operation)
        {
            int index = 0;

            //perform a given database operation to the dataset in meory;
            orderDB.DataSetChange(anOrder, operation);
            //perform operations on the collection
            switch (operation)
            {
            case DB.DBOperation.Add:
                //*** Add the employee to the Collection
                orders.Add(anOrder);
                break;

            case DB.DBOperation.Edit:
                index         = FindIndex(anOrder);
                orders[index] = anOrder;      // replace employee at this index with the updated employee
                break;
            }
        }
        public void DataMaintenance(Product aProduct, DB.DBOperation operation)
        {
            int index = 0;

            //perform a given database operation to the dataset in meory;
            productDB.DataSetChange(aProduct, operation);
            //perform operations on the collection
            switch (operation)
            {
            case DB.DBOperation.Add:
                //*** Add the employee to the Collection
                products.Add(aProduct);
                break;

            case DB.DBOperation.Edit:
                index           = FindIndex(aProduct);
                products[index] = aProduct;      // replace employee at this index with the updated employee
                break;
            }
        }
示例#25
0
        private void FillRow(DataRow aRow, Booking myBooking, DB.DBOperation operation)
        {
            if (operation == DB.DBOperation.Add)
            {
                aRow["BookingID"] = myBooking.BookingID;
            }
            aRow["CustomerID"]    = myBooking.CustomerID;
            aRow["NumberOfRooms"] = myBooking.NumberOfRooms;
            aRow["ArrivalDate"]   = myBooking.ArrivalDate;
            aRow["DepartureDate"] = myBooking.DepartureDate;
            aRow["DepositAmount"] = myBooking.DepositAmount;
            aRow["DepositPaid"]   = myBooking.DepositPaid;

            if (myBooking.PaymentID == null)
            {
                aRow["PaymentID"] = System.DBNull.Value;
            }
            else
            {
                aRow["PaymentID"] = myBooking.PaymentID;
            }
        }
        private void FillRow(DataRow aRow, Employee anEmp, DB.DBOperation operation)
        {
            HeadWaiter headwaiter;
            Runner     runner;
            Waiter     waiter;

            if (operation == DB.DBOperation.Add)
            {
                aRow["ID"]    = anEmp.ID; //NOTE square brackets to indicate index of collections of fields in row.
                aRow["EmpID"] = anEmp.EmpID;
            }
            aRow["Name"]  = anEmp.Name;
            aRow["Phone"] = anEmp.Phone;
            aRow["Role"]  = (byte)anEmp.role.RoleValue;
            //*** For each role add the specific data variables
            switch (anEmp.role.RoleValue)
            {
            case Role.RoleType.Headwaiter:
                headwaiter     = (HeadWaiter)anEmp.role;
                aRow["Salary"] = headwaiter.Salary;
                break;

            case Role.RoleType.Waiter:
                waiter             = (Waiter)anEmp.role;
                aRow["DayRate"]    = waiter.Rate;
                aRow["NoOfShifts"] = waiter.NumberOfShifts;
                aRow["Tips"]       = waiter.Tips;
                break;

            case Role.RoleType.Runner:
                runner             = (Runner)anEmp.role;
                aRow["DayRate"]    = runner.Rate;
                aRow["NoOfShifts"] = runner.NumberOfShifts;
                break;
            }
        }