/// <summary> /// Returns Work Order object to AjaxHandler - presented on the WorkOrder Details tab /// </summary> /// <param name="wo">WorkOrder</param> /// <param name="showWorkers">bool flag determining whether the workers associated with the WorkOrder should be retrieved</param> /// <returns>Work Order </returns> public object dtResponse( WorkOrder wo, bool showWorkers) { // tabref = "/HirerWorkOrder/Edit" + Convert.ToString(wo.ID), int ID = wo.ID; return new { tabref = "/HirerWorkOrder/View/" + Convert.ToString(wo.ID), tablabel = Machete.Web.Resources.WorkOrders.tabprefix + wo.getTabLabel(), EID = Convert.ToString(wo.EmployerID), WOID = System.String.Format("{0,5:D5}", wo.paperOrderNum), // Note: paperOrderNum defaults to the value of the WO when a paperOrderNum is not provided dateTimeofWork = wo.dateTimeofWork.ToString(), status = lcache.textByID(wo.status, CI.TwoLetterISOLanguageName), WAcount = wo.workAssignments.Count(a => a.workOrderID == ID).ToString(), contactName = wo.contactName, workSiteAddress1 = wo.workSiteAddress1, zipcode = wo.zipcode, transportMethod = lcache.textByID(wo.transportMethodID, CI.TwoLetterISOLanguageName), displayState = _getDisplayState(wo), // State is used to provide color highlighting to records based on state onlineSource = wo.onlineSource ? Shared.True : Shared.False, workers = showWorkers ? // Workers is only loaded when showWorkers parameter set to TRUE from w in wo.workAssignments select new { WID = w.workerAssigned != null ? (int?)w.workerAssigned.dwccardnum : null, name = w.workerAssigned != null ? w.workerAssigned.Person.firstname1 : null, // Note: hirers should only have access to the workers first name skill = lcache.textByID(w.skillID, CI.TwoLetterISOLanguageName), hours = w.hours, wage = w.hourlyWage } : null }; }
/// <summary> /// /// </summary> /// <param name="p"></param> /// <param name="showWorkers"></param> /// <returns></returns> public object dtResponse(ref WorkOrder p, bool showWorkers) { int ID = p.ID; return new { tabref = p.getTabRef(), tablabel = Machete.Web.Resources.WorkOrders.tabprefix + p.getTabLabel(), EID = Convert.ToString(p.EmployerID), WOID = System.String.Format("{0,5:D5}", p.paperOrderNum), dateTimeofWork = p.dateTimeofWork.ToString(), status = lcache.textByID(p.status, CI.TwoLetterISOLanguageName), WAcount = p.workAssignments.Count(a => a.workOrderID == ID).ToString(), contactName = p.contactName, workSiteAddress1 = p.workSiteAddress1, zipcode = p.zipcode, dateupdated = System.String.Format("{0:MM/dd/yyyy HH:mm:ss}", p.dateupdated), updatedby = p.Updatedby, transportMethod = lcache.textByID(p.transportMethodID, CI.TwoLetterISOLanguageName), displayState = _getDisplayState(p), onlineSource = p.onlineSource ? Shared.True : Shared.False, emailSentCount = p.Emails.Where(e => e.statusID == Email.iSent || e.statusID == Email.iReadyToSend).Count(), emailErrorCount = p.Emails.Where(e => e.statusID == Email.iTransmitError).Count(), recordid = p.ID.ToString(), workers = showWorkers ? from w in p.workAssignments select new { WID = w.workerAssigned != null ? (int?)w.workerAssigned.dwccardnum : null, name = w.workerAssigned != null ? w.workerAssigned.Person.fullName() : null, skill = lcache.textByID(w.skillID, CI.TwoLetterISOLanguageName), hours = w.hours, wage = w.hourlyWage } : null }; }
/// <summary> /// Returns Work Order object - presented on the WorkOrder Details tab /// </summary> /// <param name="wo">WorkOrder</param> /// <param name="showWorkers">bool flag determining whether the workers associated with the WorkOrder should be retrieved</param> /// <returns>Work Order </returns> public object dtResponse( WorkOrder wo, bool showWorkers) { int ID = wo.ID; return new { tabref = wo.getTabRef(), tablabel = Machete.Web.Resources.WorkOrders.tabprefix + wo.getTabLabel(), EID = Convert.ToString(wo.EmployerID), // Note: Employer ID appears to be unused WOID = System.String.Format("{0,5:D5}", wo.paperOrderNum), // TODO: investigate why PaperOrderNum is used - shouldn't this be the Order # from the WO Table? dateTimeofWork = wo.dateTimeofWork.ToString(), status = lcache.textByID(wo.status, CI.TwoLetterISOLanguageName), WAcount = wo.workAssignments.Count(a => a.workOrderID == ID).ToString(), contactName = wo.contactName, workSiteAddress1 = wo.workSiteAddress1, zipcode = wo.zipcode, dateupdated = System.String.Format("{0:MM/dd/yyyy HH:mm:ss}", wo.dateupdated), // Note: Date Updated appears to be unused updatedby = wo.Updatedby, transportMethod = lcache.textByID(wo.transportMethodID, CI.TwoLetterISOLanguageName), // Note: Transport Method appears to be unused displayState = _getDisplayState(wo), // Note: Display State appears to be unused onlineSource = wo.onlineSource ? Shared.True : Shared.False, emailSentCount = wo.Emails.Where(e => e.statusID == Email.iSent || e.statusID == Email.iReadyToSend).Count(), emailErrorCount = wo.Emails.Where(e => e.statusID == Email.iTransmitError).Count(), recordid = wo.ID.ToString(), // Note: Work Order ID appears not to be used workers = showWorkers ? // Note: Workers appears to not be used from w in wo.workAssignments select new { WID = w.workerAssigned != null ? (int?)w.workerAssigned.dwccardnum : null, name = w.workerAssigned != null ? w.workerAssigned.Person.fullName() : null, skill = lcache.textByID(w.skillID, CI.TwoLetterISOLanguageName), hours = w.hours, wage = w.hourlyWage } : null }; }
public bool workOrderCreate(Employer _emp, WorkOrder _wo) { string prefix = "WO0-"; WaitThenClickElement(By.Id("workOrderCreateTab_" + _emp.ID)); WaitForElement(By.Id(prefix + "contactName")); ReplaceElementText(By.Id(prefix + "contactName"), _wo.contactName); //ReplaceElementText(By.Id(prefix + "dateTimeofWork"), String.Format("{MM/dd/yyyy hh:mm tt}", _wo.dateTimeofWork)); ReplaceElementText(By.Id(prefix + "paperOrderNum"), _wo.paperOrderNum.ToString()); //ReplaceElementText(By.Id(prefix + "timeFlexible"), _wo.timeFlexible.ToString()); //ReplaceElementText(By.Id(prefix + "permanentPlacement"), _wo.permanentPlacement); ReplaceElementText(By.Id(prefix + "workSiteAddress1"), _wo.workSiteAddress1); ReplaceElementText(By.Id(prefix + "workSiteAddress2"), _wo.workSiteAddress2); //ReplaceElementText(By.Id(prefix + "englishRequired"), _wo.englishRequired); ReplaceElementText(By.Id(prefix + "phone"), _wo.phone); //ReplaceElementText(By.Id(prefix + "lunchSupplied"), _wo.lunchSupplied); ReplaceElementText(By.Id(prefix + "city"), _wo.city); ReplaceElementText(By.Id(prefix + "state"), _wo.state); //ReplaceElementText(By.Id(prefix + "transportMethodID"), _wo.transportMethodID); ReplaceElementText(By.Id(prefix + "zipcode"), _wo.zipcode); //ReplaceElementText(By.Id(prefix + "transportFee"), _wo.transportFee); //ReplaceElementText(By.Id(prefix + "transportFeeExtra"), _wo.transportFeeExtra); //ReplaceElementText(By.Id(prefix + "englishRequiredNote"), _wo.englishRequiredNote); ReplaceElementText(By.Id(prefix + "description"), _wo.description); // SelectOption(By.Id(prefix + "status"), MacheteLookup.cache.First(c => c.category == "orderstatus" && c.ID == _wo.status).text_EN); SelectOptionByIndex(By.Id(prefix + "transportMethodID"), _wo.transportMethodID); SelectOptionByIndex(By.Id(prefix + "timeFlexible"), _wo.timeFlexible ? 2 : 1); SelectOptionByIndex(By.Id(prefix + "permanentPlacement"), _wo.permanentPlacement ? 2 : 1); SelectOptionByIndex(By.Id(prefix + "englishRequired"), _wo.englishRequired ? 2 : 1); SelectOptionByIndex(By.Id(prefix + "lunchSupplied"), _wo.lunchSupplied ? 2 : 1); Thread.Sleep(1000); //prevent race condition if (_wo.workerRequests != null) foreach (var request in _wo.workerRequests) { WaitThenClickElement(By.Id("addRequestBtn-" + _wo.ID)); ReplaceElementText(By.XPath("//*[@id='workerTable-0_filter']/label/input"), request.ID.ToString()); WaitThenClickElement(By.XPath("//*[@id='workerTable-0']/tbody/tr/td[1]")); } Thread.Sleep(1000); //prevent race condition // // save work order _d.FindElement(By.Id(prefix + "SaveBtn")).Click(); // // Find new work order tab (css class "WO"), get embedded WOID, populate // WO object _wo.ID = getSelectedTabRecordID("WO"); Assert.IsTrue(_d.FindElement(By.CssSelector("li.WO.ui-tabs-selected > a")) .Text == Machete.Web.Resources.WorkOrders.tabprefix + _wo.getTabLabel(), "Work order anchor label doesn't match work order"); return true; }