private void BindData() { QueryProjectReport model = new QueryProjectReport(); if (!string.IsNullOrEmpty(AgentID)) { int _userid = 0; if (int.TryParse(AgentID, out _userid)) { model.UserID = _userid; } } if (!string.IsNullOrEmpty(AgentNum)) { model.AgentNum = AgentNum; } if (!string.IsNullOrEmpty(ProjectID)) { int _projectid = 0; if (int.TryParse(ProjectID, out _projectid)) { model.ProjectID = _projectid; } } if (!string.IsNullOrEmpty(BusinessType)) { int _businesstype = 0; if (int.TryParse(BusinessType, out _businesstype)) { model.BusinessType = _businesstype; } } else {//默认是其他任务 model.BusinessType = 4; } if (!string.IsNullOrEmpty(StartTime) && !string.IsNullOrEmpty(EndTime)) { DateTime _begintime = DateTime.Now; DateTime.TryParse(StartTime, out _begintime); DateTime _endtime = DateTime.Now; DateTime.TryParse(EndTime, out _endtime); model.BeginTime = _begintime; model.EndTime = _endtime; } DataTable dt = null; int count = 0; dt = BLL.ProjectInfo.Instance.GetB_ProjectReport(model, " ", BLL.PageCommon.Instance.PageIndex, PageSize, out count, userID); if (dt != null && dt.Rows.Count > 0) { for (int i = 0; i < dt.Rows.Count; i++) { DataRow row = dt.Rows[i]; row["assigncount"] = row["assigncount"] == DBNull.Value ? "-" : row["assigncount"]; row["tjcount"] = row["tjcount"] == DBNull.Value ? "0" : row["tjcount"]; row["jtcount"] = row["jtcount"] == DBNull.Value ? "0" : row["jtcount"]; row["successcount"] = row["successcount"] == DBNull.Value ? "0" : row["successcount"]; row["wjtcount"] = row["wjtcount"] == DBNull.Value ? "0" : row["wjtcount"]; row["jtfailcount"] = row["jtfailcount"] == DBNull.Value ? "0" : row["jtfailcount"]; } } repeaterTableList.DataSource = dt; repeaterTableList.DataBind(); this.litPagerDown.Text = BLL.PageCommon.Instance.LinkStringByPost(BLL.Util.GetUrl(), GroupLength, count, PageSize, BLL.PageCommon.Instance.PageIndex, 1); }
/// <summary> /// 取项目报表汇总数据 /// </summary> /// <param name="msg"></param> public void GetProjectReportSum(out string msg) { msg = string.Empty; QueryProjectReport model = new QueryProjectReport(); if (!string.IsNullOrEmpty(AgentID)) { int _userid = 0; if (int.TryParse(AgentID, out _userid)) { model.UserID = _userid; } } if (!string.IsNullOrEmpty(AgentNum)) { model.AgentNum = AgentNum; } if (!string.IsNullOrEmpty(ProjectID)) { int _projectid = 0; if (int.TryParse(ProjectID, out _projectid)) { model.ProjectID = _projectid; } } if (!string.IsNullOrEmpty(BusinessType)) { int _businesstype = 0; if (int.TryParse(BusinessType, out _businesstype)) { model.BusinessType = _businesstype; } } else {//默认是其他任务 model.BusinessType = 4; } if (!string.IsNullOrEmpty(StartTime) && !string.IsNullOrEmpty(EndTime)) { DateTime _begintime = DateTime.Now; DateTime.TryParse(StartTime, out _begintime); DateTime _endtime = DateTime.Now; DateTime.TryParse(EndTime, out _endtime); model.BeginTime = _begintime; model.EndTime = _endtime; } int userID = BLL.Util.GetLoginUserID(); DataTable dt1 = BLL.ProjectInfo.Instance.GetB_ProjectReportSum(model, userID); if (dt1 != null && dt1.Rows.Count > 0) { string projectname = string.Empty; projectname = dt1.Rows[0]["projectname"].ToString(); string assigncount = string.Empty; assigncount = dt1.Rows[0]["assigncount"] == DBNull.Value ? "-" : dt1.Rows[0]["assigncount"].ToString(); string tjcount = string.Empty; tjcount = dt1.Rows[0]["tjcount"] == DBNull.Value ? "0" : dt1.Rows[0]["tjcount"].ToString(); string jtcount = string.Empty; jtcount = dt1.Rows[0]["jtcount"] == DBNull.Value ? "0" : dt1.Rows[0]["jtcount"].ToString(); string successcount = string.Empty; successcount = dt1.Rows[0]["successcount"] == DBNull.Value ? "0" : dt1.Rows[0]["successcount"].ToString(); string wjtcount = string.Empty; wjtcount = dt1.Rows[0]["wjtcount"] == DBNull.Value ? "0" : dt1.Rows[0]["wjtcount"].ToString(); string jtfailcount = string.Empty; jtfailcount = dt1.Rows[0]["jtfailcount"] == DBNull.Value ? "0" : dt1.Rows[0]["jtfailcount"].ToString(); string jtlv = string.Empty; jtlv = BLL.Util.ProduceLv(jtcount, tjcount); string cglv = string.Empty; cglv = BLL.Util.ProduceLv(successcount, jtcount); msg = "{\"projectname\":\"" + projectname + "\",\"assigncount\":\"" + assigncount + "\",\"tjcount\":\"" + tjcount + "\",\"jtcount\":\"" + jtcount + "\",\"successcount\":\"" + successcount + "\",\"wjtcount\":\"" + wjtcount + "\",\"jtfailcount\":\"" + jtfailcount + "\",\"jtlv\":\"" + jtlv + "\",\"cglv\":\"" + cglv + "\"}"; } }
private DataTable BindData() { QueryProjectReport model = new QueryProjectReport(); if (!string.IsNullOrEmpty(AgentID)) { int _userid = 0; if (int.TryParse(AgentID, out _userid)) { model.UserID = _userid; } } if (!string.IsNullOrEmpty(AgentNum)) { model.AgentNum = AgentNum; } if (!string.IsNullOrEmpty(ProjectID)) { int _projectid = 0; if (int.TryParse(ProjectID, out _projectid)) { model.ProjectID = _projectid; } } if (!string.IsNullOrEmpty(BusinessType)) { int _businesstype = 0; if (int.TryParse(BusinessType, out _businesstype)) { model.BusinessType = _businesstype; } } else {//默认是其他任务 model.BusinessType = 4; } if (!string.IsNullOrEmpty(StartTime) && !string.IsNullOrEmpty(EndTime)) { DateTime _begintime = DateTime.Now; DateTime.TryParse(StartTime, out _begintime); DateTime _endtime = DateTime.Now; DateTime.TryParse(EndTime, out _endtime); model.BeginTime = _begintime; model.EndTime = _endtime; } else { DateTime _begintime = DateTime.Now; DateTime.TryParse(ProjectTime, out _begintime); model.BeginTime = Convert.ToDateTime(_begintime.ToString("yyyy-MM-dd")); model.EndTime = Convert.ToDateTime(DateTime.Now.ToString("yyyy-MM-dd")); } DataTable dt = null; int count = 0; dt = BLL.ProjectInfo.Instance.GetB_ProjectReport_Excel(model, userID); DataTable dt1 = BLL.ProjectInfo.Instance.GetB_ProjectReportSum_Excel(model, userID); if (dt != null) { dt.Columns.RemoveAt(0); dt.Columns.RemoveAt(2); dt.Columns.RemoveAt(4); } if (dt != null && dt.Rows.Count > 0) { count = dt.Rows.Count; for (int i = 0; i < dt.Rows.Count; i++) { DataRow row = dt.Rows[i]; row["assigncount"] = row["assigncount"] == DBNull.Value ? "0" : row["assigncount"]; row["tjcount"] = row["tjcount"] == DBNull.Value ? "0" : row["tjcount"]; row["jtcount"] = row["jtcount"] == DBNull.Value ? "0" : row["jtcount"]; row["successcount"] = row["successcount"] == DBNull.Value ? "0" : row["successcount"]; row["jtlv"] = BLL.Util.ProduceLv(row["jtcount"].ToString(), row["tjcount"].ToString()); row["cglv"] = BLL.Util.ProduceLv(row["successcount"].ToString(), row["jtcount"].ToString()); for (int m = 9; m < dt.Columns.Count; m++) { row[m] = row[m] == DBNull.Value ? "0" : row[m]; } } } if (dt1 != null && dt1.Rows.Count > 0) { dt1.Columns.RemoveAt(0); dt1.Columns.RemoveAt(2); if (dt != null) { DataRow row = dt.NewRow(); row["TrueName"] = "合计(共" + count + "项)"; row["agentnum"] = "-"; row["ProjectName"] = dt1.Rows[0]["projectname"].ToString(); row["assigncount"] = dt1.Rows[0]["assigncount"] == DBNull.Value ? "0" : dt1.Rows[0]["assigncount"]; row["tjcount"] = dt1.Rows[0]["tjcount"] == DBNull.Value ? "0" : dt1.Rows[0]["tjcount"]; row["jtcount"] = dt1.Rows[0]["jtcount"] == DBNull.Value ? "0" : dt1.Rows[0]["jtcount"]; row["successcount"] = dt1.Rows[0]["successcount"] == DBNull.Value ? "0" : dt1.Rows[0]["successcount"]; row["jtlv"] = BLL.Util.ProduceLv(row["jtcount"].ToString(), row["tjcount"].ToString()); row["cglv"] = BLL.Util.ProduceLv(row["successcount"].ToString(), row["jtcount"].ToString()); for (int m = 7; m < dt1.Columns.Count; m++) { dt1.Rows[0][m] = dt1.Rows[0][m] == DBNull.Value ? "0" : dt1.Rows[0][m]; row[m + 2] = dt1.Rows[0][m]; } dt.Rows.Add(row); } } return(dt); }