/// <summary> /// 导出到Word中 /// </summary> public void ExportToDoc() { NetUserJournal uJoul = new NetUserJournal(); UserJournal jourlInfo = new UserJournal(); System.Data.DataTable dt = uJoul.GetJournalDataSet(KeyWord, beginSearchDate, endSearchDate, 0, 1, true).Tables[0]; StringBuilder sbXml = new StringBuilder(); string title = string.Empty; if (this.beginTime.Value == this.endTime.Value) { title = this.beginTime.Value + "工作总结内容列表"; } else { title = this.drop_UserList.SelectedItem.Text + "从" + this.beginTime.Value + "到" + this.endTime.Value + "的工作总结内容列表"; } sbXml.Append(title + "\t\t\t\t\n\n\n"); foreach (DataRow row in dt.Rows) { sbXml.Append(row["realName"] + "\t" + Convert.ToDateTime(row["writetime"]).ToString("yyyy-MM-dd") + "\t\n"); sbXml.Append(string.Format("{0}\n\n", row["jourDesc"])); } ExportData.ExportWebData("Word", title, sbXml); }
/// <summary> /// 获取当天日志数据 /// </summary> public void GetJournalList(bool IsSearch) { NetUserJournal uJourl = new NetUserJournal(); UserJournal joul = new UserJournal(); #region 分页判断处理 if (IsSearch) { beginSearchDate = Convert.ToDateTime(this.beginTime.Value).ToString("yyyy-MM-dd"); endSearchDate = Convert.ToDateTime(this.endTime.Value).ToString("yyyy-MM-dd"); KeyWord = this.drop_UserList.SelectedValue;//用户ID } else { if (Request.QueryString["bd"] != null && Request.QueryString["ed"] != null && Request.QueryString["uid"] != null) { KeyWord = Request.QueryString["uid"]; try { beginSearchDate = Convert.ToDateTime(Request.QueryString["bd"]).ToString("yyyy-MM-dd"); endSearchDate = Convert.ToDateTime(Request.QueryString["ed"]).ToString("yyyy-MM-dd"); } catch { beginSearchDate = System.DateTime.Now.AddDays(-1).ToString("yyyy-MM-dd"); endSearchDate = System.DateTime.Now.AddDays(-1).ToString("yyyy-MM-dd"); } } else { //beginSearchDate = System.DateTime.Now.AddDays(-1).ToString("yyyy-MM-dd"); //endSearchDate = System.DateTime.Now.AddDays(-1).ToString("yyyy-MM-dd"); beginSearchDate = Convert.ToDateTime(this.beginTime.Value).ToString("yyyy-MM-dd"); endSearchDate = Convert.ToDateTime(this.endTime.Value).ToString("yyyy-MM-dd"); KeyWord = this.drop_UserList.SelectedValue;//用户ID } } this.beginTime.Value = beginSearchDate; this.endTime.Value = endSearchDate; this.drop_UserList.SelectedValue = KeyWord; int _currentPage = Convert.ToInt32(Request.QueryString["page"]); if (!IsSearch && _currentPage <= 0) { KeyWord = string.Empty; } if (beginSearchDate == endSearchDate) { //KeyWord = string.Empty; tempTitle = beginSearchDate; } else { tempTitle = "从" + beginSearchDate + "到" + endSearchDate; } tempTitle += "总结列表"; int userCount = uJourl.GetJournalFYCount(KeyWord, beginSearchDate, endSearchDate);//获取分页总数 int currentPage = 1; try { currentPage = Convert.ToInt32(Request.QueryString["page"]); if (currentPage > (userCount + PageSize - 1) / PageSize) { currentPage = (userCount + PageSize - 1) / PageSize; } if (currentPage <= 0) { currentPage = 1; } } catch { currentPage = 1; } #endregion DataSet ds = uJourl.GetJournalDataSet(KeyWord, beginSearchDate, endSearchDate, PageSize, currentPage, false); if (ds != null) { int uCount = ds.Tables[0].Rows.Count; HtmlTableRow hrow = null; string today = System.DateTime.Now.ToString("yyyy-MM-dd"); hrow = new HtmlTableRow(); HtmlTableCell cel1 = GetHCell("提交人", true); cel1.Width = "70"; hrow.Cells.Add(cel1); hrow.Cells.Add(GetHCell("总结内容", true)); if (beginSearchDate == today) { HtmlTableCell cel2 = GetHCell("操作", true); cel2.Width = "125"; hrow.Cells.Add(cel2); } //else //{ // HtmlTableCell cel3 = GetHCell("提交日期", true); // cel3.Width = "125"; // hrow.Cells.Add(cel3); //} tbl_list.Rows.Add(hrow); if (uCount > 0) { string tempOpreator = string.Empty; for (int j = 0; j < uCount; j++) { hrow = new HtmlTableRow(); int tempBH = (currentPage - 1) * PageSize + j + 1; //hrow.Cells.Add(GetHCell(tempBH.ToString()));//编号 hrow.Cells.Add(GetHCell(ds.Tables[0].Rows[j]["realName"].ToString(), false));//真实姓名 //string tempDesc = commonFun.GetContentSummary(ds.Tables[0].Rows[j][3].ToString(), 40, true); //hrow.Cells.Add(GetHCell(ds.Tables[0].Rows[j][4].ToString()));//写入时间 tempOpreator = string.Empty; string tempEval = ""; if (!string.IsNullOrEmpty(ds.Tables[0].Rows[j]["evalContent"].ToString())) { tempEval += "<div id='div_EvalContent'><span id='sp_pjtitle" + tempBH + "'>总结小评:</span><span id='sp_tempPj" + tempBH + "'>" + commonFun.replaceStr(ds.Tables[0].Rows[j]["evalContent"].ToString()) + "</span></div>"; } else { tempEval += "<div id='div_EvalContent'><span id='sp_pjtitle" + tempBH + "' style='display:none;'>总结小评:</span><span id='sp_tempPj" + tempBH + "'>" + commonFun.replaceStr(ds.Tables[0].Rows[j]["evalContent"].ToString()) + "</span></div>"; } //tempOpreator = "<a href=\"javascript:void(0);\" name=\"view\" onclick=\"showDiv('" + ds.Tables[0].Rows[j][0].ToString() + "','0','" + tempBH + "')\">查看详细</a>"; if (beginSearchDate == today) { string tempDesc = commonFun.replaceStr(ds.Tables[0].Rows[j][3].ToString()); hrow.Cells.Add(GetHCell("<div style='text-align:left;line-height:22px;padding-left:5px;' id='div_tempContent" + tempBH + "'>" + tempDesc + "</div>" + tempEval + "<div style='padding-top:5px;font-size:14px;text-align:left;padding-left:5px;'><span style='color:red;' onclick=\"setTxt('div_tempContent" + tempBH + "')\">[复制]</span><span style='color:red;padding-left:10px;padding-right:10px;'><a href=\"javascript:void(0);\" onclick=\"showEvalDiv('" + ds.Tables[0].Rows[j][0].ToString() + "','" + tempBH + "')\">评论</a></span>提交日期:" + Convert.ToDateTime(ds.Tables[0].Rows[j][4].ToString()).ToString("yyyy/MM/dd H:mm") + "</div>", false));//总结描述 tempOpreator += " <a href=\"javascript:void(0);\" onclick=\"showDiv('" + ds.Tables[0].Rows[j][0].ToString() + "','1','" + tempBH + "')\">修改</a>"; tempOpreator += " <a href=\"javascript:void(0);\" onclick=\"deldata('" + ds.Tables[0].Rows[j][0].ToString() + "','" + ds.Tables[0].Rows[j][1].ToString() + "')\">删除</a>"; //tempOpreator += " <a href=\"javascript:void(0);\" onclick=\"evaldata('" + ds.Tables[0].Rows[j][0].ToString() + "','" + ds.Tables[0].Rows[j][1].ToString() + "')\">评论</a>"; hrow.Cells.Add(GetHCell(tempOpreator, false));//操作内容 } else { string tempDesc = commonFun.replaceStr(ds.Tables[0].Rows[j][3].ToString()); hrow.Cells.Add(GetHCell("<div style='text-align:left;line-height:22px;padding-left:10px;' id='div_tempContent" + tempBH + "'>" + tempDesc + "</div>" + tempEval + "<div style='padding-top:5px;text-align:left;padding-left:5px;'><span style='padding-left:5px;color:red;' onclick=\"setTxt('div_tempContent" + tempBH + "')\">[复制]</span><span style='color:red;padding-left:10px;padding-right:10px;'><a href=\"javascript:void(0);\" onclick=\"showEvalDiv('" + ds.Tables[0].Rows[j][0].ToString() + "','" + tempBH + "')\">评论</a></span>提交日期:" + Convert.ToDateTime(ds.Tables[0].Rows[j][4].ToString()).ToString("yyyy/MM/dd H:mm") + "</div>", false));//总结描述 //tempOpreator = Convert.ToDateTime(ds.Tables[0].Rows[j][4].ToString()).ToString("yyyy/MM/dd hh:mm"); //hrow.Cells.Add(GetHCell(tempOpreator, false));//操作内容 } tbl_list.Rows.Add(hrow); } } else { hrow = new HtmlTableRow(); string tempNo = "温馨提示:没有总结信息!"; HtmlTableCell cell = GetHCell(tempNo, false); if (beginSearchDate == today) { cell.Attributes.Add("colspan", "3"); } else { cell.Attributes.Add("colspan", "2"); } hrow.Cells.Add(cell); tbl_list.Rows.Add(hrow); } } string parms = "&bd=" + beginSearchDate + "&ed=" + endSearchDate + "&uid=" + KeyWord; GetPage(userCount, PageSize, currentPage, parms);//获取分页文字 }
/// <summary> /// 获取信息 /// </summary> /// <param name="isSearch"></param> public void GetInfoList(bool isSearch) { NetUserJournal uJourl = new NetUserJournal(); UserJournal joul = new UserJournal(); #region 分页处理 if (this.beginTime.Value.Trim() == "" || this.endTime.Value.Trim() == "") { this.endTime.Value = System.DateTime.Now.ToString("yyyy-MM-dd"); this.beginTime.Value = System.DateTime.Now.AddDays(-6).ToString("yyyy-MM-dd"); } if (isSearch) { beginSearchDate = Convert.ToDateTime(this.beginTime.Value).ToString("yyyy-MM-dd"); endSearchDate = Convert.ToDateTime(this.endTime.Value).ToString("yyyy-MM-dd"); UserId = this.drop_UserList.SelectedValue; } else { if (Request.QueryString["bd"] != null && Request.QueryString["ed"] != null) { try { beginSearchDate = Convert.ToDateTime(Request.QueryString["bd"]).ToString("yyyy-MM-dd"); endSearchDate = Convert.ToDateTime(Request.QueryString["ed"]).ToString("yyyy-MM-dd"); } catch { beginSearchDate = System.DateTime.Now.AddDays(-1).ToString("yyyy-MM-dd"); endSearchDate = System.DateTime.Now.AddDays(-1).ToString("yyyy-MM-dd"); } } else { beginSearchDate = Convert.ToDateTime(this.beginTime.Value).ToString("yyyy-MM-dd"); endSearchDate = Convert.ToDateTime(this.endTime.Value).ToString("yyyy-MM-dd"); } } this.beginTime.Value = beginSearchDate; this.endTime.Value = endSearchDate; int userCount = uJourl.GetJournalFYCount(UserId, beginSearchDate, endSearchDate);//获取分页总数 int currentPage = 1; try { if (!isSearch) { currentPage = Convert.ToInt32(Request.QueryString["page"]); if (currentPage > (userCount + PageSize - 1) / PageSize) { currentPage = (userCount + PageSize - 1) / PageSize; } if (currentPage <= 0) { currentPage = 1; } } } catch { currentPage = 1; } #endregion if (beginSearchDate == endSearchDate) { tempTitle = beginSearchDate; } else { tempTitle = "从" + beginSearchDate + "到" + endSearchDate; } tempTitle += " [" + this.drop_UserList.SelectedItem.Text + "] 的总结列表"; DataSet ds = uJourl.GetJournalDataSet(UserId, beginSearchDate, endSearchDate, PageSize, currentPage, false); HtmlTableRow hrow = null; if (ds != null) { int uCount = ds.Tables[0].Rows.Count; if (uCount > 0) { for (int i = 0; i < uCount; i++) { hrow = new HtmlTableRow(); string tempEval = ""; hrow.Attributes.Add("class", "tr_row1"); string time = ds.Tables[0].Rows[i]["writetime"].ToString(); hrow.Cells.Add(GetHCell("<div class='posttitle' style='text-align:left;'>日期:" + Convert.ToDateTime(time).ToString("yyyy/MM/dd H:mm") + "<span style='padding-left:30px;'>" + commonFun.getDate(time) + "</span></div>", false)); tbl_list.Rows.Add(hrow); hrow = new HtmlTableRow(); if (!string.IsNullOrEmpty(ds.Tables[0].Rows[i]["evalContent"].ToString())) { tempEval += "<div id='div_EvalContent'><div>总结小评:" + commonFun.replaceStr(ds.Tables[0].Rows[i]["evalContent"].ToString()) + "</div></div>"; } hrow.Cells.Add(GetHCell("<div style='text-align:left;padding-left:20px;padding-top:5px;'>" + commonFun.replaceStr(ds.Tables[0].Rows[i]["jourDesc"].ToString()) + "</div>" + tempEval, false)); tbl_list.Rows.Add(hrow); } } else { hrow = new HtmlTableRow(); string tempNo = "温馨提示:没有总结信息!"; HtmlTableCell cell = GetHCell(tempNo, false); hrow.Cells.Add(cell); tbl_list.Rows.Add(hrow); } } string parms = "&bd=" + beginSearchDate + "&ed=" + endSearchDate + "&uid=" + UserId; GetPage(userCount, PageSize, currentPage, parms);//获取分页文字 }