コード例 #1
0
 private void postCarServiceToDB(string carserviceid, string bookdate, string custid, string carrego, string serviceid, string desc, string storeid)
 {
     if (Car.isCarSoldByToyota(carrego))
     {
         MessageBox.Show("Your car is not sold by our store!");
     }
     else if (Customer.IsCustomerRegistered(custid))
     {
         MessageBox.Show("You customer ID is not eixst! Please register a new customer ID");
     }
     else
     {
         CarService.NewCarRepairService(carserviceid, bookdate, custid, carrego, serviceid, desc, storeid);
     }
 }
コード例 #2
0
        private void buttonClose_Click(object sender, EventArgs e)
        {
            int    row       = dataGridView_W_Jobs.CurrentRow.Index;
            string jobid     = dataGridView_W_Jobs.Rows[row].Cells["cars_serviceid"].Value.ToString();
            string jobstatus = dataGridView_W_Jobs.Rows[row].Cells["cars_servicesstatus"].Value.ToString();

            if (jobstatus == "closed")
            {
                MessageBox.Show("The job " + jobid + " is already closed, please select an open one.");
            }
            else
            {
                CarService.CloseJob(jobid);
                MessageBox.Show("The job " + jobid + " has been succesfully closed!");
            }
        }
コード例 #3
0
        private void buttonShowMyJobs_Click(object sender, EventArgs e)
        {
            string csstatus = "";
            string workerid = textBoxUserid.Text;

            if (checkBoxMyOpen.Checked && !checkBoxMyClose.Checked)
            {
                csstatus = "open";
            }
            else if (!checkBoxMyOpen.Checked && checkBoxMyClose.Checked)
            {
                csstatus = "closed";
            }
            else if (checkBoxMyOpen.Checked && checkBoxMyClose.Checked)
            {
                csstatus = "";
            }

            dataGridView_W_Jobs.DataSource = CarService.GetJobsOfAWorker(workerid, csstatus);
        }
コード例 #4
0
        private void buttonShowJobs_Click(object sender, EventArgs e)
        {
            OpenDB();
            string csstatus = "";
            string workerid = textBox_M_WorkerID.Text.Length == 0 ? "" : textBox_M_WorkerID.Text;

            if (checkBoxAllOpen.Checked && !checkBoxAllClose.Checked)
            {
                csstatus = "open";
            }
            else if (!checkBoxAllOpen.Checked && checkBoxAllClose.Checked)
            {
                csstatus = "closed";
            }
            else if (checkBoxAllOpen.Checked && checkBoxAllClose.Checked)
            {
                csstatus = "";
            }

            if (workerid == "")
            {
                dataGridViewOpen.DataSource = CarService.GetAllJobs();
            }
            else
            {
                dataGridViewOpen.DataSource = CarService.GetJobsOfAWorker("", csstatus);
            }
            //string selectqry = "select * from cars_services where cars_servicesstatus like '%" +
            //    csstatus + "%' and cars_servicesworkerid like '%" + workerid + "%' order by cars_servicespriority";
            //SQLiteCommand cmd = new SQLiteCommand(selectqry, m_dbConnection);

            //SQLiteDataAdapter sql_data_adap = new SQLiteDataAdapter();
            //sql_data_adap.SelectCommand = cmd;
            //DataTable ManagerTable = new DataTable();
            //ManagerTable.Locale = System.Globalization.CultureInfo.InvariantCulture;
            //sql_data_adap.Fill(ManagerTable);
            //dataGridViewOpen.DataSource = ManagerTable;
            //m_dbConnection.Close();
        }
コード例 #5
0
 private void buttonShowAllJobs_Click(object sender, EventArgs e)
 {
     recordClass   = "cars_services";
     adminClick_id = "cars_serviceid";
     dataGridViewAdmin.DataSource = CarService.GetAllJobs();
 }
コード例 #6
0
 private void buttonShowCar_Click(object sender, EventArgs e)
 {
     dataGridViewShowCar.DataSource = CarService.GetJobsOfACar(textBox_H_CarGego.Text);
 }
コード例 #7
0
 private void buttonShowWorker_Click(object sender, EventArgs e)
 {
     dataGridViewShowWorkers.DataSource = CarService.GetWorkerJobsOfManager(textBoxUserid.Text);
 }
コード例 #8
0
        private void buttonBookJob_Click(object sender, EventArgs e)
        {
            if (textBox_CustomerID.Text.Length == 0 || textBox_BookingDate.Text.Length == 0 || textBox_CarRego.Text.Length == 0)
            {
                MessageBox.Show("Please fill out the required information!");
            }
            else if (!checkBoxPanel.Checked && !checkBoxElectrical.Checked && !checkBoxMechanical.Checked)
            {
                MessageBox.Show("Please selecet at least one service!");
            }
            else if (!radioButton_nz1.Checked && !radioButton_nz2.Checked && !radioButton_nz3.Checked && !radioButton_nz4.Checked)
            {
                MessageBox.Show("Please selecet a store outlet!");
            }
            else if (checkBoxNew.Checked)
            {
                Customer cust = new Customer(textBox_CustomerID.Text, textBoxName.Text, textBoxPhone.Text, textBoxAddress.Text);
                currentStore.CustList = new List <Customer>();
                currentStore.AddCust(cust);
                postCustomerToDB(textBox_CustomerID.Text, textBoxName.Text, textBoxPhone.Text, textBoxAddress.Text);
                List <string> serviceids = new List <string>();
                // default storeid nz1
                string storeid = "nz1";

                if (checkBoxPanel.Checked)
                {
                    serviceids.Add("sid1");
                }
                if (checkBoxElectrical.Checked)
                {
                    serviceids.Add("sid2");
                }
                if (checkBoxMechanical.Checked)
                {
                    serviceids.Add("sid3");
                }


                if (radioButton_nz1.Checked)
                {
                    storeid = "nz1";
                }
                else if (radioButton_nz2.Checked)
                {
                    storeid = "nz2";
                }
                else if (radioButton_nz3.Checked)
                {
                    storeid = "nz3";
                }
                else if (radioButton_nz4.Checked)
                {
                    storeid = "nz4";
                }

                for (int i = 0; i < serviceids.Count; i++)
                {
                    CarService cs = new CarService(textBox_BookingDate.Text);
                    currentStore.CarServiceList = new List <CarService>();
                    currentStore.AddCarService(cs);
                    postCarServiceToDB(cs.CarServiceID.ToString(), textBox_BookingDate.Text, textBox_CustomerID.Text, textBox_CarRego.Text, serviceids[i], textBox_Description.Text, storeid);
                }
            }
            else if (!checkBoxNew.Checked)
            {
                List <string> serviceids = new List <string>();
                // default storeid nz1
                string storeid = "nz1";

                if (checkBoxPanel.Checked)
                {
                    serviceids.Add("sid1");
                }
                if (checkBoxElectrical.Checked)
                {
                    serviceids.Add("sid2");
                }
                if (checkBoxMechanical.Checked)
                {
                    serviceids.Add("sid3");
                }


                if (radioButton_nz1.Checked)
                {
                    storeid = "nz1";
                }
                else if (radioButton_nz2.Checked)
                {
                    storeid = "nz2";
                }
                else if (radioButton_nz3.Checked)
                {
                    storeid = "nz3";
                }
                else if (radioButton_nz4.Checked)
                {
                    storeid = "nz4";
                }
                for (int i = 0; i < serviceids.Count; i++)
                {
                    CarService cs = new CarService(textBox_BookingDate.Text);
                    currentStore.CarServiceList = new List <CarService>();
                    currentStore.AddCarService(cs);
                    postCarServiceToDB(cs.CarServiceID.ToString(), textBox_BookingDate.Text, textBox_CustomerID.Text, textBox_CarRego.Text, serviceids[i], textBox_Description.Text, storeid);
                }
            }
        }
コード例 #9
0
 private void postWorkJobToDB(string workerid, string jobid)
 {
     // CarService ?
     CarService.AssignWorkerToRepairJob(workerid, jobid);
     MessageBox.Show("The job has been assigned to: " + workerid);
 }