private void btnSelect_Click(object sender, EventArgs e) { DateTime?recorddate = null; DateTime?responsedate = null; DateTime?doctadvicedate = null; bool flg = false; string appdeptname = string.Empty; string BeginDate = this.dteRq1.Value.ToString("yyyy-MM-dd"); string EndDate = this.dteRq2.Value.ToString("yyyy-MM-dd"); List <EntityCriticalDeal> data = new List <EntityCriticalDeal>(); if (Convert.ToDateTime(BeginDate + " 00:00:01") > Convert.ToDateTime(EndDate + " 00:00:01")) { MessageBox.Show("开始日期不能大于结束日期。", "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } try { clsPublic.PlayAvi("findFILE.avi", "正在项目信息,请稍候..."); dwRep.Reset(); clsHISReportZy_Supported_Svc svc = (clsHISReportZy_Supported_Svc)com.digitalwave.iCare.common.clsObjectGenerator.objCreatorObjectByType(typeof(clsHISReportZy_Supported_Svc)); DataTable dt = svc.GetCriticalDeal(BeginDate, EndDate); if (dt != null && dt.Rows.Count > 0) { foreach (DataRow dr in dt.Rows) { flg = false; appdeptname = dr["appdeptname"].ToString(); if (string.IsNullOrEmpty(appdeptname)) { continue; } if (dr["recorddate"].ToString() != "") { recorddate = Convert.ToDateTime(dr["recorddate"].ToString()); } else { continue; } if (dr["responsedate"].ToString() != "") { responsedate = Convert.ToDateTime(dr["responsedate"].ToString()); } else { responsedate = System.DateTime.Now; } if (dr["doctadvicedate"].ToString() != "") { doctadvicedate = Convert.ToDateTime(dr["doctadvicedate"].ToString()); } else { doctadvicedate = System.DateTime.Now; } TimeSpan tsRespon = responsedate.Value - recorddate.Value; TimeSpan tsDeal = doctadvicedate.Value - recorddate.Value; if (data.Count > 0) { for (int i = 0; i < data.Count; i++) { if (appdeptname == data[i].appdeptname) { if (tsRespon.TotalMinutes >= 360) { data[i].unres++; data[i].unresPer = Math.Round(((double)data[i].unres / (double)data[i].cvmSum) * 100, 1).ToString() + "%"; } if (tsDeal.TotalMinutes >= 360) { data[i].undeal++; data[i].undealPer = Math.Round(((double)data[i].undeal / (double)data[i].cvmSum) * 100, 1).ToString() + "%"; } flg = true; break; } } } if (!flg) { EntityCriticalDeal vo = new EntityCriticalDeal(); vo.appdeptname = appdeptname; vo.unres = 0; vo.undeal = 0; vo.undealPer = " "; vo.unresPer = " "; DataRow[] drr = dt.Select("appdeptname = '" + appdeptname + "' and recorddate is not null"); vo.cvmSum = drr.Length; if (tsRespon.TotalMinutes >= 360) { vo.unres++; vo.unresPer = Math.Round(((double)vo.unres / (double)vo.cvmSum) * 100, 1).ToString() + "%"; } if (tsDeal.TotalMinutes >= 360) { vo.undeal++; vo.undealPer = Math.Round(((double)vo.undeal / (double)vo.cvmSum) * 100, 1).ToString() + "%"; } data.Add(vo); } } } if (data != null && data.Count > 0) { int row = 0; dwRep.SetRedrawOff(); for (int i = 0; i < data.Count; i++) { row = dwRep.InsertRow(0); dwRep.SetItemString(row, "appdeptname", data[i].appdeptname); dwRep.SetItemString(row, "cvm_total", data[i].cvmSum.ToString()); dwRep.SetItemString(row, "unres_total", data[i].unres.ToString() == "0" ? "" : data[i].unres.ToString()); dwRep.SetItemString(row, "unres_per", data[i].unresPer.ToString()); dwRep.SetItemString(row, "undeal_total", data[i].undeal.ToString() == "0" ? "" : data[i].undeal.ToString()); dwRep.SetItemString(row, "undeal_per", data[i].undealPer); } dwRep.SetRedrawOn(); } else { dwRep.InsertRow(0); } dwRep.Modify("t_date.text = '" + BeginDate + " ~ " + EndDate + "'"); } finally { clsPublic.CloseAvi(); } this.dwRep.Refresh(); }