Пример #1
0
        private void can_Submit_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
        {
            connect = new CTUConnection();

            if (txt_BankNo.MaxLength != 18 || string.IsNullOrEmpty(txt_BankNo.Text))
            {
                MessageBox.Show("Make sure the bank account number is correct");
            }

            else if (string.IsNullOrEmpty(txt_Firstname.Text))
            {
                MessageBox.Show("Please enter the firstname of the customer");
            }

            else if (txt_IDnumber.MaxLength != 13 || string.IsNullOrEmpty(txt_IDnumber.Text))
            {
                MessageBox.Show("Please enter the ID number of the customer");
            }

            else if (string.IsNullOrEmpty(txt_Surname.Text))
            {
                MessageBox.Show("Please enter the surname of the customer");
            }

            else if (string.IsNullOrEmpty(txt_Password.Text))
            {
                MessageBox.Show("Please enter the password of the customer");
            }

            else
            {
                connect.UpdateCustomer(txt_Username.Text, txt_Password.Text, txt_Firstname.Text, txt_Surname.Text, txt_IDnumber.Text, txt_BankNo.Text, int.Parse(ID));
            }
        }
        private void can_Submit_MouseDown(object sender, System.Windows.Input.MouseButtonEventArgs e)
        {
            connect = new CTUConnection();

            try
            {
                if (Department == 1)
                {
                    connect.GetInvoiceNewCar(int.Parse(cmbx_SalesMan.SelectedValue.ToString()), ServicePlan, Convert.ToDateTime(DTP_Date.SelectedDate.ToString()), int.Parse(cmbx_Cust.SelectedValue.ToString()), int.Parse(cmbx_Car.SelectedValue.ToString()));
                }

                else if (Department == 2)
                {
                    connect.GetInvoiceOldCar(int.Parse(cmbx_Car.SelectedValue.ToString()), ServicePlan, Convert.ToDateTime(DTP_Date.SelectedDate.ToString()), int.Parse(cmbx_Cust.SelectedValue.ToString()), int.Parse(cmbx_Car.SelectedValue.ToString()));
                }

                else if (Department == 3)
                {
                    connect.GetInvoiceServiceCar(int.Parse(cmbx_Mech.SelectedValue.ToString()), txt_Price.Text, Convert.ToDateTime(DTP_Date.SelectedDate.ToString()), int.Parse(cmbx_Cust.SelectedValue.ToString()), txt_Prob.Text);
                }

                else if (Department == 4)
                {
                    connect.GetInvoiceParts(Convert.ToDateTime(DTP_Date.SelectedDate.ToString()), int.Parse(cmbx_Cust.SelectedValue.ToString()), int.Parse(cmbx_Parts.SelectedValue.ToString()));
                }
            }

            catch (Exception)
            {
            }
        }
 private void txt_Color_TextChanged(object sender, System.Windows.Controls.TextChangedEventArgs e)
 {
     connect = new CTUConnection();                // refreshens the 'CTUConnection' class //
     connect.SelectWareHouseVehicle();             //*Selects the specified columns in the Patient table*//
     connect.SearchWareHouseColor(txt_Color.Text); //Searches the customer's 'name' within the populated table//
     DGV_Warehouse.ItemsSource = connect.dataset;  //*All the selected fields are filtered inside the table and stored inside the grid-view*//
 }
        private void Rad_New_Click(object sender, System.Windows.RoutedEventArgs e)
        {
            Type = "New";                                //Set the string "Type" variable Text to "New"//
            GRP_Vehicle.Header = "Select a new vehicle"; //Set the header of the group-box "GRP_Vehicle" to 'Select a new vehicle'//

            Rad_New.Foreground  = new SolidColorBrush(Colors.Red);
            Rad_Used.Foreground = new SolidColorBrush(Colors.Black);
            Rad_Demo.Foreground = new SolidColorBrush(Colors.Black);

            connect = new CTUConnection();
            connect.SelectTestDrive();
            for (int i = 0; i <= connect.table.Rows.Count; i++)
            {
                this.BookCount = i + 1;
            }


            connect.SelectNewDrive();
            cmbx_Vehicle.ItemsSource       = connect.table2.DefaultView;
            cmbx_Vehicle.DisplayMemberPath = "[Name of vehicle]";
            cmbx_Vehicle.SelectedValuePath = "ID";


            Dock_Decision.Visibility = Visibility.Visible;
        }
Пример #5
0
        private void can_Submit_MouseDown(object sender, MouseButtonEventArgs e)
        {
            connect = new CTUConnection();

            if (txt_serial.MaxLength != 13 || string.IsNullOrEmpty(txt_serial.Text))
            {
                MessageBox.Show("Please enter a serial number for the vehicle");
            }

            else if (string.IsNullOrEmpty(txt_Brand.Text))
            {
                MessageBox.Show("Please enter the serial number of the vehicle");
            }

            else if (string.IsNullOrEmpty(txt_Color.Text))
            {
                MessageBox.Show("Please enter the color of vehicle");
            }

            else if (string.IsNullOrEmpty(txt_Model.Text))
            {
                MessageBox.Show("Please enter the model of the vehicle");
            }

            else if (string.IsNullOrEmpty(txt_Price.Text))
            {
                MessageBox.Show("Please enter a serial number for the vehicle");
            }

            else
            {
                connect.GetNewVehicles(txt_Brand.Text, txt_Model.Text, txt_serial.Text, txt_Color.Text, txt_Price.Text, Convert.ToDateTime(DTP_Year.SelectedDate.ToString()));
            }
        }
Пример #6
0
        private void can_Submit_MouseDown(object sender, MouseButtonEventArgs e)
        {
            connect = new CTUConnection();

            try
            {
                if (string.IsNullOrEmpty(txt_BookNo.Text))
                {
                    MessageBox.Show("Please insert a booking number");
                }

                else
                {
                    if (Rad_New.IsChecked == true)
                    {
                        connect.UpdateTestDrive(Convert.ToDateTime(DTP_Date.SelectedDate.ToString()), int.Parse(txt_BookNo.Text), int.Parse(cmbx_Cust.SelectedValue.ToString()), int.Parse(cmbx_Vehicle.SelectedValue.ToString()), int.Parse(ID));
                    }

                    else if (Rad_Used.IsChecked == true || Rad_Demo.IsChecked == true)
                    {
                        connect.UpdateTestDrive2(Convert.ToDateTime(DTP_Date.SelectedDate.ToString()), int.Parse(txt_BookNo.Text), int.Parse(cmbx_Cust.SelectedValue.ToString()), int.Parse(cmbx_Vehicle.SelectedValue.ToString()), int.Parse(ID));
                    }
                }
            }

            catch (FormatException)
            {
                MessageBox.Show("Please enter the date the vehicle was booked");
            }
        }
        private void can_Show_MouseDown(object sender, MouseButtonEventArgs e)
        {
            connect = new CTUConnection();

            if (Department == 1)
            {
                connect.SelectInvoiceNewVehicle();
                DGV_Invoice.ItemsSource = connect.table.DefaultView;
            }

            else if (Department == 2)
            {
                connect.SelectInvoiceOldVehicle();
                DGV_Invoice.ItemsSource = connect.table.DefaultView;
            }

            else if (Department == 3)
            {
                connect.SelectInvoiceService();
                DGV_Invoice.ItemsSource = connect.table.DefaultView;
            }

            else if (Department == 4)
            {
                connect.SelectInvoiceParts();
                DGV_Invoice.ItemsSource = connect.table.DefaultView;
            }
        }
        private void can_Submit_MouseDown(object sender, MouseButtonEventArgs e)
        {
            connect = new CTUConnection();

            try
            {
                if (string.IsNullOrEmpty(txt_CustCar.Text))
                {
                    MessageBox.Show("Please enter the name of the vehicle");
                }

                else if (string.IsNullOrEmpty(txt_Prob.Text))
                {
                    MessageBox.Show("Please enter the problem of the vehicle");
                }

                else
                {
                    connect.GetCarServices(txt_CustCar.Text, Convert.ToDateTime(DTP_Date.SelectedDate.ToString()), txt_Prob.Text, int.Parse(cmbx_Mech.SelectedValue.ToString()), int.Parse(cmbx_Cust.SelectedValue.ToString()));
                }
            }

            catch (FormatException)
            {
                MessageBox.Show("Please select a date");
            }

            catch (NullReferenceException)
            {
                MessageBox.Show("Please select a Mechanic");
            }
        }
        private void can_Submit_MouseDown(object sender, MouseButtonEventArgs e)
        {
            connect = new CTUConnection();

            try
            {
                if (string.IsNullOrEmpty(txt_Manufacturer.Text))
                {
                    MessageBox.Show("Please enter the details of the part");
                }

                else if (string.IsNullOrEmpty(txt_Details.Text))
                {
                    MessageBox.Show("Please enter the name of the manufacturer");
                }

                else if (string.IsNullOrEmpty(txt_Price.Text))
                {
                    MessageBox.Show("Please enter the price of the part");
                }

                else
                {
                    connect.GetParts(txt_Details.Text, txt_Price.Text, txt_Manufacturer.Text, Data2);
                }
            }

            catch (Exception)
            {
            }
        }
 private void txt_Price_TextChanged(object sender, TextChangedEventArgs e)
 {
     connect = new CTUConnection();             // refreshens the 'CTUConnection' class //
     connect.SelectNewVehicle();                //*Selects the specified columns in the Patient table*//
     connect.SearchNewPrice(txt_Price.Text);    //Searches the customer's 'name' within the populated table//
     DGV_NewCars.ItemsSource = connect.dataset; //*All the selected fields are filtered inside the table and stored inside the grid-view*//
 }
 private void Page_Booking_Loaded(object sender, RoutedEventArgs e)
 {
     connect = new CTUConnection();
     connect.SelectCustomerBooking();
     cmbx_Cust.ItemsSource       = connect.table.DefaultView;
     cmbx_Cust.DisplayMemberPath = "[Name of the customer]";
     cmbx_Cust.SelectedValuePath = "ID";
 }
 private void Page_Employee_Loaded(object sender, RoutedEventArgs e)
 {
     connect = new CTUConnection();
     connect.SelectRole();
     cmbx_Role.ItemsSource       = connect.table.DefaultView;
     cmbx_Role.DisplayMemberPath = "RoleType";
     cmbx_Role.SelectedValuePath = "ID";
 }
Пример #13
0
 private void Window_Qoute_Loaded(object sender, RoutedEventArgs e)
 {
     connect = new CTUConnection();
     connect.Selectparts();
     cmbx_Parts.ItemsSource       = connect.table.DefaultView;
     cmbx_Parts.DisplayMemberPath = "Details";
     cmbx_Parts.SelectedValuePath = "ID";
 }
 private void Win_Login_Loaded(object sender, RoutedEventArgs e)
 {
     connect = new CTUConnection();
     connect.SelectDepartment();
     cmbx_Department.ItemsSource       = connect.table.DefaultView;
     cmbx_Department.DisplayMemberPath = "DepartmentType";
     cmbx_Department.SelectedValuePath = "ID";
 }
 private void Window_WareHouse_Loaded(object sender, RoutedEventArgs e)
 {
     connect = new CTUConnection();
     connect.SelectWareHouseVehicle();
     cmbx_Ware.ItemsSource       = connect.table.DefaultView;
     cmbx_Ware.DisplayMemberPath = "[Brand name]";
     cmbx_Ware.SelectedValuePath = "ID";
 }
Пример #16
0
        private void can_Submit_MouseDown(object sender, MouseButtonEventArgs e)
        {
            connect = new CTUConnection();

            try
            {
                if (txt_Serial.MaxLength != 13 || string.IsNullOrEmpty(txt_Serial.Text))
                {
                    MessageBox.Show("Please enter a serial number for the vehicle");
                }

                else if (string.IsNullOrEmpty(txt_Brand.Text))
                {
                    MessageBox.Show("Please enter the serial number of the vehicle");
                }

                else if (string.IsNullOrEmpty(txt_Color.Text))
                {
                    MessageBox.Show("Please enter the color of vehicle");
                }

                else if (string.IsNullOrEmpty(txt_Model.Text))
                {
                    MessageBox.Show("Please enter the model of the vehicle");
                }

                else if (string.IsNullOrEmpty(txt_Price.Text))
                {
                    MessageBox.Show("Please enter the price of the vehicle");
                }

                else if (string.IsNullOrEmpty(txt_Speed.Text))
                {
                    MessageBox.Show("Please enter the current speed of the vehicle");
                }

                else if (Rad_Good.IsChecked == false && Rad_Bad.IsChecked == false && Rad_Average.IsChecked == false)
                {
                    MessageBox.Show("Please select the condition of the vehicle");
                }

                else if (Rad_Used.IsChecked == false && Rad_Demo.IsChecked == false)
                {
                    MessageBox.Show("Please select the type of vehicle");
                }

                else
                {
                    connect.GetOldVehicles(txt_Brand.Text, txt_Model.Text, txt_Serial.Text, txt_Color.Text, Type, txt_Price.Text, txt_ServiceHis.Text, Convert.ToInt64(txt_Speed.Text), Condition);
                }
            }

            catch (FormatException)
            {
            }
        }
        private void Page_Invoice_Loaded(object sender, RoutedEventArgs e)
        {
            connect = new CTUConnection();

            try
            {
            }

            catch (Exception)
            {
            }
        }
Пример #18
0
        private void Page_UpdateService_Loaded(object sender, RoutedEventArgs e)
        {
            connect = new CTUConnection();
            connect.SelectcertainCustomerService();
            cmbx_Cust.ItemsSource       = connect.table.DefaultView;
            cmbx_Cust.DisplayMemberPath = "[Name of the customer]";
            cmbx_Cust.SelectedValuePath = "ID";

            connect.SelectcertainMechanicService();
            cmbx_Mech.ItemsSource       = connect.table2.DefaultView;
            cmbx_Mech.DisplayMemberPath = "[Name of Mechanic]";
            cmbx_Mech.SelectedValuePath = "[employ ID]";
        }
        private void can_Show_MouseLeftButtonDown(object sender, System.Windows.Input.MouseButtonEventArgs e)
        {
            try
            {
                connect = new CTUConnection();
                connect.SelectCustomer();
                DGV_Cust.ItemsSource = connect.table.DefaultView;
            }

            catch (Exception)
            {
            }
        }
Пример #20
0
        /// <summary>
        /// Display the relevent information in the rich-textbox as
        /// the parts selected changes.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void cmbx_Parts_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            connect = new CTUConnection();
            flwdoc  = new FlowDocument();
            connect.PrintQuote(int.Parse(cmbx_Parts.SelectedValue.ToString()));

            flwdoc.Blocks.Add(new Paragraph(new Run("File number: " + connect.set.Tables[0].Rows[0][0].ToString())));
            flwdoc.Blocks.Add(new Paragraph(new Run("Manufacturer: " + connect.set.Tables[0].Rows[0][3].ToString())));
            flwdoc.Blocks.Add(new Paragraph(new Run("Details: " + connect.set.Tables[0].Rows[0][1].ToString())));
            flwdoc.Blocks.Add(new Paragraph(new Run("Price: " + "R" + connect.set.Tables[0].Rows[0][2].ToString())));
            flwdoc.Blocks.Add(new Paragraph(new Run("Valid for only 3 days")));

            Rich_Quote.Document = flwdoc;
        }
        private void can_Show_MouseDown(object sender, MouseButtonEventArgs e)
        {
            connect = new CTUConnection();

            try
            {
                connect.Selectparts();
                DGV_Parts.ItemsSource = connect.table.DefaultView;
            }

            catch (Exception)
            {
            }
        }
Пример #22
0
        private void Rad_Demo_Click(object sender, RoutedEventArgs e)
        {
            Type = "Demo"; //Set the string "Type" variable Text to "Demo"//

            Rad_New.Foreground  = new SolidColorBrush(Colors.Black);
            Rad_Used.Foreground = new SolidColorBrush(Colors.Black);
            Rad_Demo.Foreground = new SolidColorBrush(Colors.Red);

            connect = new CTUConnection();
            connect.SelectDemoDrive();
            cmbx_Vehicle.ItemsSource       = connect.table2.DefaultView;
            cmbx_Vehicle.DisplayMemberPath = "[Name of vehicle]";
            cmbx_Vehicle.SelectedValuePath = "ID";
        }
        private void can_Delete_MouseDown(object sender, MouseButtonEventArgs e)
        {
            connect = new CTUConnection(); // refreshens the 'Connection' class //

            try
            {
                connect.DeleteNewVehicle(int.Parse(ID));
                connect.SelectNewVehicle();
                DGV_NewCars.ItemsSource = connect.table.DefaultView;
            }

            catch (Exception)
            {
            }
        }
        private void can_Delete_MouseDown(object sender, System.Windows.Input.MouseButtonEventArgs e)
        {
            connect = new CTUConnection(); // refreshens the 'Connection' class //

            try
            {
                connect.DeleteWareHouseVehicle(int.Parse(ID));
                connect.SelectWareHouseVehicle();
                DGV_Warehouse.ItemsSource = connect.table.DefaultView;
            }

            catch (Exception)
            {
            }
        }
        private void can_Delete_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
        {
            connect = new CTUConnection(); // refreshens the 'Connection' class //

            try
            {
                connect.DeleteCustomer(int.Parse(ID));
                connect.SelectCustomer();
                DGV_Cust.ItemsSource = connect.table.DefaultView;
            }

            catch (Exception)
            {
            }
        }
        private void txt_ServPlan_TextChanged(object sender, TextChangedEventArgs e)
        {
            connect = new CTUConnection();// refreshens the 'CTUConnection' class //
            try
            {
                if (Department == 3)
                {
                    connect.SelectInvoiceNewVehicle();            //*Selects the specified columns in the Patient table*//
                    connect.SearchInvoiceCustomer(txt_Cust.Text); //Searches the customer's 'name' within the populated table//
                    DGV_Invoice.ItemsSource = connect.dataset;    //*All the selected fields are filtered inside the table and stored inside the grid-view*//
                }
            }

            catch (Exception)
            {
            }
        }
Пример #27
0
        private void txt_Price_TextChanged(object sender, TextChangedEventArgs e)
        {
            connect = new CTUConnection();// refreshens the 'CTUConnection' class //
            if (Department == 1)
            {
                connect.SelectTestDrive();                   //*Selects the specified columns in the Patient table*//
                connect.SearchPriceBook(txt_Price.Text);     //Searches the customer's 'name' within the populated table//
                DGV_TestDrive.ItemsSource = connect.dataset; //*All the selected fields are filtered inside the table and stored inside the grid-view*//
            }

            else if (Department == 2)
            {
                connect.SelectTestDrive2();                  //*Selects the specified columns in the Patient table*//
                connect.SearchPriceBook(txt_Price.Text);     //Searches the customer's 'name' within the populated table//
                DGV_TestDrive.ItemsSource = connect.dataset; //*All the selected fields are filtered inside the table and stored inside the grid-view*//
            }
        }
        private void can_Submit_MouseDown(object sender, MouseButtonEventArgs e)
        {
            connect = new CTUConnection();

            if (string.IsNullOrEmpty(txt_Firstname.Text))
            {
                MessageBox.Show("Please enter the firstname of the employee");
            }

            else if (string.IsNullOrEmpty(txt_Surname.Text))
            {
                MessageBox.Show("Please enter the surname of the employee");
            }

            else if (string.IsNullOrEmpty(txt_IDnumber.Text) || txt_IDnumber.MaxLength != 13)
            {
                MessageBox.Show("Please enter the ID number of the employee");
            }

            else if (string.IsNullOrEmpty(txt_Username.Text))
            {
                MessageBox.Show("Please enter the username of the employee");
            }

            else if (string.IsNullOrEmpty(txt_Password.Text))
            {
                MessageBox.Show("Please enter the password of the employee");
            }

            else
            {
                try
                {
                    connect.UpdateEmployee(txt_Username.Text, txt_Password.Text, txt_Firstname.Text, txt_Surname.Text, txt_IDnumber.Text, int.Parse(cmbx_Role.SelectedValue.ToString()), int.Parse(ID));
                    connect.SelectEmployee();
                    ViewEmploy.DGV_Employee.ItemsSource = connect.table.DefaultView;
                }

                catch (Exception)
                {
                }
            }
        }
Пример #29
0
        private void can_Submit_MouseDown(object sender, System.Windows.Input.MouseButtonEventArgs e)
        {
            connect = new CTUConnection();

            try
            {
                if (txt_serial.MaxLength != 13 || string.IsNullOrEmpty(txt_serial.Text))
                {
                    MessageBox.Show("Please enter a serial number for the vehicle");
                }

                else if (string.IsNullOrEmpty(txt_Brand.Text))
                {
                    MessageBox.Show("Please enter the serial number of the vehicle");
                }

                else if (string.IsNullOrEmpty(txt_Color.Text))
                {
                    MessageBox.Show("Please enter the color of vehicle");
                }

                else if (string.IsNullOrEmpty(txt_Model.Text))
                {
                    MessageBox.Show("Please enter the model of the vehicle");
                }

                else if (string.IsNullOrEmpty(txt_Price.Text))
                {
                    MessageBox.Show("Please enter a serial number for the vehicle");
                }

                else
                {
                    connect.GetWareHouseVehicles(txt_Brand.Text, txt_Model.Text, txt_serial.Text, txt_Color.Text, txt_Price.Text, Convert.ToDateTime(DTP_Year.SelectedDate.ToString()));
                }
            }

            catch (FormatException)
            {
                MessageBox.Show("Please select the date the vehicle was manufactured");
            }
        }
Пример #30
0
        private void can_Submit_MouseDown(object sender, MouseButtonEventArgs e)
        {
            connect = new CTUConnection();

            try
            {
                if (string.IsNullOrEmpty(txt_Brand.Text))
                {
                    MessageBox.Show("Please enter the name of the motocycle");
                }

                else if (string.IsNullOrEmpty(txt_Color.Text))
                {
                    MessageBox.Show("Please enter the color of the motocycle");
                }

                else if (string.IsNullOrEmpty(txt_Model.Text))
                {
                    MessageBox.Show("Please enter the model of the motocycle");
                }

                else if (string.IsNullOrEmpty(txt_Price.Text))
                {
                    MessageBox.Show("Please enter the price of the motocycle");
                }

                else
                {
                    connect.UpdateMoto(txt_Brand.Text, txt_Model.Text, txt_Color.Text, txt_Price.Text, Convert.ToDateTime(DTP_Date.SelectedDate.ToString()), data2, int.Parse(ID));
                }
            }

            catch (FormatException)
            {
                MessageBox.Show("Please select a date");
            }

            catch (Exception)
            {
            }
        }