private bool GSCSH() { try { ConfigClass1 configClass1 = new ConfigClass1(); string gsStr = configClass1.getGS(); if (gsStr.Trim().Length > 0) { int count = 0; Dictionary <int, string> mydic = new Dictionary <int, string>(); string[] szls = gsStr.Split(','); foreach (string ss in szls) { mydic.Add(count++, ss); } GSSelect.ItemsSource = mydic; GSSelect.SelectedValuePath = "Key"; GSSelect.DisplayMemberPath = "Value"; GSSelect.SelectedIndex = 0; } } catch { return(false); } return(true); }
public void CX() { try { if ((!(sDate.SelectedDate.ToString().Length == 0)) && (!(eDate.SelectedDate.ToString().Length == 0))) { BTLabel.Content = Convert.ToDateTime(sDate.SelectedDate).ToString("yyyy年MM月dd日") + "至" + Convert.ToDateTime(eDate.SelectedDate).ToString("yyyy年MM月dd日") + SXSelect.Text + "小时数值预报准确率"; ConfigClass1 configClass1 = new ConfigClass1(); string IDNameStr = configClass1.IDName(GSSelect.Text); string[] szIDName = IDNameStr.Split('\n'); Int16 minsx = 0, maxsx = 21; if (SXSelect.SelectedIndex == 0) { minsx = 0; maxsx = 21; } else if (SXSelect.SelectedIndex == 1) { minsx = 24; maxsx = 45; } else { minsx = 48; maxsx = 69; } List <ConfigClass1.YBList> temLists = configClass1.GetTemListsbyGSandDate(Convert.ToDateTime(sDate.SelectedDate), Convert.ToDateTime(eDate.SelectedDate), GSSelect.Text, Convert.ToInt16(SCSelect.Text), minsx, maxsx); temLists = temLists.OrderBy(y => y.dateTime).ToList(); if (szIDName.Length > 0) { if (temLists.Count > 0) { List <ConfigClass1.SKList> skLists = configClass1.GetSKListsbyGSandDate(temLists[0].dateTime, temLists[temLists.Count - 1].dateTime); GRPFList.ItemsSource = null; grpf.Clear(); for (int i = 0; i < szIDName.Length; i++) { string id = szIDName[i].Split(',')[0], name = szIDName[i].Split(',')[1]; ; grpf.Add(new GRPF { id = id, Name = name, Zql0 = configClass1.GetTemZqLbyIDandSx(temLists, skLists, id, minsx), Zql3 = configClass1.GetTemZqLbyIDandSx(temLists, skLists, id, minsx + 3), Zql6 = configClass1.GetTemZqLbyIDandSx(temLists, skLists, id, minsx + 6), Zql9 = configClass1.GetTemZqLbyIDandSx(temLists, skLists, id, minsx + 9), Zql12 = configClass1.GetTemZqLbyIDandSx(temLists, skLists, id, minsx + 12), Zql15 = configClass1.GetTemZqLbyIDandSx(temLists, skLists, id, minsx + 15), Zql18 = configClass1.GetTemZqLbyIDandSx(temLists, skLists, id, minsx + 18), Zql21 = configClass1.GetTemZqLbyIDandSx(temLists, skLists, id, minsx + 21), ZqlPJ = configClass1.GetTemPJZQLbyIDandSX(temLists, skLists, id, minsx, maxsx), }); } grpf.Add(new GRPF { id = "00000", Name = "平均", Zql0 = configClass1.GetTemZqLbyIDandSx(temLists, skLists, minsx), Zql3 = configClass1.GetTemZqLbyIDandSx(temLists, skLists, minsx + 3), Zql6 = configClass1.GetTemZqLbyIDandSx(temLists, skLists, minsx + 6), Zql9 = configClass1.GetTemZqLbyIDandSx(temLists, skLists, minsx + 9), Zql12 = configClass1.GetTemZqLbyIDandSx(temLists, skLists, minsx + 12), Zql15 = configClass1.GetTemZqLbyIDandSx(temLists, skLists, minsx + 15), Zql18 = configClass1.GetTemZqLbyIDandSx(temLists, skLists, minsx + 18), Zql21 = configClass1.GetTemZqLbyIDandSx(temLists, skLists, minsx + 21), ZqlPJ = configClass1.GetTemPjzqLbyIDandSx(temLists, skLists, minsx, maxsx), }); temLists = configClass1.GetTaxListsbyGSandDate(Convert.ToDateTime(sDate.SelectedDate), Convert.ToDateTime(eDate.SelectedDate), GSSelect.Text, Convert.ToInt16(SCSelect.Text), Convert.ToInt16(SXSelect.Text.Replace("小时", ""))); for (int i = 0; i < szIDName.Length; i++) { string id = szIDName[i].Split(',')[0], name = szIDName[i].Split(',')[1]; grpf.Find(y => y.id == id).ZqlGW = configClass1.GetTaxZqLbyIDandSx(temLists, skLists, id); } grpf.Find(y => y.id == "00000").ZqlGW = configClass1.GetTaxZqLbyIDandSx(temLists, skLists); temLists = configClass1.GetTminListsbyGSandDate(Convert.ToDateTime(sDate.SelectedDate), Convert.ToDateTime(eDate.SelectedDate), GSSelect.Text, Convert.ToInt16(SCSelect.Text), Convert.ToInt16(SXSelect.Text.Replace("小时", ""))); for (int i = 0; i < szIDName.Length; i++) { string id = szIDName[i].Split(',')[0], name = szIDName[i].Split(',')[1]; grpf.Find(y => y.id == id).ZqlDW = configClass1.GetTminZqLbyIDandSx(temLists, skLists, id); } grpf.Find(y => y.id == "00000").ZqlDW = configClass1.GetTminZqLbyIDandSx(temLists, skLists); ((this.FindName("GRPFList")) as DataGrid).ItemsSource = grpf; temLists.Clear(); skLists.Clear(); } else { MessageBox.Show("所选时间段没有登录记录,请重新选择起止时间"); } } else { MessageBox.Show("站点信息获取失败"); } } else { MessageBox.Show("请选择起止时间"); } } catch (Exception ex) { MessageBox.Show(ex.Message); } }