Example #1
0
        private void GerneraotrDayLog(string UserId)
        {
            string        tem = @"   <tr class='{0}'>
                                <td align='center'>
                                    {1}
                                </td>
                                <td>
                                    {2}
                                </td>
                                <td align='center'>
                                   {3}
                                </td>
                                <td align='center'>
                                   {4}
                                </td> 
                            </tr>";
            DayLogManager manager = new DayLogManager();
            int           pageCount = 0, recordCount = 0;
            DataTable     dt = manager.GetDataTable(1, 5, DayLog._.UserID == new Guid(Session["UserID"].ToString()), DayLog._.WordDate.Desc, ref pageCount, ref recordCount);
            StringBuilder sb = new StringBuilder();
            int           i  = 1;

            foreach (DataRow item in dt.Rows)
            {
                string temodd = odd_bg;
                if (i % 2 == 0)
                {
                    temodd = "";
                }
                sb.AppendFormat(tem, temodd, i, item["Content"], ((DateTime)item["WordDate"]).ToString("yyyy-MM-dd"), item["GS"]);
            }
            DayLogStr = sb.ToString();
        }
        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "text/plain";
            HttpRequest   rp          = context.Request;
            DayLogManager manager     = new DayLogManager();
            int           currentPage = int.Parse(rp["pagenum"]);
            int           pageSize    = int.Parse(rp["pagesize"]);

            int    count = 0, recordCount = 0;
            string personID = rp["PersonID"];

            WhereClip where = null;

            if (!string.IsNullOrEmpty(personID))
            {
                where = DayLog._.UserID == new Guid(personID);
            }
            else
            if (context.Session["UserID"] != null)
            {
                where = DayLog._.UserID == new Guid(context.Session["UserID"].ToString());
            }

            if (!string.IsNullOrEmpty(context.Request["RQ1"]))
            {
                where.And(DayLog._.CreateDate >= DateTime.Parse(context.Request["RQ1"]));
            }
            if (!string.IsNullOrEmpty(context.Request["RQ2"]))
            {
                where.And(DayLog._.CreateDate < DateTime.Parse(context.Request["RQ2"]).AddDays(1));
            }
            //if (!string.IsNullOrEmpty(context.Session["UserID"] as string))
            //{
            //    where = DayLog._.UserID == new Guid(context.Session["UserID"].ToString());
            //    //new Guid(context.Session["UserID"].ToString());

            //}
            //else
            //{
            //    where = DayLog._.UserID == "";

            //}


            DataTable dt     = manager.GetDataTable(currentPage + 1, pageSize, where, DayLog._.WordDate.Desc, ref count, ref recordCount);
            string    result = JsonConvert.Convert2Json(dt);

            context.Response.Write("{ \"totalRecords\":\"" + recordCount + "\",\"rows\":" + result + "}");
            context.Response.End();
        }