Exemplo n.º 1
0
        private void addNewService()
        {
            try
            {
                Service sv = new Service();
                sv.VehicleCode     = sc.getVehicleCode(tbxVehicleNumber.Text);
                sv.ServiceDate     = serviceDate.Value;
                sv.OdoMeter        = tbxOdoMeter.Text;
                sv.NextServiceDate = nextServiceDate.Value;

                if (sc.addService(sv))
                {
                    MyDialog.Show("Success...!", "New Service Registered");
                    addProvidedServices();
                    resetFields();
                }
                else
                {
                    MyDialog.Show("Error...!", "New Service Not Registered");
                }
            }
            catch (Exception e)
            {
                MessageBox.Show(e.Message);
            }
        }
Exemplo n.º 2
0
        private void btnUpdate_Click(object sender, EventArgs e)
        {
            String s_code = tbxServiceCode.Text;

            if (Validator.IsValidPrimaryCode(s_code, "S"))
            {
                String v_code            = sc.getVehicleCode(tbxVehicleNo.Text);
                String service_date      = serviceDate.Value.ToString(DATE_FORMAT);
                String odo_meter         = tbxOdoMeter.Text;
                String next_service_date = nextServiceDate.Value.ToString(DATE_FORMAT);
                if (Validator.IsValidPastDate(serviceDate.Value.ToString(DATE_FORMAT)))
                {
                    //if (Validator.IsValidFutureDate(nextServiceDate.Value.ToString(DATE_FORMAT)))
                    //{
                    if (Validator.IsValidNumber(tbxOdoMeter.Text))
                    {
                        List <int> checkedList = getCheckedList();

                        Service sv = new Service();
                        sv.VehicleCode     = v_code;
                        sv.ServiceDate     = serviceDate.Value;
                        sv.OdoMeter        = odo_meter;
                        sv.NextServiceDate = nextServiceDate.Value;

                        sc.updateBasicServiceDetails(sv);
                        sc.removeAndUpdateProvidedServices(s_code, checkedList);

                        MyDialog.Show("Success...!", "Service Updated");
                        resetFields();
                    }
                    else
                    {
                        MyDialog.Show("Error...!", "ODO Meter is invalid");
                    }
                    //}
                    //else
                    // MyDialog.Show("Error...!", "Next Service Date is invalid");
                }
                else
                {
                    MyDialog.Show("Error...!", "Service Date is invalid");
                }
            }
            else
            {
                MyDialog.Show("Error...!", "Invalid Service Code");
            }
        }