private void CheckAll(object[] parameter) { var values = parameter; //string zone = (string)values[0]; bool checkall = (bool)values[1]; if (checkall) { IsChecked = true; Zones = new List <string> { "北京", "上海", "广州", "深圳", "长沙", "苏州", "西安", "佛山", "杭州" }; if (SelectedKpiInfos == null) { SelectedKpiInfos = new ObservableCollection <KpiInfoViewModel>(); } foreach (string zone in Zones) { foreach (KPIinfo item in KPIinfos.FindAll(x => x.Zone.Contains(zone))) { KpiInfoViewModel kpi = new KpiInfoViewModel(); kpi.KPIInfo = item; kpi.IsSelected = true; SelectedKpiInfos.Add(kpi); } } } else { IsChecked = false; Zones = new List <string>(); SelectedKpiInfos = null; } }
//生成绩效目标表 private void Generate_KPI_Target(KpiInfoViewModel kpi, Microsoft.Office.Interop.Excel.Worksheet wsh) { try { wsh.Cells[2, 2].value = kpi.KPIInfo.Year + "年" + kpi.KPIInfo.Period.Substring(0, 2) + "绩效指标考核表——国内专利事业部+" + kpi.KPIInfo.Zone + "+" + kpi.KPIInfo.Name; wsh.Cells[3, 2].value = "考核周期:" + kpi.KPIInfo.Period; wsh.Cells[6, 7].value = kpi.KPIInfo.DonePoint_Target; wsh.Cells[7, 7].value = kpi.KPIInfo.FirstVirsionPoint_Target; wsh.Cells[8, 7].value = kpi.KPIInfo.PatentDegree_Target; wsh.Cells[9, 7].value = kpi.KPIInfo.InTimePortion_Target; wsh.Cells[6, 8].value = 0.3; wsh.Cells[7, 8].value = 0.25; wsh.Cells[8, 8].value = 0.1; wsh.Cells[9, 8].value = 0.2; wsh.Cells[15, 4].value = kpi.KPIInfo.Name; wsh.Cells[16, 4].value = kpi.KPIInfo.Examiner; wsh.Cells[15, 7].value = kpi.KPIInfo.Position; wsh.Cells[16, 7].value = kpi.KPIInfo.Examiner_Positon; //华进员工绩效考核表——国内专利事业部+广州电子部+蔡抒枫 string file = "C:\\WORK\\绩效考核\\华进员工绩效考核表——国内专利事业部+" + kpi.KPIInfo.Zone + "+" + kpi.KPIInfo.Name + ".xlsx"; if (File.Exists(file)) { File.Delete(file); } wsh.SaveAs(file); } catch (Exception ex) { MessageBox.Show(ex.ToString()); throw; } }
private void OnCheck(object[] parameter) { var values = parameter; string zone = (string)values[0]; bool check = (bool)values[1]; DoneTotalForExam = 0; FirstVersionTotal = 0; if (check) { Zones.Add(zone); if (SelectedKpiInfos == null) { SelectedKpiInfos = new ObservableCollection <KpiInfoViewModel>(); } foreach (KPIinfo item in KPIinfos.FindAll(x => x.Zone.Contains(zone))) { KpiInfoViewModel kpi = new KpiInfoViewModel(); kpi.KPIInfo = item; kpi.IsSelected = true; SelectedKpiInfos.Add(kpi); DoneTotalForExam += item.DonePoint; FirstVersionTotal += item.FirstVirsionPoint; } } else { Zones.Remove(zone); List <KpiInfoViewModel> kpis = new List <KpiInfoViewModel>(SelectedKpiInfos); kpis.RemoveAll(x => x.KPIInfo.Zone.Contains(zone)); SelectedKpiInfos = new ObservableCollection <KpiInfoViewModel>(kpis); foreach (KpiInfoViewModel item in SelectedKpiInfos) { DoneTotalForExam += item.KPIInfo.DonePoint; FirstVersionTotal += item.KPIInfo.FirstVirsionPoint; } } }
private void Sift(object[] parameter) { try { List <string> names = new List <string>(); List <string> years = new List <string>(); List <string> months = new List <string>(); string yearStart = StartDate.Year.ToString(); string yearEnd = EndDate.Year.ToString(); string monthStart = StartDate.Month.ToString(); string monthEnd = EndDate.Month.ToString(); if (yearStart.Equals(yearEnd)) { years.Add(yearStart); if (StartDate <= EndDate) { for (int i = StartDate.Month; i <= EndDate.Month; i++) { if (i < 10) { months.Add("0" + i); } else { months.Add(i.ToString()); } } } else { MessageBox.Show("起始日期应小于结束日期!", "出错", MessageBoxButton.OKCancel, MessageBoxImage.Error); } } else { MessageBox.Show("不支持跨年查询!", "出错", MessageBoxButton.OKCancel, MessageBoxImage.Error); } KpiDataServiceThroughSQLite kds = new KpiDataServiceThroughSQLite(); KPIinfos = new List <KPIinfo>(); KPIinfos = kds.GetKPIs(years, months); List <KpiInfoViewModel> kpis = new List <KpiInfoViewModel>(); DoneTotalForExam = 0; FirstVersionTotal = 0; foreach (KPIinfo item in KPIinfos) { KpiInfoViewModel kpi = new KpiInfoViewModel(); kpi.KPIInfo = item; kpi.IsSelected = true; kpis.Add(kpi); DoneTotalForExam += item.DonePoint; FirstVersionTotal += item.FirstVirsionPoint; } SelectedKpiInfos = new ObservableCollection <KpiInfoViewModel>(kpis); } catch (Exception ex) { MessageBox.Show(ex.ToString()); throw; } }