//save change to database
        private bool Save()
        {
            equipmentModifyTableAdapter equipmentModifyTableAdapter = new equipmentModifyTableAdapter();
            order_lineTableAdapter      order_LineTableAdapter      = new order_lineTableAdapter();
            service_orderTableAdapter   service_OrderTableAdapter   = new service_orderTableAdapter();
            receiptModifyTableAdapter   receiptModifyTableAdapter   = new receiptModifyTableAdapter();
            customerModifyTableAdapter  customerModifyTableAdapter  = new customerModifyTableAdapter();

            try
            {
                order_LineTableAdapter.Update(dsSales.order_line);
                service_OrderTableAdapter.Update(dsSales.service_order);
                receiptModifyTableAdapter.Update(dsSales.receiptModify);
                equipmentModifyTableAdapter.Update(dsSales.equipmentModify);
                customerModifyTableAdapter.Update(dsSales.customerModify);
                dsSales.AcceptChanges();
                dsSales.customerModify.Clear();
                dsSales.receiptModify.Clear();
                dsSales.order_line.Clear();
                dsSales.service_order.Clear();
                dsSales.equipmentModify.Clear();
                customerModifyTableAdapter.Fill(dsSales.customerModify);
                receiptModifyTableAdapter.Fill(dsSales.receiptModify);
                order_LineTableAdapter.Fill(dsSales.order_line);
                service_OrderTableAdapter.Fill(dsSales.service_order);
                equipmentModifyTableAdapter.Fill(dsSales.equipmentModify);
                return(true);
            }
            catch
            {
                dsSales.RejectChanges();
                return(false);
            }
        }
        //update customer to database
        private bool SaveCustomer()
        {
            customerModifyTableAdapter customerModifyTableAdapter = new customerModifyTableAdapter();

            try
            {
                customerModifyTableAdapter.Update(dsSales.customerModify);
                dsSales.AcceptChanges();
                dsSales.customerModify.Clear();
                customerModifyTableAdapter.Fill(dsSales.customerModify);
                return(true);
            }
            catch
            {
                dsSales.RejectChanges();
                return(false);
            }
        }
Exemplo n.º 3
0
        //method to save changes back to the receipt table
        private bool SaveReceipt()
        {
            receiptModifyTableAdapter receiptModifyTableAdapter = new receiptModifyTableAdapter();

            try
            {
                receiptModifyTableAdapter.Update(dsSales.receiptModify);
                dsSales.AcceptChanges();
                dsSales.receiptModify.Clear();
                receiptModifyTableAdapter.Fill(dsSales.receiptModify);
                return(true);
            }
            catch
            {
                dsSales.RejectChanges();
                return(false);
            }
        }