private void GetReturnVisitSum(out string msg) { msg = string.Empty; QueryReturnVisitReport model = new QueryReturnVisitReport(); 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(BGID)) { int _bgid = 0; if (int.TryParse(BGID, out _bgid)) { model.BGID = _bgid; } } if (!string.IsNullOrEmpty(Year)) { int _year = 0; if (int.TryParse(Year, out _year)) { model.Year = _year; } } if (!string.IsNullOrEmpty(Month)) { int _month = 0; if (int.TryParse(Month, out _month)) { model.Month = _month; } } DataTable dt1 = BLL.ProjectInfo.Instance.GetB_ReturnVisitReportSum(model); if (dt1 != null && dt1.Rows.Count > 0 && dt1.Rows[0]["hfcount"] != DBNull.Value) { string dyfzmembercount = "0"; string hfmembercount = "0"; string hfcount = "0"; string wjtcount = "0"; string fglv = string.Empty; dyfzmembercount = dt1.Rows[0]["dyfzmembercount"] == DBNull.Value ? "0" : dt1.Rows[0]["dyfzmembercount"].ToString(); hfmembercount = dt1.Rows[0]["hfmembercount"] == DBNull.Value ? "0" : dt1.Rows[0]["hfmembercount"].ToString(); fglv = BLL.Util.ProduceLv(hfmembercount, dyfzmembercount); hfcount = dt1.Rows[0]["hfcount"] == DBNull.Value ? "0" : dt1.Rows[0]["hfcount"].ToString(); wjtcount = dt1.Rows[0]["wjtcount"] == DBNull.Value ? "0" : dt1.Rows[0]["wjtcount"].ToString(); msg = "{\"dyfzmembercount\":\"" + dyfzmembercount + "\",\"hfmembercount\":\"" + hfmembercount + "\",\"hfcount\":\"" + hfcount + "\",\"wjtcount\":\"" + wjtcount + "\",\"fglv\":\"" + fglv + "\"}"; } }
private DataTable BindData() { QueryReturnVisitReport model = new QueryReturnVisitReport(); 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(BGID)) { int _bgid = 0; if (int.TryParse(BGID, out _bgid)) { model.BGID = _bgid; } } if (!string.IsNullOrEmpty(Year)) { int _year = 0; if (int.TryParse(Year, out _year)) { model.Year = _year; } } if (!string.IsNullOrEmpty(Month)) { int _month = 0; if (int.TryParse(Month, out _month)) { model.Month = _month; } } DataTable dt = null; int count = 0; dt = BLL.ProjectInfo.Instance.GetB_ReturnVisitReport_ForExcel(model); //DataTable dt1 = BLL.ProjectInfo.Instance.GetB_ReturnVisitReportSum_ForExcel(model); int sumdyfzmembercount = 0; int sumhfmembercount = 0; if (dt != null && dt.Rows.Count > 0) { int[] a = new int[dt.Columns.Count - 5]; count = dt.Rows.Count; for (int i = 0; i < dt.Rows.Count; i++) { DataRow row = dt.Rows[i]; row["dyfzmembercount"] = row["dyfzmembercount"] == DBNull.Value ? "0" : row["dyfzmembercount"]; row["hfmembercount"] = row["hfmembercount"] == DBNull.Value ? "0" : row["hfmembercount"]; sumdyfzmembercount += int.Parse(row["dyfzmembercount"].ToString()); sumhfmembercount += int.Parse(row["hfmembercount"].ToString()); row["fglv"] = BLL.Util.ProduceLv(row["hfmembercount"].ToString(), row["dyfzmembercount"].ToString()); for (int m = 5; m < dt.Columns.Count; m++) { row[m] = row[m] == DBNull.Value ? "0" : row[m]; a[m - 5] += int.Parse(row[m].ToString()); } } DataRow row1 = dt.NewRow(); row1["TrueName"] = "合计(共" + count + "项)"; row1["agentnum"] = "-"; row1["dyfzmembercount"] = sumdyfzmembercount; row1["hfmembercount"] = sumhfmembercount; row1["fglv"] = BLL.Util.ProduceLv(sumhfmembercount.ToString(), sumdyfzmembercount.ToString()); for (int m = 0; m < dt.Columns.Count - 5; m++) { row1[m + 5] = a[m]; } dt.Rows.Add(row1); } return(dt); }
private void BindData() { QueryReturnVisitReport model = new QueryReturnVisitReport(); 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(BGID)) { int _bgid = 0; if (int.TryParse(BGID, out _bgid)) { model.BGID = _bgid; } } if (!string.IsNullOrEmpty(Year)) { int _year = 0; if (int.TryParse(Year, out _year)) { model.Year = _year; } } if (!string.IsNullOrEmpty(Month)) { int _month = 0; if (int.TryParse(Month, out _month)) { model.Month = _month; } } DataTable dt = null; int count = 0; dt = BLL.ProjectInfo.Instance.GetB_ReturnVisitReport(model, " ", BLL.PageCommon.Instance.PageIndex, PageSize, out count); //DataTable dt1 = BLL.ProjectInfo.Instance.GetB_ReturnVisitReportSum(model); if (dt != null && dt.Rows.Count > 0) { for (int i = 0; i < dt.Rows.Count; i++) { DataRow row = dt.Rows[i]; row["dyfzmembercount"] = row["dyfzmembercount"] == DBNull.Value ? "0" : row["dyfzmembercount"]; row["hfmembercount"] = row["hfmembercount"] == DBNull.Value ? "0" : row["hfmembercount"]; row["fglv"] = BLL.Util.ProduceLv(row["hfmembercount"].ToString(), row["dyfzmembercount"].ToString()); row["hfcount"] = row["hfcount"] == DBNull.Value ? "0" : row["hfcount"]; row["wjtcount"] = row["wjtcount"] == DBNull.Value ? "0" : row["wjtcount"]; } } repeaterTableList.DataSource = dt; repeaterTableList.DataBind(); this.litPagerDown.Text = BLL.PageCommon.Instance.LinkStringByPost(BLL.Util.GetUrl(), GroupLength, count, PageSize, BLL.PageCommon.Instance.PageIndex, 1); }