private void GetNoWriteList() { DateTime _begin = DateTime.Today.AddDays(-DateTime.Today.Day + 1); DateTime _end = DateTime.Today.AddDays(-1); NetUserJournal _net = new NetUserJournal(); List <DateTime> _noWriteDateList = _net.GetNoWriteDateList(_begin.ToString("yyyy-MM-dd"), _end.ToString("yyyy-MM-dd"), int.Parse(UserId)); this.lbl_noWriteCount.Text = _noWriteDateList.Count.ToString(); if (_noWriteDateList.Count == 0) { this.div_noWriteDate.Visible = false; } else { StringBuilder _strDateList = new StringBuilder("具体日期是:"); foreach (DateTime _date in _noWriteDateList) { _strDateList.Append(_date.ToString("yyyy-M-d") + ","); } _strDateList = _strDateList.Remove(_strDateList.Length - 1, 1); _strDateList = _strDateList.Append(" 。"); this.TD_noWriteList.InnerHtml = _strDateList.ToString(); this.div_noWriteDate.Visible = true; } }
/// <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 GetTodayContent() { //string uid = string.Empty; string tempTime = System.DateTime.Now.ToString("yyyy-MM-dd"); NetUserJournal uJourl = new NetUserJournal(); UserJournal joulInfo = new UserJournal(); joulInfo = uJourl.GetNetUserInfoByIds(UserId, tempTime); if (joulInfo != null) { this.txt_desc.Value = joulInfo.JourDesc; hid_isHave.Value = joulInfo.JourID.ToString();//有值 btn_Add.Enabled = false; btn_reset.Disabled = true; txt_desc.Disabled = true; } else { btn_Add.Enabled = true; btn_reset.Disabled = false; txt_desc.Disabled = false; hid_isHave.Value = "0";//没有值 } }
/// <summary> /// 获取数据信息 /// </summary> /// <param name="jid"></param> public void GetData(string jid) { NetUserJournal nJourl = new NetUserJournal(); UserJournal uInfo = new UserJournal(); uInfo = nJourl.GetNetUserInfo(jid); if (uInfo != null) { this.txt_EvalDesc.Value = uInfo.EvalContent; } }
public string ModifySingleJournal(string jid, string content) { NetUserJournal uJourl = new NetUserJournal(); if (uJourl.UpdateUserEval(content, jid)) { return(content); } else { return("0"); } }
/// <summary> /// 删除数据 /// </summary> /// <param name="jid"></param> /// <param name="uid"></param> /// <returns></returns> public string DeleteJournal(string jid, string uid) { NetUserJournal uJourl = new NetUserJournal(); if (uJourl.Delete(uid, jid)) { return("1"); } else { return("0"); } }
/// <summary> /// 修改总结内容 /// </summary> /// <param name="jid"></param> /// <param name="content"></param> /// <returns></returns> public string ModifyJournal(string jid, string content) { NetUserJournal uJourl = new NetUserJournal(); string writetime = System.DateTime.Now.ToString("yyyy-MM-dd"); if (uJourl.UpdateSome(content, jid, writetime)) { return(content); } else { return("0"); } }
/// <summary> /// 获取总结详细 /// </summary> /// <param name="jid"></param> /// <returns></returns> public string GetJoulnalDetail(string jid, string isEdit) { UserJournal jInfo = new UserJournal(); NetUserJournal uJourl = new NetUserJournal(); if (isEdit == "1") { return(uJourl.GetNetUserInfo(jid).JourDesc); } else { return("<p>" + commonFun.replaceStr(uJourl.GetNetUserInfo(jid).JourDesc) + "</p>"); } }
/// <summary> /// 添加日志内容 /// </summary> public void addJoual() { NetUserJournal uJoul = new NetUserJournal(); UserJournal joulInfo = new UserJournal(); joulInfo.JourDesc = this.txt_desc.Value; joulInfo.UserName = ""; joulInfo.UserID = int.Parse(Session["userid"].ToString()); joulInfo.WriteTime = System.DateTime.Now; joulInfo.ModifyTime = System.DateTime.Now; System.Threading.Thread.Sleep(1000); if (uJoul.Insert(joulInfo)) { string tempStr = ""; tempStr += "<script>"; tempStr += "location='?uid=" + Session["userid"].ToString() + "';";; tempStr += "</script>"; Page.ClientScript.RegisterStartupScript(this.GetType(), "startup", tempStr); } }
/// <summary> /// 未写人名单 /// </summary> public void GetNoWrite(DateTime pTime) { string time = pTime.ToString("yyyy-MM-dd"); NetUserJournal netJourl = new NetUserJournal(); List <string> _noWriteNameList = netJourl.GetNoWriteList(ref time); int _noCount = _noWriteNameList.Count; if (_noCount > 0) { string tempNoPerson = "<span style='color:red;'>"; this.div_noWriteTitle.InnerHtml = time + " 未写总结名单如下: 共" + _noCount + "个"; for (int i = 0; i < _noCount; i++) { tempNoPerson += _noWriteNameList[i].ToString() + " "; } tempNoPerson += "</span>"; this.div_NoWrite.InnerHtml = tempNoPerson; } this.beginTime.Value = time; this.endTime.Value = time; }
protected void btn_ShowNoWrite_Click(object sender, EventArgs e) { this.btn_Export.Enabled = false; this.div_NoWrite.Visible = true; this.div_noWriteTitle.Visible = true; string _beginTime = this.beginTime.Value.Trim(); string _endTime = this.endTime.Value.Trim(); string _userId = this.drop_UserList.SelectedValue.Trim(); string _userName = this.drop_UserList.SelectedItem.Text.Trim(); NetUserJournal _netJourl = new NetUserJournal(); if (_userId == "-1") { List <NoWritePersonInfo> _noWrit_List = _netJourl.GetNoWriteDateList(_beginTime, _endTime); int _noWriteCount = _noWrit_List.Count; int _totalCount = 0; //if (_noWriteCount == 0) //{ // string _title = "<span style='font-weight:bold;font-size:small;'>本段时间内没有人缺写总结!</span>"; // this.div_noWriteTitle.InnerHtml = _title; // this.div_NoWrite.InnerHtml = string.Empty; //} //else //{ if (_noWriteCount > 0) { HtmlTableRow hrow = null; hrow = new HtmlTableRow(); HtmlTableCell _cel1 = GetHCell("人员", true); _cel1.Width = "100"; hrow.Cells.Add(_cel1); HtmlTableCell _cell2 = GetHCell("未写次数", true); _cell2.Width = "100"; hrow.Cells.Add(_cell2); HtmlTableCell _cell3 = GetHCell("具体日期", true); _cell3.Width = "600"; hrow.Cells.Add(_cell3); tbl_list.Rows.Add(hrow); foreach (NoWritePersonInfo _person in _noWrit_List) { _totalCount += _person.NoWriteCount; hrow = new HtmlTableRow(); HtmlTableCell _ce1 = GetHCell(_person.RealName, false); HtmlTableCell _ce2 = GetHCell(_person.NoWriteCount.ToString(), false); string _dateListstring = "<div style='text-align:left;'>" + _person.NoWriteDate + "</div>"; HtmlTableCell _ce3 = GetHCell(_dateListstring, false); hrow.Cells.Add(_ce1); hrow.Cells.Add(_ce2); hrow.Cells.Add(_ce3); this.tbl_list.Rows.Add(hrow); } } string _title = "<span style='font-weight:bold;font-size:small;'><span style='color:red;'></span>在 " + _beginTime + " 至 " + _endTime + " 时间段内所有人未写总结共 <span style='color:red;'>" + _totalCount + " </span>次</span> <br />"; this.div_noWriteTitle.InnerHtml = _title; this.div_NoWrite.InnerHtml = string.Empty; //} } else { List <DateTime> _noWriteList = _netJourl.GetNoWriteDateList(_beginTime, _endTime, int.Parse(_userId)); int _noWriteCount = _noWriteList.Count; string _title = "<span style='font-weight:bold;font-size:small;'><span style='color:red;'>" + _userName + "</span>在 " + _beginTime + " 至 " + _endTime + " 时间段内未写总结共 <span style='color:red;'>" + _noWriteCount + " </span>次</span> <br />"; StringBuilder _strDateList = new StringBuilder(); if (_noWriteCount > 0) { _strDateList = _strDateList.Append("<span style='color:#3300ff;'>具体日期是:"); foreach (DateTime _date in _noWriteList) { _strDateList = _strDateList.Append(_date.ToString("yyyy-M-d") + ","); } _strDateList = _strDateList.Remove(_strDateList.Length - 1, 1); _strDateList = _strDateList.Append(" 。</span>"); } this.div_noWriteTitle.InnerHtml = _title; this.div_NoWrite.InnerHtml = _strDateList.ToString(); this.tbl_list.Rows.Add(new HtmlTableRow()); } this.tbl_td_page.Visible = false; }
/// <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);//获取分页文字 }