static void Main(string[] args) { //ProcessCareerCupQuestions(); var outFile = "programcreek.json"; var questions = new List <Question>(); var driver = PhantomJSExt.InitPhantomJS(); var site = "http://www.programcreek.com/2012/11/top-10-algorithms-for-coding-interview/"; try { GetQuestions(questions, driver, site); foreach (var q in questions) { driver.Navigate().GoToUrl(q.Url); var section = driver.FindElement(By.ClassName("entrybody")); var p = section.FindElement(By.XPath("./p")); var qText = p.Text; q.Text = qText; } } finally { driver.Quit(); InterviewData data = new InterviewData(); data.Questions = questions; var json = JsonConvert.SerializeObject(data); FileIO.Write(outFile, json); } }
public void Interview_Delete() { Console.WriteLine("WindowHandle at Start: " + Driver.GetHashCode().ToString()); var mainMenu = new MainMenu(Driver); var interviewPages = new InterviewPages(Driver); var interviewData = new InterviewData(); try //Contains Contents of Test { //test.Log(LogStatus.Info, "Starting test at URL: " + BaseUrls["ApplitrackLoginPage"]); mainMenu.ClickInterviews(); test.Log(LogStatus.Pass, "Navigate to Interviews"); Driver.SwitchToFrameById("MainContentsIFrame"); interviewPages.MyInterviewsPage.SelectInterview(interviewData.InterviewTitle); test.Log(LogStatus.Pass, "Select the interview from the list"); Driver.SwitchToPopup(); interviewPages.CreateInterviewPages.SeriesDetailsTab.ClickDelete(); test.Log(LogStatus.Pass, "Click delete"); interviewPages.CreateInterviewPages.SeriesDetailsTab.ConfirmDeleteInterview(); test.Log(LogStatus.Pass, "Confirm the deletion"); Driver.ClosePopup(); test.Log(LogStatus.Pass, "Close interview deletion window"); } catch (Exception e) //On Error Do { HandleException(e, Driver); throw; } }
public void AddInterview(InterviewData interviewData) { InterviewEntity interviewEntity = new InterviewEntity { Id = 0, Date = interviewData.Date, Position = interviewData.Position, RequiredSkills = interviewData.RequiredSkills, Title = interviewData.Title, }; InterviewerEntity interviewerEntity = new InterviewerEntity { Fullname = "First Interviewer", Email = "*****@*****.**", Skype = "firstinterviewer", Website = "http://firstinterviewer.xerox.com" }; using (EntityFrameworkContext context = new EntityFrameworkContext()) { context.Interviews.Add(interviewEntity); context.Interviewers.Add(interviewerEntity); context.SaveChanges(); } }
public void Interview_Create_New() { Console.WriteLine("WindowHandle at Start: " + Driver.GetHashCode().ToString()); var mainMenu = new MainMenu(Driver); var interviewMenu = new SubMenuInterviews(Driver); var interviewPages = new InterviewPages(Driver); var interviewData = new InterviewData(); try //Contains Contents of Test { //test.Log(LogStatus.Info, "Starting test at URL: " + BaseUrls["ApplitrackLoginPage"]); mainMenu.ClickInterviews(); interviewMenu.ClickCreateInterview(); test.Log(LogStatus.Pass, "Navigate to Interviews > Create Interview"); mainMenu.SwitchToWindow("Manage Interview Series"); interviewPages.CreateInterviewPages.StartTab.SelectCreateNew(); test.Log(LogStatus.Pass, "Click Add New Interview"); interviewPages.CreateInterviewPages.StartTab.SelectGeneralRecruiting(); test.Log(LogStatus.Pass, "Click Add New Interview Type"); interviewPages.CreateInterviewPages.ClickNext(); test.Log(LogStatus.Pass, "Click Next"); interviewPages.CreateInterviewPages.SeriesDetailsTab.EnterTitle(interviewData.InterviewTitle); test.Log(LogStatus.Pass, "Entering title: " + interviewData.InterviewTitle); interviewPages.CreateInterviewPages.ClickSummaryTab(); test.Log(LogStatus.Pass, "Click Summary tab"); interviewPages.CreateInterviewPages.ClickSaveFinish(); test.Log(LogStatus.Pass, "Click Save and Finish"); } catch (Exception e) //On Error Do { HandleException(e, Driver); throw; } }
/// <summary> /// 根據聯繫ID匯出面談資料 /// </summary> /// <param name="contactIdList"></param> /// <param name="path"></param> /// <returns></returns> public string ExportInterviewDataByContactId(List <string> contactIdList, string path) { bool isAllExport = true; ////紀錄是否有資料沒有面談資料 try { for (int i = 0; i < contactIdList.Count; i++) { List <InterviewData> interviewDataList = new List <InterviewData>(); ///面談資料清單 DataSet ds = Talent.GetInstance().SelectContactSituationDataById(contactIdList[i]); List <string> interviewIdList = new List <string>(); foreach (DataRow dr in ds.Tables[4].Rows) { interviewIdList.Add(dr[0].ToString()); } ////代表沒有面談資料 if (interviewIdList.Count == 0) { isAllExport = false; continue; } foreach (string interviewId in interviewIdList) { InterviewResults interviewResults = new InterviewResults(); InterviewData interviewData = new InterviewData(); DataSet interviewDataSet = Talent.GetInstance().SelectInterviewDataById(interviewId); List <InterviewInfo> interviewInfo = interviewDataSet.Tables[0].DataTableToList <InterviewInfo>(); ////面談基本資料 List <InterviewComments> interviewCommentsList = interviewDataSet.Tables[1].DataTableToList <InterviewComments>(); ////面談評語 List <InterviewResult> interviewResult = interviewDataSet.Tables[2].DataTableToList <InterviewResult>(); ////面談結果(任用評定與備註) interviewResults.InterviewResult = interviewResult[0]; interviewResults.InterviewCommentsList = interviewCommentsList; List <ProjectExperience> projectExperienceList = interviewDataSet.Tables[3].DataTableToList <ProjectExperience>(); ////專案經驗 interviewData.InterviewInfo = interviewInfo[0]; interviewData.InterviewResults = interviewResults; interviewData.ProjectExperienceList = projectExperienceList; interviewDataList.Add(interviewData); } string msg = ExcelHelper.GetInstance().ExportInterviewData(interviewDataList, path, i + 1); if (msg != "匯出成功") { return("匯出失敗"); } } if (!isAllExport) { return("匯出成功,但有些資料沒有面談資料"); } return("匯出成功"); } catch (Exception ex) { LogInfo.WriteErrorInfo(ex); return("匯出失敗"); } }
/// <summary> /// 根據聯繫ID匯出所有資料 /// </summary> /// <param name="contactIdList"></param> /// <param name="path"></param> /// <returns></returns> public string ExportAllDataByContactId(List <string> contactIdList, string path) { try { for (int i = 0; i < contactIdList.Count; i++) { List <ContactSituation> ContactSituationList = new List <ContactSituation>(); ////聯繫狀況資料 List <InterviewData> interviewDataList = new List <InterviewData>(); ///面談資料清單 ContactSituation contactSituation = new ContactSituation(); DataSet ds = Talent.GetInstance().SelectContactSituationDataById(contactIdList[i]); contactSituation.Info = ds.Tables[0].DBNullToEmpty().DataTableToList <ContactInfo>()[0]; contactSituation.Status = ds.Tables[1].DataTableToList <ContactStatus>(); string codeList = string.Empty; foreach (DataRow dr in ds.Tables[2].Rows) { codeList += dr[0].ToString() + "\n"; } contactSituation.Code = codeList; ContactSituationList.Add(contactSituation); List <string> interviewIdList = new List <string>(); foreach (DataRow dr in ds.Tables[4].Rows) { interviewIdList.Add(dr[0].ToString()); } foreach (string interviewId in interviewIdList) { InterviewResults interviewResults = new InterviewResults(); InterviewData interviewData = new InterviewData(); DataSet interviewDataSet = Talent.GetInstance().SelectInterviewDataById(interviewId); List <InterviewInfo> interviewInfo = interviewDataSet.Tables[0].DataTableToList <InterviewInfo>(); ////面談基本資料 List <InterviewComments> interviewCommentsList = interviewDataSet.Tables[1].DataTableToList <InterviewComments>(); ////面談評語 List <InterviewResult> interviewResult = interviewDataSet.Tables[2].DataTableToList <InterviewResult>(); ////面談結果(任用評定與備註) interviewResults.InterviewResult = interviewResult[0]; interviewResults.InterviewCommentsList = interviewCommentsList; List <ProjectExperience> projectExperienceList = interviewDataSet.Tables[3].DataTableToList <ProjectExperience>(); ////專案經驗 interviewData.InterviewInfo = interviewInfo[0]; interviewData.InterviewResults = interviewResults; interviewData.ProjectExperienceList = projectExperienceList; interviewDataList.Add(interviewData); } string msg = ExcelHelper.GetInstance().ExportAllData(ContactSituationList, interviewDataList, path, i + 1); if (msg != "匯出成功") { return("匯出失敗"); } } return("匯出成功"); } catch (Exception ex) { LogInfo.WriteErrorInfo(ex); return("匯出失敗"); } }
private static void ProcessCareerCupQuestions() { var dir = @"C:\Users\ralph.joachim\Documents\Visual Studio 2015\Projects\CareerCupToolkit\CareerCupToolkit"; var questions = new List <Question>(); var driver = PhantomJSExt.InitPhantomJS(); try { foreach (var fName in Directory.EnumerateFiles(dir, "*.txt")) { var fileName = Path.GetFileName(fName); var index = fileName.IndexOf('_'); var company = fileName.Substring(0, index); Question q = null; var urlFound = true; bool lookForBody = false; StringBuilder textSB = new StringBuilder(); foreach (var line in FileIO.ReadFrom(fName)) { if (line.StartsWith("-----")) { if (urlFound) { urlFound = false; lookForBody = true; } else if (lookForBody) { lookForBody = false; q.Text = textSB.ToString(); questions.Add(q); textSB = new StringBuilder(); } continue; } if (line.StartsWith("Question")) { q = new Question(); q.Company = company; var i = line.IndexOf(':'); var url = line.Substring(i + 1).Trim(); q.Url = url; urlFound = true; //tag, concept, topic //You will have to visit the url to get the tags to populate topic driver.Navigate().GoToUrl(url); List <string> tags = GetTags(driver); q.Tags = tags; } else if (lookForBody) { textSB.AppendLine(line); } } } } finally { driver.Quit(); InterviewData data = new InterviewData(); data.Questions = questions; var json = JsonConvert.SerializeObject(data); FileIO.Write("questions.json", json); } }