public static string GetList(string TeacherId, string DateType, string DateData, int PageSize, int PageIndex)
        {
            try
            {
                TeacherId = TeacherId.Filter();
                DateType  = DateType.Filter();
                DateData  = DateData.Filter();
                string strWhere = " 1=1 ";
                if (!string.IsNullOrEmpty(TeacherId))
                {
                    strWhere += " AND t.user_id = '" + TeacherId + "'";
                }
                if (!string.IsNullOrEmpty(DateType))
                {
                    switch (DateType)
                    {
                    case "day":
                        strWhere += " and CONVERT(varchar(10),t.open_time,120)='" + DateData + "'";
                        break;

                    case "week":
                        strWhere += " and dbo.f_GetDatePartWeek(CONVERT(varchar(10),t.open_time,120))='" + DateData + "'";
                        break;

                    case "month":
                        strWhere += " and CONVERT(varchar(7),t.open_time,120)='" + DateData + "'";
                        break;
                    }
                }
                DataTable          dt  = new DataTable();
                BLL_visit_client_s bll = new BLL_visit_client_s();
                dt = bll.GetListByPageDetail(strWhere, " t.open_time desc", ((PageIndex - 1) * PageSize + 1), PageIndex * PageSize).Tables[0];
                int           intRecordCount = bll.GetRecordCountDetail(strWhere);
                List <object> listReturn     = new List <object>();
                int           inum           = 1;
                string        temp           = string.Empty;
                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    listReturn.Add(new
                    {
                        num           = ((PageIndex - 1) * PageSize) + inum,
                        TeacherName   = dt.Rows[i]["TeacherName"].ToString(),
                        Resource_Name = dt.Rows[i]["Resource_Name"].ToString().ReplaceForFilter(),
                        open_time     = pfunction.ConvertToLongDateTime(dt.Rows[i]["open_time"].ToString(), "MM-dd HH:mm:ss"),
                        //close_time = pfunction.ConvertToLongDateTime(dt.Rows[i]["close_time"].ToString(), "MM-dd HH:mm:ss"),
                        typeName = (dt.Rows[i]["resource_class"].ToString() == Rc.Common.Config.Resource_ClassConst.云资源) ? "云资源" : "自有资源"
                    });
                    inum++;
                }
                if (inum > 1)
                {
                    return(JsonConvert.SerializeObject(new
                    {
                        err = "null",
                        PageIndex = PageIndex,
                        PageSize = PageSize,
                        TotalCount = intRecordCount,
                        list = listReturn
                    }));
                }
                else
                {
                    return(JsonConvert.SerializeObject(new
                    {
                        err = "暂无数据"
                    }));
                }
            }
            catch (Exception ex)
            {
                return(JsonConvert.SerializeObject(new
                {
                    err = ex.Message.ToString()
                }));
            }
        }
Exemplo n.º 2
0
        public static string GetList(string GradeID, string DateType, string TeacherName, int PageSize, int PageIndex)
        {
            try
            {
                GradeID = GradeID.Filter();
                //ClassID = ClassID.Filter();
                DateType    = DateType.Filter();
                TeacherName = TeacherName.Filter();

                string strWhere = " 1=1 ";
                if (!string.IsNullOrEmpty(GradeID))
                {
                    strWhere += " and TeacherId in ( select userid from VW_UserOnClassGradeSchool where GradeId='" + GradeID + "')";
                }
                //if (!string.IsNullOrEmpty(ClassID))
                //{
                //    strWhere += " AND ClassId = '" + ClassID + "'";
                //}
                if (!string.IsNullOrEmpty(DateType))
                {
                    strWhere += " AND DateType = '" + DateType + "'";
                }
                if (!string.IsNullOrEmpty(TeacherName))
                {
                    strWhere += " and TeacherName like '%" + TeacherName + "%' ";
                }

                DataTable          dt  = new DataTable();
                BLL_visit_client_s bll = new BLL_visit_client_s();
                dt = bll.GetListByPageNew(strWhere, " DateData desc,VisitCount_All desc,TeacherName", ((PageIndex - 1) * PageSize + 1), PageIndex * PageSize).Tables[0];
                int           intRecordCount = bll.GetRecordCountNew(strWhere);
                List <object> listReturn     = new List <object>();
                int           inum           = 1;
                string        temp           = string.Empty;
                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    listReturn.Add(new
                    {
                        DateType                 = dt.Rows[i]["DateType"].ToString(),
                        DateData                 = dt.Rows[i]["DateData"].ToString(),
                        TeacherId                = dt.Rows[i]["TeacherId"].ToString(),
                        TeacherName              = dt.Rows[i]["TeacherName"].ToString(),
                        TrueName                 = dt.Rows[i]["TrueName"].ToString(),
                        VisitCount_All           = dt.Rows[i]["VisitCount_All"].ToString(),
                        VisitCount_Cloud         = dt.Rows[i]["VisitCount_Cloud"].ToString(),
                        VisitCount_Own           = dt.Rows[i]["VisitCount_Own"].ToString(),
                        VisitFile_All            = dt.Rows[i]["VisitFile_All"].ToString(),
                        VisitFile_Cloud          = dt.Rows[i]["VisitFile_Cloud"].ToString(),
                        VisitFile_Own            = dt.Rows[i]["VisitFile_Own"].ToString(),
                        TeacherClass             = GetTeacherClass(GradeID, dt.Rows[i]["TeacherId"].ToString()),
                        CreateOwnCount_All       = dt.Rows[i]["CreateOwnCount_All"].ToString(),
                        CreateOwnCount_Plan      = dt.Rows[i]["CreateOwnCount_Plan"].ToString(),
                        CreateOwnCount_TestPaper = dt.Rows[i]["CreateOwnCount_TestPaper"].ToString()
                    });
                    inum++;
                }
                if (inum > 1)
                {
                    return(JsonConvert.SerializeObject(new
                    {
                        err = "null",
                        PageIndex = PageIndex,
                        PageSize = PageSize,
                        TotalCount = intRecordCount,
                        list = listReturn
                    }));
                }
                else
                {
                    return(JsonConvert.SerializeObject(new
                    {
                        err = "暂无数据"
                    }));
                }
            }
            catch (Exception ex)
            {
                return(JsonConvert.SerializeObject(new
                {
                    err = ex.Message.ToString()
                }));
            }
        }