/// <summary> /// 初始化数据 /// </summary> private void IntoData() { BIndividual bllBIndividual = new BIndividual(); #region 初始化修改实体 string memoid = Utils.GetQueryStringValue("Id"); hidid.Value = memoid; if (!string.IsNullOrEmpty(memoid)) { MMemo modelMMemo = new MMemo(); modelMMemo = bllBIndividual.GetMemo(Utils.GetInt(memoid)); if (modelMMemo != null) { txtMemoTitle.Text = modelMMemo.MemoTitle; txtMemoTime.Text = modelMMemo.MemoTime.ToShortDateString(); txtMemoText.Text = modelMMemo.MemoText; dropMemoState.SelectedValue = ((int)modelMMemo.MemoState).ToString(); dropMemoUrgent.SelectedValue = ((int)modelMMemo.UrgentType).ToString(); } } #endregion #region 绑定列表 IList <MMemo> list = bllBIndividual.GetMemoLst(0, SiteUserInfo.UserId, Utils.GetDateTimeNullable(hidstart.Value), Utils.GetDateTimeNullable(hidstart.Value)); if (list != null && list.Count > 0) { rptList.DataSource = list; rptList.DataBind(); } #endregion }
/// <summary> /// 获取备忘事件数量 /// </summary> private void GetMemoCount() { string result = ""; string stardate = Utils.GetQueryStringValue("argument"); BIndividual bllBIndividual = new BIndividual(); if (!string.IsNullOrEmpty(stardate)) { //获取当前一个月里面的所有备忘录 IList <MMemo> list = bllBIndividual.GetMemoLst(10, SiteUserInfo.UserId, Utils.GetDateTimeNullable(Utils.GetDateTime(stardate).ToShortDateString()), Utils.GetDateTimeNullable(Utils.GetDateTime(stardate).ToShortDateString())); if (list != null && list.Count > 0) { string str = Utils.GetDateTime(stardate).ToShortDateString() + ",您有" + list.Count + "条事件:"; foreach (MMemo item in list) { str += "<a href='../UserCenter/Memo/MemoInfo.aspx?Id=" + item.Id + "' class='ck_date' title=" + item.MemoTitle + ">" + Utils.GetText2(item.MemoTitle, 15, true) + "</a>"; } result = UtilsCommons.AjaxReturnJson("true", str); } else { result = UtilsCommons.AjaxReturnJson("false", "数量为空"); } } else { result = UtilsCommons.AjaxReturnJson("false", "参数为空"); } Response.Clear(); Response.Write(result); Response.End(); }
private void IntoDate() { #region 待处理事项 BIndividual bllBIndividual = new BIndividual(); IList <MMemo> listMMemo = bllBIndividual.GetMemoLst(6, SiteUserInfo.UserId, null, null); if (listMMemo != null && listMMemo.Count > 0) { rptFirst.DataSource = listMMemo; rptFirst.DataBind(); } else { lblMsgFirst.Text = "暂无数据"; } #endregion #region 订单提醒 pageIndex = Utils.GetInt(Utils.GetQueryStringValue("page"), 1); IList <MOrderRemind> listMOrderRemind = bllBIndividual.GetOrderRemindLst(pageSize, pageIndex, ref recordCount, SiteUserInfo.UserId, SiteUserInfo.CompanyId); if (listMOrderRemind != null && listMOrderRemind.Count > 0) { this.rptSecond.DataSource = listMOrderRemind; this.rptSecond.DataBind(); this.ExporPageInfoSelect1.PageLinkURL = Request.ServerVariables["SCRIPT_NAME"].ToString() + "?"; this.ExporPageInfoSelect1.UrlParams = Request.QueryString; this.ExporPageInfoSelect1.intPageSize = pageSize; this.ExporPageInfoSelect1.CurrencyPage = pageIndex; this.ExporPageInfoSelect1.intRecordCount = recordCount; } else { this.ExporPageInfoSelect1.Visible = false; this.lblMsgSecond.Text = "暂无订单数据"; } #endregion #region 公告列表 IList <MNoticeRemind> listMGovNotice = bllBIndividual.GetNoticeRemindLst(5, 1, ref recordCount, SiteUserInfo.UserId, SiteUserInfo.DeptId, SiteUserInfo.CompanyId); if (listMGovNotice != null && listMGovNotice.Count > 0) { rptThird.DataSource = listMGovNotice; rptThird.DataBind(); } else { lblMsgThird.Text = "暂无数据"; } #endregion #region 获取今后两天备忘录 //今天 IList <MMemo> listMMemoToday = bllBIndividual.GetMemoLst( 5, SiteUserInfo.UserId, Utils.GetDateTimeNullable(DateTime.Now.ToShortDateString()), Utils.GetDateTimeNullable(DateTime.Now.ToShortDateString())); IList <MMemo> listMMemoTodayCount = bllBIndividual.GetMemoLst( 0, SiteUserInfo.UserId, Utils.GetDateTimeNullable(DateTime.Now.ToShortDateString()), Utils.GetDateTimeNullable(DateTime.Now.ToShortDateString())); if (listMMemoToday != null && listMMemoToday.Count > 0) { if (listMMemoTodayCount.Count > 5) { litTodayAll.Text = "<span class=\"jsh_text_li\"><a href=\"javascript:void(0)\" onclick=\"AllBoxy('" + DateTime.Now.ToString("M") + "')\">更多</a></span>"; } rptFour.DataSource = listMMemoToday; rptFour.DataBind(); } //明天 IList <MMemo> listMMemoTom = bllBIndividual.GetMemoLst( 1, SiteUserInfo.UserId, Utils.GetDateTimeNullable(DateTime.Now.AddDays(1).ToShortDateString()), Utils.GetDateTimeNullable(DateTime.Now.AddDays(1).ToShortDateString())); IList <MMemo> listMMemoTomCount = bllBIndividual.GetMemoLst( 0, SiteUserInfo.UserId, Utils.GetDateTimeNullable(DateTime.Now.AddDays(1).ToShortDateString()), Utils.GetDateTimeNullable(DateTime.Now.AddDays(1).ToShortDateString())); if (listMMemoTom != null && listMMemoTom.Count > 0) { if (listMMemoTomCount.Count > 1) { litTomorrowAll.Text = "<span class=\"jsh_text_li\"><a href=\"javascript:void(0)\" onclick=\"AllBoxy('" + DateTime.Now.AddDays(1).ToString("M") + "')\">更多</a></span>"; } rptFive.DataSource = listMMemoTom; rptFive.DataBind(); } #endregion }
/// <summary> /// 获取一个月之内的备忘录 /// </summary> private void GetHaveMemoByDate() { string result = ""; string resultDate = ""; string[] arguments = Server.UrlDecode(Utils.GetQueryStringValue("argument")).Split('$'); BIndividual bllBIndividual = new BIndividual(); if (!string.IsNullOrEmpty(arguments[0]) && !string.IsNullOrEmpty(arguments[1])) { IList <MMemo> list = bllBIndividual.GetMemoLst(0, SiteUserInfo.UserId, Utils.GetDateTimeNullable(Utils.GetDateTime(arguments[0]).ToShortDateString()), Utils.GetDateTimeNullable(Utils.GetDateTime(arguments[1]).ToShortDateString())); if (list != null && list.Count > 0) { //定义list 返回日期list List <string> listDate = new List <string>(); list.ToList().ForEach(r => { listDate.Add(r.MemoTime.ToString("M")); }); //linq循环出重复项 而且求出重复出现次数 var retDateCount = from item in listDate //每一项 group item by item into gro //按项分组,没组就是gro orderby gro.Count() descending //按照每组的数量进行排序 select new { num = gro.Key, nums = gro.Count() }; foreach (var item in retDateCount.Take(retDateCount.Count())) { int count = item.nums; foreach (MMemo modelMMemo in list) { if (modelMMemo != null) { if (item.num == modelMMemo.MemoTime.ToString("M")) { if (count == item.nums) { result += "<font class='red'>" + item.num + "</font>,您有<font class='red'>" + item.nums + "</font>条事件:</font></br>"; } result += "<img src='../../Images/icon_05.gif' style='no-repeat left 2px; padding-left: 15px;float: left;' />"; if (modelMMemo.UrgentType == MemoUrgent.紧急) { result += "<p style='text-indent:2px'><a href='../UserCenter/Memo/MemoInfo.aspx?Id=" + modelMMemo.Id + "' class='fontred' data-title=" + item.num + " title=" + MemoUrgent.紧急.ToString() + ":" + modelMMemo.MemoTitle + ">" + Utils.GetText2(modelMMemo.MemoTitle, 7, true) + "</a></br></p>"; } else { result += "<p style='text-indent:2px'><a href='../UserCenter/Memo/MemoInfo.aspx?Id=" + modelMMemo.Id + "' class='ck_date' data-title=" + item.num + " title=" + modelMMemo.MemoTitle + ">" + Utils.GetText2(modelMMemo.MemoTitle, 7, true) + "</a></br></p>"; } count--; //一天的所有记事 循环之后加$ 标记为一个字符串实体 前台js靠这个分隔 if (count == 0) { result += "$"; if (!resultDate.Contains(modelMMemo.MemoTime.ToString("M"))) { resultDate += modelMMemo.MemoTime.ToString("M") + "$"; } } } } } } } } Response.Clear(); Response.Write(UtilsCommons.AjaxReturnJson(resultDate.TrimEnd('$'), result.TrimEnd('$'))); Response.End(); }