Пример #1
0
        private List <JobModel> ExtractJobs(string data)
        {
            List <JobModel> jobList = new List <JobModel>();

            string[] protocol = data.Split('|');

            if (protocol[0] == "JobList")
            {
                for (int i = 1; i < protocol.Count(); i++)
                {
                    JobModel job       = new JobModel();
                    string[] jobString = protocol[i].Split(new string[] { "[[JobModel]]" }, StringSplitOptions.None);

                    job.SetCarID(Int32.Parse(jobString[0]));
                    job.SetStartDate(jobString[1]);
                    job.SetEndDate(jobString[2]);
                    job.SetProblem(jobString[3]);
                    job.SetSolution(jobString[4]);
                    job.SetMilage(Int32.Parse(jobString[5]));
                    job.SetCost(float.Parse(jobString[6]));
                    job.SetRevenue(float.Parse(jobString[7]));

                    jobList.Add(job);
                }
            }

            return(jobList);
        }
Пример #2
0
        private void ButtonSave_Click(object sender, EventArgs e)
        {
            jobNew.SetCarID(carID);
            jobNew.SetStartDate(DateTimeStart.Text);
            jobNew.SetEndDate(DateTimeEnd.Text);
            jobNew.SetProblem(TextBoxProblem.Text);
            jobNew.SetSolution(TextBoxSolution.Text);
            if (TextBoxMilage.Text != "")
            {
                jobNew.SetMilage(Int32.Parse(TextBoxMilage.Text));
            }
            if (TextBoxCost.Text != "")
            {
                jobNew.SetCost(float.Parse(TextBoxCost.Text));
            }
            if (TextBoxRevenue.Text != "")
            {
                jobNew.SetRevenue(float.Parse(TextBoxRevenue.Text));
            }

            if (jobOld == null)
            {
                jobsController.CreateJob(jobNew);
            }
            else
            {
                jobsController.EditJob(jobNew, jobOld);
            }

            Close();
        }
Пример #3
0
        public void Create(string jobString)
        {
            JobModel job = new JobModel();

            string[] jobDetails = jobString.Split(new string[] { "[[JobModel]]" }, StringSplitOptions.None);

            job.SetCarID(Int32.Parse(jobDetails[0]));
            job.SetStartDate(jobDetails[1]);
            job.SetEndDate(jobDetails[2]);
            job.SetProblem(jobDetails[3]);
            job.SetSolution(jobDetails[4]);
            job.SetMilage(Int32.Parse(jobDetails[5]));
            job.SetCost(float.Parse(jobDetails[6]));
            job.SetRevenue(float.Parse(jobDetails[7]));

            jobs.Add(job);
        }
Пример #4
0
        public void Edit(string jobStringNew, string jobStringOld)
        {
            JobModel job = new JobModel();

            string[] jobDetails = jobStringNew.Split(new string[] { "[[JobModel]]" }, StringSplitOptions.None);

            job.SetCarID(Int32.Parse(jobDetails[0]));
            job.SetStartDate(jobDetails[1]);
            job.SetEndDate(jobDetails[2]);
            job.SetProblem(jobDetails[3]);
            job.SetSolution(jobDetails[4]);
            job.SetMilage(Int32.Parse(jobDetails[5]));
            job.SetCost(float.Parse(jobDetails[6]));
            job.SetRevenue(float.Parse(jobDetails[7]));

            for (int i = 0; i < jobs.Count; i++)
            {
                if (jobs[i].ToString() == jobStringOld)
                {
                    jobs[i] = job;
                }
            }
        }