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; } }
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; }