// 根据传入数据进行收集整理,使用linq方法 private DataInfoObject GetInfo(List <RawDataObject> partRawDataObject) { DataInfoObject dataInfoObject = new DataInfoObject(); // 编程语言 foreach (var programLanguage in Segmenter.ProgramLanguage) { var data = from rawData in partRawDataObject where rawData.ToString().Contains(programLanguage) select rawData; dataInfoObject.ProgramLanguage.Add(programLanguage, data.Count()); } // 技术栈 foreach (var technologyStack in Segmenter.TechnologyStack) { var data = from rawData in partRawDataObject where rawData.ToString().Contains(technologyStack) select rawData; dataInfoObject.TechnologyStack.Add(technologyStack, data.Count()); } // 岗位 foreach (var job in Segmenter.Job) { var data = from rawData in partRawDataObject where rawData.ToString().Contains(job) select rawData; dataInfoObject.Job.Add(job, data.Count()); } // 地址 foreach (var rawData in partRawDataObject) { if (dataInfoObject.Address.ContainsKey(rawData.WorkPlace)) { continue; } var fitler = from data in partRawDataObject where data.WorkPlace.Equals(rawData.WorkPlace) select data; dataInfoObject.Address.Add(rawData.WorkPlace, fitler.Count()); } return(dataInfoObject); }
private void button1_Click(object sender, EventArgs e) { //根据不同的菜单栏生成图表 chart1.Series[0].ChartType = SeriesChartType.Pie; if (comboBox1.SelectedIndex == 0) { Dictionary <List <string>, List <int> > data = Chart.ChartRender(dataObject.AllInfoObject[comboBox2.SelectedIndex]); chart1.Series[0].Points.DataBindXY(data.First().Key, data.First().Value); if (comboBox2.SelectedIndex == 3) { chart1.Series[0].ChartType = SeriesChartType.Column; } // 推荐分析 richTextBox1.Text = DataAnalysis.LanguageAnalysis(dataObject); } else if (comboBox1.SelectedIndex == 1) { DataInfoObject dataInfoObject = new DataInfoObject(); dataObject.CompanyObject.TryGetValue(comboBox2.SelectedItem.ToString(), out dataInfoObject); Dictionary <List <string>, List <int> > data = Chart.ChartRender(dataInfoObject[comboBox3.SelectedIndex]); chart1.Series[0].Points.DataBindXY(data.First().Key, data.First().Value); if (comboBox3.SelectedIndex == 3) { chart1.Series[0].ChartType = SeriesChartType.Column; } // 推荐分析 richTextBox1.Text = DataAnalysis.CompanyAnalysis(dataObject, comboBox2.SelectedItem.ToString()); } else if (comboBox1.SelectedIndex == 2) { Dictionary <string, DataInfoObject> dictionary = new Dictionary <string, DataInfoObject>(); DataInfoObject dataInfoObject = new DataInfoObject(); dataObject.AddressObject.TryGetValue(comboBox2.SelectedItem.ToString(), out dictionary); dictionary.TryGetValue(comboBox3.SelectedItem.ToString(), out dataInfoObject); Dictionary <List <string>, List <int> > data = Chart.ChartRender(dataInfoObject[comboBox4.SelectedIndex + 1]); chart1.Series[0].Points.DataBindXY(data.First().Key, data.First().Value); if (comboBox4.SelectedIndex + 1 == 3) { chart1.Series[0].ChartType = SeriesChartType.Column; } // 推荐分析 richTextBox1.Text = DataAnalysis.AddressAnalysis(dataObject, comboBox2.SelectedItem.ToString()); } }
public static string CompanyAnalysis(DataObject dataObject, string companyName) { Dictionary <string, DataInfoObject> allCompanyInfo = dataObject.CompanyObject; DataInfoObject companyInfo = new DataInfoObject(); allCompanyInfo.TryGetValue(companyName, out companyInfo); var data1 = from technologyStack in companyInfo.TechnologyStack orderby technologyStack.Value descending select technologyStack; int maxCount1 = data1.First().Value; string maxTecStack = data1.First().Key; string result1 = companyName + "对" + maxTecStack + "岗位的需求最大,共有" + maxCount1 + "个需求。"; string advise1 = "建议对" + companyName + "感兴趣的求职者多了解" + maxTecStack + "方面的知识,以便提高进入心仪公司的概率。"; var data2 = from programLanguage in companyInfo.ProgramLanguage orderby programLanguage.Value descending select programLanguage; int maxCount2 = data2.First().Value; string maxLanguage = data2.First().Key; string result2 = companyName + "对了解" + maxLanguage + "语言的人才需求最大,共有" + maxCount2 + "个需求。"; string advise2 = "建议对" + companyName + "感兴趣的求职者多学习" + maxLanguage + "相关的知识,以便提高进入心仪公司的概率。"; var data3 = from yourJob in companyInfo.Job orderby yourJob.Value descending select yourJob; int maxCount3 = data3.First().Value; string maxJob = data3.First().Key; string result3 = companyName + "对" + maxJob + "的需求最大,共有" + maxCount3 + "个需求。"; string advise3 = "建议对" + companyName + "感兴趣的求职者多了解" + maxJob + "方面的知识,以便提高进入心仪公司的概率。"; var data4 = from address in companyInfo.Address orderby address.Value descending select address; int maxCount4 = data4.First().Value; string maxAddress = data4.First().Key; string result4 = companyName + "在" + maxAddress + "对人才的需求最大,共有" + maxCount4 + "个需求。"; string advise4 = "建议对" + companyName + "感兴趣的求职者前往" + maxAddress + ",以便提高进入心仪公司的概率。"; return(result1 + "\n" + advise1 + "\n" + result2 + "\n" + advise2 + "\n" + result3 + "\n" + advise3 + "\n" + result4 + "\n" + advise4); }
public DataObject() { CompanyObject = new Dictionary <string, DataInfoObject>(); AddressObject = new Dictionary <string, Dictionary <string, DataInfoObject> >(); AllInfoObject = new DataInfoObject(); }