public IActionResult GenerateTimesheet(JobDetailsModel model)
        {
            if (!ModelState.IsValid)
            {
                return(View("Index", model));
            }

            var timeSheetModel = new TimeSheetModel()
            {
                Client = model.Client, FullName = model.FirstName + " " + model.LastName, JobTitle = model.JobTitle
            };

            ITimeSheetGenerator timeSheetGenerator;

            if (model.TimeSheetFrequency == "Weekly")
            {
                timeSheetGenerator = new WeeklyTimesheetGenerator();
            }
            else
            {
                timeSheetGenerator = new MonthlyTimesheetGenerator();
            }

            timeSheetModel.TimeSheets = timeSheetGenerator.Generate(model.StartDate, model.EndDate);

            return(View("TimeSheetView", timeSheetModel));
        }
Example #2
0
 private static void CacheJobDetails(JobDetailsModel Details)
 {
     try
     {
         var jsonContent   = JsonConvert.SerializeObject(Details);
         var cacheFilename = CacheFileName(Details.OnlineWarrantyId, Details.DeviceSerialNumber);
         File.WriteAllText(cacheFilename, jsonContent);
     }
     catch (Exception) { } // Ignore Cache Writing Errors
 }
Example #3
0
        public IActionResult Put(int id, [FromBody] JobDetailsModel updatedJobDetails)
        {
            var jobDetails = _jobDetailsService.Update(updatedJobDetails.ToDomainModel());

            if (jobDetails == null)
            {
                return(NotFound());
            }
            return(Ok(jobDetails.ToApiModel()));
        }
Example #4
0
        public ActionResult General(string dbServer, Guid jobID)
        {
            JobDetailsModel generalModel = new JobDetailsModel();
            JobDetails      jobDetails   = new JobDetails();

            generalModel = jobDetails.getGeneral(dbServer, jobID);

            ViewBag.ServerName = dbServer;
            ViewBag.JobID      = jobID;
            return(View(generalModel));
        }
Example #5
0
 public IActionResult Post([FromBody] JobDetailsModel jobDetails)
 {
     try
     {
         _jobDetailsService.Add(jobDetails.ToDomainModel());
     }
     catch (System.Exception ex)
     {
         ModelState.AddModelError("AddJobDetails", ex.GetBaseException().Message);
         return(BadRequest(ModelState));
     }
     return(CreatedAtAction("Get", new { Id = jobDetails.Id }, jobDetails));
 }
Example #6
0
        public ActionResult StartJob(JobDetailsModel step)
        {
            ConnectSqlServer connection = new ConnectSqlServer();
            Server           server     = connection.Connect(step.ServerName);

            server.JobServer.GetJobByID(step.JobID).Start(step.StepName);
            server.ConnectionContext.Disconnect();

            LogActivity log = new LogActivity();

            log.Add(User.Identity.Name, step.ServerName, step.JobID, "Start Job");

            return(RedirectToAction("Index", "Schedule", new { dbServer = step.ServerName }));
        }
Example #7
0
        public JsonResult EditJobDetails(JobDetailsModel jp)
        {
            var res = "";

            try
            {
                string jsr = mps.EditJobDetails(jp);
                return(Json((new JavaScriptSerializer()).DeserializeObject(jsr), JsonRequestBehavior.AllowGet));
            }
            catch (Exception ex)
            {
                res = ex.Message.ToString();
                return(Json(res, JsonRequestBehavior.AllowGet));
            }
        }
        private JobDetailsModel GetJobDetails(int jobid)
        {
            IGetJobListingRequest jobListingRequest = new JXTNext_GetJobListingRequest {
                JobID = jobid
            };
            IGetJobListingResponse jobListingResponse = _blConnector.GuestGetJob(jobListingRequest);

            ViewBag.JobTitle = jobListingResponse.Job.Title;
            JobDetailsModel jobDetails = new JobDetailsModel();

            jobDetails.ApplicationEmail = jobListingResponse.Job.CustomData["ApplicationMethod.ApplicationEmail"];
            jobDetails.ContactDetails   = jobListingResponse.Job.CustomData["ContactDetails"];
            jobDetails.CompanyName      = jobListingResponse.Job.CustomData["CompanyName"];
            jobDetails.JobLocation      = jobListingResponse.Job.CustomData["CountryLocationArea[0].Filters[0].Value"];
            jobDetails.JobSEOUrl        = jobListingResponse.Job?.ClassificationURL;
            return(jobDetails);
        }
Example #9
0
        public void saveGeneral(JobDetailsModel job)
        {
            ConnectSqlServer connection = new ConnectSqlServer();
            Server           dbServer   = connection.Connect(job.ServerName);

            Job jobToUpdate = dbServer.JobServer.GetJobByID(job.JobID);

            if (jobToUpdate.Name != job.JobName)
            {
                jobToUpdate.Rename(job.JobName);
            }
            jobToUpdate.OwnerLoginName = job.Owner;
            jobToUpdate.Description    = job.Description;
            jobToUpdate.IsEnabled      = job.Enabled;
            jobToUpdate.StartStepID    = job.StartStepID;
            jobToUpdate.Alter();
        }
Example #10
0
 public ActionResult PostJobs(JobDetailsModel model)
 {
     if (User.Identity.IsAuthenticated)
     {
         if (model != null)
         {
             model.username = User.Identity.Name;
             var res = JobsProvider.PostJob(model);
             if (res)
             {
                 TempData["Success"] = "Successfully Posted a Job!";
                 return(Json(new { success = true, message = "Successfully Posted a Job!" }, JsonRequestBehavior.DenyGet));
             }
         }
     }
     TempData["Error"] = "Failed! Please try again";
     return(Json(new { success = true, message = "Failed! Please try again" }, JsonRequestBehavior.DenyGet));
 }
Example #11
0
        public string GetJobDetailsbyID(JobDetailsModel jp)
        {
            var res = "";

            try
            {
                string inputJson = (new JavaScriptSerializer()).Serialize(jp);
                string jsr       = GetjsonInfo("/JobDeatils/GetJobDetailsByJobID", inputJson);

                return(jsr);
            }
            catch (Exception ex)
            {
                ErrorWriter.WriteLog(ex.GetType().ToString(), ex.GetType().Name.ToString(), ex.InnerException.ToString(), "GetJobDetailsbyID", "MainRepository");
                res = ex.Message.ToString();
                return(res);
            }
        }
Example #12
0
        public bool ApplyCvToJob(JobDetailsModel model, string id)
        {
            var jobApplication = Mapper.Map <JobApplication>(model);
            var job            = this.db.Jobs.Find(j => j.Id == id.ToObjectId()).SingleOrDefault();

            if (job != null)
            {
                bool applicationExists = job.Applications.Select(a => a.AppliedCvId).Contains(model.AppliedCvId.ToObjectId());
                if (!applicationExists)
                {
                    var updateResult = this.db.Jobs.UpdateOne(
                        Builders <Job> .Filter.Eq("_id", id.ToObjectId()),
                        Builders <Job> .Update.AddToSet(nameof(Job.Applications), jobApplication));

                    return(true);
                }
            }
            return(false);
        }
Example #13
0
        public ActionResult General(JobDetailsModel jobDetail)
        {
            if (ModelState.IsValid)
            {
                JobDetails jobDetails = new JobDetails();
                jobDetails.saveGeneral(jobDetail);
                TempData["message"] = "Job successfuly updated";

                LogActivity log = new LogActivity();
                log.Add(User.Identity.Name, jobDetail.ServerName, jobDetail.JobID, "Edit Job");

                return(RedirectToAction("General", "Edit", new { dbServer = jobDetail.ServerName, jobID = jobDetail.JobID }));
            }
            else
            {
                ViewBag.ServerName = jobDetail.ServerName;
                ViewBag.JobID      = jobDetail.JobID;
                return(View(jobDetail));
            }
        }
Example #14
0
        public ActionResult StartJob(string dbServer, Guid jobID)
        {
            JobDetailsModel       model      = new JobDetailsModel();
            PopulateDropDowns     dropdown   = new PopulateDropDowns();
            ConnectSqlServer      connection = new ConnectSqlServer();
            Server                server     = connection.Connect(dbServer);
            List <SelectListItem> stepList   = new List <SelectListItem>();

            stepList         = dropdown.getSteps(dbServer, jobID);
            ViewBag.StepList = stepList;

            var job = server.JobServer.GetJobByID(jobID);

            model.JobName    = job.Name;
            model.ServerName = dbServer;
            model.JobID      = jobID;
            model.StepName   = job.JobSteps[0].Name;

            return(View(model));
        }
Example #15
0
        public static bool PostJob(JobDetailsModel model)
        {
            var post = JobsContext.PostJob(new JobDetail()
            {
                job_details_id   = model.Job_details_id,
                job_organization = model.Job_organization,
                job_img          = "",
                employee_id      = RegistrationProvider.GetUseridfromUsername(model.username),
                job_date         = model.Job_date,
                job_applied_date = DateTime.Now,
                job_description  = model.Job_description,
                job_title        = model.Job_title,
                jo_date_modified = DateTime.Now,
                job_city         = model.Job_city,
                job_type         = model.Job_type
            });

            if (post > 0)
            {
                return(true);
            }
            return(false);
        }
Example #16
0
        public JobDetailsModel getGeneral(string ServerName, Guid JobID)
        {
            JobDetailsModel jobDetails = new JobDetailsModel();

            ConnectSqlServer connection = new ConnectSqlServer();
            Server           dbServer   = connection.Connect(ServerName);

            var job = dbServer.JobServer.GetJobByID(JobID);

            jobDetails.JobID        = JobID;
            jobDetails.JobName      = job.Name;
            jobDetails.Enabled      = job.IsEnabled;
            jobDetails.Description  = job.Description;
            jobDetails.Owner        = job.OwnerLoginName;
            jobDetails.Created      = job.DateCreated;
            jobDetails.LastExecuted = job.LastRunDate;
            jobDetails.LastModified = job.DateLastModified;
            jobDetails.ServerName   = ServerName;
            jobDetails.StartStepID  = job.StartStepID;
            jobDetails.StepCount    = job.JobSteps.Count;


            return(jobDetails);
        }
        public IActionResult Details(JobDetailsModel form, string id)
        {
            if (!ModelState.IsValid || form.AppliedCvId == null)
            {
                TempData.AddErrorMessage("Please select a CV before applying");
                var jobDetails = this.can.GetJobDetails(id);
                jobDetails.MotivationalLetter = form.MotivationalLetter;
                jobDetails.AppliedCvId        = form.AppliedCvId;
                return(View(jobDetails));
            }

            var success = this.can.ApplyCvToJob(form, id);

            if (!success)
            {
                TempData.AddErrorMessage("You have already applied for this job with this CV");
                return(this.RedirectToAction <JobsController>(nameof(JobsController.Details), id));
            }
            else
            {
                TempData.AddSuccessMessage("You have successfully applied");
                return(this.RedirectToAction <JobsController>(nameof(JobsController.All)));
            }
        }
        private CreateJobApplicationResponse CreateJobApplication(
            SocialMediaProcessedResponse result,
            JobDetailsModel jobDetails,
            ApplicantInfo applicantInfo,
            string overrideEmail)
        {
            // Gather Attachments
            Guid identifier = Guid.NewGuid();
            JobApplicationAttachmentUploadItem uploadItem = new JobApplicationAttachmentUploadItem()
            {
                Id               = identifier.ToString(),
                AttachmentType   = JobApplicationAttachmentType.Resume,
                FileName         = result.FileName,
                FileStream       = result.FileStream,
                PathToAttachment = identifier.ToString() + "_" + result.FileName,
                Status           = "Ready"
            };



            // End code for fetch job details
            Log.Write("overrideEmail uploadItem object created", ConfigurationPolicy.ErrorLog);
            List <JobApplicationAttachmentUploadItem> attachments = new List <JobApplicationAttachmentUploadItem>();

            attachments.Add(uploadItem);
            Log.Write("overrideEmail uploadItem attachment added", ConfigurationPolicy.ErrorLog);
            string resumeAttachmentPath = JobApplicationAttachmentUploadItem.GetAttachmentPath(attachments, JobApplicationAttachmentType.Resume);

            Log.Write("After resume GetAttachmentPath", ConfigurationPolicy.ErrorLog);
            string coverletterAttachmentPath = JobApplicationAttachmentUploadItem.GetAttachmentPath(attachments, JobApplicationAttachmentType.Coverletter);

            Log.Write("After cover letter GetAttachmentPath", ConfigurationPolicy.ErrorLog);

            string htmlEmailContent           = this.GetEmailHtmlContent(this.EmailTemplateId);
            string htmlEmailSubject           = this.GetEmailSubject(this.EmailTemplateId);
            string htmlAdvertiserEmailContent = this.GetEmailHtmlContent(this.AdvertiserEmailTemplateId);
            string htmlAdvertiserEmailSubject = this.GetEmailSubject(this.AdvertiserEmailTemplateId);

            Log.Write("After GetHtmlEmailContent", ConfigurationPolicy.ErrorLog);
            // Email notification settings


            List <dynamic> emailAttachments = new List <dynamic>();

            foreach (var item in attachments)
            {
                dynamic emailAttachment = new ExpandoObject();
                emailAttachment.FileStream = item.FileStream;
                emailAttachment.FileName   = item.FileName;
                emailAttachments.Add(emailAttachment);
            }

            EmailNotificationSettings advertiserEmailNotificationSettings = (this.AdvertiserEmailTemplateId != null) ?
                                                                            _createAdvertiserEmailTemplate(
                new JobApplicationEmailTemplateModel()
            {
                FromFirstName = result.FirstName,
                FromLastName  = result.LastName,
                FromEmail     = overrideEmail,
                ToFirstName   = jobDetails.ContactDetails.GetFirstName(),
                ToLastName    = jobDetails.ContactDetails.GetLastName(),
                ToEmail       = jobDetails.ApplicationEmail,
                Subject       = SitefinityHelper.GetCurrentSiteEmailTemplateTitle(this.AdvertiserEmailTemplateId),
                HtmlContent   = SitefinityHelper.GetCurrentSiteEmailTemplateHtmlContent(this.AdvertiserEmailTemplateId),
                Attachments   = emailAttachments
            }) : null;



            EmailNotificationSettings emailNotificationSettings = (this.EmailTemplateId != null) ?
                                                                  _createApplicantEmailTemplate(
                new JobApplicationEmailTemplateModel()
            {
                FromFirstName = this.EmailTemplateSenderName,
                FromLastName  = null,
                FromEmail     = this.EmailTemplateSenderEmailAddress,
                ToFirstName   = SitefinityHelper.GetUserFirstNameById(SitefinityHelper.GetUserByEmail(overrideEmail).Id),
                ToLastName    = null,
                ToEmail       = overrideEmail,
                Subject       = SitefinityHelper.GetCurrentSiteEmailTemplateTitle(this.EmailTemplateId),
                HtmlContent   = SitefinityHelper.GetCurrentSiteEmailTemplateHtmlContent(this.EmailTemplateId),
                Attachments   = null
            }) : null;


            EmailNotificationSettings registrationNotificationsSettings = (applicantInfo.IsNewUser && this.RegistrationEmailTemplateId != null) ?
                                                                          _createRegistrationEmailTemplate(
                new JobApplicationEmailTemplateModel()
            {
                FromFirstName = this.EmailTemplateSenderName,
                FromLastName  = null,
                FromEmail     = this.EmailTemplateSenderEmailAddress,
                ToFirstName   = applicantInfo.FirstName,
                ToLastName    = null,
                ToEmail       = applicantInfo.Email,
                Subject       = SitefinityHelper.GetCurrentSiteEmailTemplateTitle(this.RegistrationEmailTemplateId),
                HtmlContent   = SitefinityHelper.GetCurrentSiteEmailTemplateHtmlContent(this.RegistrationEmailTemplateId),
                Attachments   = null
            }) : null;


            Log.Write("emailNotificationSettings after: ", ConfigurationPolicy.ErrorLog);

            Log.Write("BL response before: ", ConfigurationPolicy.ErrorLog);

            //Create Application
            var response = _blConnector.MemberCreateJobApplication(
                new JXTNext_MemberApplicationRequest
            {
                ApplyResourceID               = result.JobId.Value,
                MemberID                      = 2,
                ResumePath                    = resumeAttachmentPath,
                CoverletterPath               = coverletterAttachmentPath,
                EmailNotification             = emailNotificationSettings,
                AdvertiserEmailNotification   = advertiserEmailNotificationSettings,
                AdvertiserName                = jobDetails.ContactDetails,
                CompanyName                   = jobDetails.CompanyName,
                UrlReferral                   = result.UrlReferral,
                RegistrationEmailNotification = registrationNotificationsSettings
            },
                overrideEmail);

            Log.Write("BL response after: ", ConfigurationPolicy.ErrorLog);

            var createJobApplicationResponse = new CreateJobApplicationResponse {
                MemberApplicationResponse = response
            };

            if (response.Success && response.ApplicationID.HasValue)
            {
                Log.Write("BL response in: ", ConfigurationPolicy.ErrorLog);
                var hasFailedUpload = _jobApplicationService.UploadFiles(attachments);
                Log.Write("file upload is : " + hasFailedUpload, ConfigurationPolicy.ErrorLog);
                if (hasFailedUpload)
                {
                    createJobApplicationResponse.FilesUploaded = false;
                    createJobApplicationResponse.Status        = JobApplicationStatus.Technical_Issue; // Unable to attach files
                    createJobApplicationResponse.Message       = "Unable to attach files to application";
                }
                else
                {
                    createJobApplicationResponse.FilesUploaded = true;
                    createJobApplicationResponse.Status        = JobApplicationStatus.Applied_Successful;
                    createJobApplicationResponse.Message       = "Your application was successfully processed.";
                }
            }
            else
            {
                if (response.Errors.FirstOrDefault().ToLower().Contains("already exists"))
                {
                    createJobApplicationResponse.Status  = JobApplicationStatus.Already_Applied;
                    createJobApplicationResponse.Message = "You have already applied to this job.";
                }
                else
                {
                    createJobApplicationResponse.Status  = JobApplicationStatus.Technical_Issue;
                    createJobApplicationResponse.Message = response.Errors.FirstOrDefault();
                }
            }

            return(createJobApplicationResponse);
        }
Example #19
0
        /// <summary>
        /// Get job details
        /// </summary>
        /// <returns></returns>
        public JobDetailsModel JobDetails(int serviceId)
        {
            //_sessionModel = _session.Load(_sessionModel);
            Log.File.Info(Msg.GenerateLogMsg("Getting job details...", "Service Id = " + serviceId));

            // Get details
            var jobDetailsDto    = Repository.GetJobDetails(serviceId, UserId);
            var JobStatusHistory = Repository.GetJobStatusHistory(serviceId);

            // initialization of result modle
            var result = new JobDetailsModel();

            result.InjectFrom(jobDetailsDto);
            result.JobStatusHistory = JobStatusHistory;
            //uploaded file
            result.UploadedFile.InjectFrom(jobDetailsDto);

            // Customer information
            result.CustomerInformation.InjectFrom(jobDetailsDto);
            result.CustomerInformation.CountryList = CustomerService.GetCountryList(result.CustomerInformation.Country);
            result.JobFaultInfo.InjectFrom(jobDetailsDto);
            // Contact information
            result.ContactInformation.InjectFrom(jobDetailsDto);

            // Product information
            result.ProductInformation.InjectFrom(jobDetailsDto);
            result.ProductInformation.WarrantyList         = GetWarrantyList(jobDetailsDto.GuaranteeType);
            result.ProductInformation.DateOfPurchaseString =
                Functions.DateTimeToString(result.ProductInformation.DateOfPurchase);
            result.ProductInformation.RetailedInvoiceDateStrig =
                Functions.DateTimeToString(result.ProductInformation.RetailedInvoiceDate);
            // result.ProductInformation.ApplianceType = jobDetailsDto.ApplianceType
            // Repair information
            result.RepairInformation.InjectFrom(jobDetailsDto);
            //result.RepairInformation.RepairCost = jobDetailsDto.RepairCost;
            //result.RepairInformation.RepairType = jobDetailsDto.SelectedType;
            //result.RepairInformation.JobTypesList = GetJobTypesList(jobDetailsDto.SelectedType);
            //result.RepairInformation.CustomerTypeList = GetCustomerTypeList(jobDetailsDto.CustomerType.ToString());
            //result.RepairInformation.RepairCostPaidList = RepairCostPaidList(result.RepairInformation.RepairCostPaid);

            // Jos statuses
            result.Status.InjectFrom(jobDetailsDto);
            result.Status.AllStatuses    = Repository.GetTrackingStatuses();
            result.Status.IsJobCancelled = (jobDetailsDto.CurrentStatus == Settings.Default.JobClosedTrackingStatus);

            // Add job notes
            var jobNotes = Repository.GetJobNotes(serviceId);//, (Settings.Default.DeploymentTarget != "Clients")?0: StoreId);  // show all c/s notes for call center ; show only client notes to client

            result.JobNotes = jobNotes.Select(noteDto =>
                                              new NoteRecordModel()
            {
                DateTime  = noteDto.DateTime,
                From      = noteDto.From,
                Notes     = noteDto.Notes,
                Read      = noteDto.Read,
                ServiceId = noteDto.ServiceId
            }).ToList();

            ////Additional Job Information
            result.JobAdditionalInfo.InjectFrom(jobDetailsDto);

            //FieldsFromDbService.GetAdditionalJobFields(serviceId, new List<FieldsFromDB>());
            //   result.JobAdditionalInfo.AEPFieldsFromDB.AepFields = FieldsFromDbService.GetAepFields(serviceId, result.JobAdditionalInfo.AEPFieldsFromDB.AepFields);
            result.JobAdditionalInfo.JobFields.AdditionalFields = FieldsFromDbService.GetAdditionalJobFields(serviceId, result.JobAdditionalInfo.JobFields.AdditionalFields);

            //     result.JobAdditionalInfo.IsAepType = DefaultValues.IsAepType(result.RepairInformation.RepairType);
            AccountService accService = new AccountService();

            result.JobAdditionalInfo.RetailerNameList = FillRetailerList(jobDetailsDto.RetailerId);//useraccount.UserStoreCountry);
            result.JobAdditionalInfo.RetailerName     = result.JobAdditionalInfo.RetailerNameList.FirstOrDefault(x => x.Selected).Text.ToString();
            //result.Parts = GetPartsByServiceId(serviceId);
            result.Parts = GetPartsByServiceId(serviceId);
            result.PartsCost.callPartCostModel = Repository.RetrieveJobCost(serviceId);
            result.PartsCost.CallPartsCost     = jobDetailsDto.CallPartsCost;// Math.Round((decimal)jobDetailsDto.CallPartsCost, 2);
            //result.InspectionData =templaterep. GetSpecificTemplateFieldsbyServiceid(serviceId);
            result.LinkedJobs = Repository.LinkedJobs(serviceId);
            result.partsCount = Repository.Partcount(serviceId);
            result.JobClosed  = jobDetailsDto.JobClosed;
            return(result);
        }
Example #20
0
        private static JobDetailsModel LoadJobDetailsFromWeb(int OnlineWarrantyId, string DeviceSerialNumber)
        {
            JobDetailsModel model = new JobDetailsModel()
            {
                JobDetailsParsed   = false,
                OnlineWarrantyId   = OnlineWarrantyId,
                DeviceSerialNumber = DeviceSerialNumber
            };

            string wreqUrl = string.Format("http://www.lwt.com.au/warrantydetails.aspx?SectorID=1&OnlineWarrantyID={0}&Serial={1}", OnlineWarrantyId, Helpers.ParseSerialNumber(DeviceSerialNumber));

            HttpWebRequest wreq = (HttpWebRequest)HttpWebRequest.Create(wreqUrl);

            wreq.KeepAlive = false;
            wreq.Method    = WebRequestMethods.Http.Get;

            HtmlDocument doc = new HtmlDocument();

            using (HttpWebResponse wres = (HttpWebResponse)wreq.GetResponse())
            {
                using (Stream s = wres.GetResponseStream())
                {
                    doc.Load(s);
                }
            }

            try
            {
                var      formatProvider = CultureInfo.CurrentCulture;
                HtmlNode node;

                // Parse Details
                node = doc.GetElementbyId("ctl00_ContentPlaceHolder1_FormView1_WarrantyIDLabel");
                if (node == null)
                {
                    model.JobDetailsParsed = false;
                    return(model);
                }
                model.LWTJobId = node.InnerText;
                node           = doc.GetElementbyId("ctl00_ContentPlaceHolder1_FormView1_WarrantyDateTimeLoggedLabel");

                DateTime dateLogged;
                if (node != null && DateTime.TryParseExact(node.InnerText, "dd-MMM-yyyy", formatProvider, System.Globalization.DateTimeStyles.AssumeLocal, out dateLogged))
                {
                    model.DateLogged = dateLogged;
                }
                else
                {
                    model.DateLogged = null;
                }

                node = doc.GetElementbyId("ctl00_ContentPlaceHolder1_FormView1_DateCompletedLabel");

                DateTime dateCompleted;
                if (node != null && DateTime.TryParse(node.InnerText, out dateCompleted))
                {
                    model.DateCompleted = dateCompleted;
                }
                else
                {
                    model.DateCompleted = null;
                }

                node = doc.GetElementbyId("ctl00_ContentPlaceHolder1_FormView1_FaultDescriptionLabel");
                model.FaultDescription = node != null ? node.InnerHtml : "?";

                // Parse Actions
                node          = doc.GetElementbyId("ctl00_ContentPlaceHolder1_GridView1");
                model.Actions = new List <JobDetailsModel.JobDetailsActionViewModel>();
                if (node != null)
                {
                    foreach (var nodeActionRow in node.Descendants("tr").Skip(1))
                    {
                        var nodeActionDetails = nodeActionRow.Descendants("td").ToArray();
                        if (nodeActionDetails.Length == 4)
                        {
                            DateTime?actionDate = null;
                            DateTime actionDateParse;
                            if (node != null && DateTime.TryParseExact(nodeActionDetails[1].InnerText, "dd-MMM-yyyy", formatProvider, DateTimeStyles.AssumeLocal, out actionDateParse))
                            {
                                actionDate = actionDateParse;
                            }

                            model.Actions.Add(new JobDetailsModel.JobDetailsActionViewModel()
                            {
                                Type = nodeActionDetails[0].InnerText,
                                Date = actionDate,
                                ActionDescription = nodeActionDetails[2].InnerHtml.Replace(Environment.NewLine, "<br />"),
                                TechnicianId      = nodeActionDetails[3].InnerText
                            });
                        }
                    }
                }

                model.JobDetailsParsed = true;
                model.CacheAge         = DateTime.Now;
            }
            catch (Exception)
            {
                // Ignore Parse Errors
            }

            return(model);
        }
 public object ConvertToAPIEntity(JobDetailsModel jobDetails)
 {
     return(jobDetails);
 }