protected void Clear1_Click(object sender, EventArgs e)
 {
     MessageUserControl.TryRun(() =>
     {
         NewJobPanel.Enabled    = false;
         NewJobPanel.Visible    = false;
         CurrentJobList.Enabled = true;
         CurrentJobList.Visible = true;
         ShowAllJobs.DataBind();
     }, "Success", "Data found");
 }
        protected void GoBack_Click1(object sender, EventArgs e)
        {
            MessageUserControl.TryRun(() =>
            {
                ViewServiceDetail.Enabled = false;
                ViewServiceDetail.Visible = false;

                ViewServicePanel.Enabled = false;
                ViewServicePanel.Visible = false;
                CurrentJobList.Enabled   = true;
                CurrentJobList.Visible   = true;
                ShowAllJobs.DataBind();
            }, "Success", "Data found");
        }
        protected void AddNewJob_Click(object sender, EventArgs e)
        {
            MessageUserControl.TryRun(() =>
            {
                int customerID = int.Parse(ListAllCustomers.SelectedValue);
                POCOJob newjob = new POCOJob();

                if (customerID != 0)
                {
                    newjob.CustomerID = customerID;
                }
                else
                {
                    throw new Exception("Please select a customer");
                }

                try
                {
                    newjob.ShopRate = decimal.Parse(ShopRate.Text);
                }
                catch
                {
                    MessageUserControl.Visible = true;
                    throw new Exception("Shop Rate is required");
                }
                if (newjob.ShopRate <= 0)
                {
                    throw new Exception("Shop Rate must be a positive whole number.");
                }
                if (string.IsNullOrWhiteSpace(VehicleID.Text))
                {
                    throw new Exception("VehicleIdentification is required");
                }
                newjob.VehicleIdentification = VehicleID.Text;

                //First Service Detail
                int index            = int.Parse(DropDownListAddJob.SelectedValue);
                POCOServiceDetail SD = new POCOServiceDetail();
                if (string.IsNullOrWhiteSpace(DescriptionAddJob.Text))
                {
                    throw new Exception("Description is required");
                }
                try
                {
                    SD.JobHours = decimal.Parse(HoursAddJob.Text);
                }
                catch
                {
                    throw new Exception("Hours is required");
                }
                if (SD.JobHours <= 0)
                {
                    throw new Exception("Hours must be a positive whole number.");
                }

                SD.Description = DescriptionAddJob.Text;

                if (index != 0)
                {
                    SD.CouponID = index;
                }
                if (!string.IsNullOrWhiteSpace(CommentAddJob.Text))
                {
                    SD.Comments = CommentAddJob.Text;
                }

                var controller = new JobingController();
                int employeeID = controller.getEmployeeID(User.Identity.Name);
                controller.AddNewJob(newjob, employeeID, SD);
                MessageUserControl.Visible = true;
                ShowAllJobs.DataBind();
                ListAllCustomers.SelectedIndex = 0;
                ShopRate.Text  = "80";
                VehicleID.Text = null;
                DropDownListAddJob.SelectedIndex = 0;
                DescriptionAddJob.Text           = null;
                HoursAddJob.Text   = null;
                CommentAddJob.Text = null;
            }, "Success", "New job added succesfully");
        }