コード例 #1
0
        public static string share(string ResourceToResourceFolder_Id)
        {
            Rc.Model.Resources.Model_F_User FloginUser = Rc.Common.StrUtility.clsUtility.IsFPageFlag() as Rc.Model.Resources.Model_F_User;
            try
            {
                string    strsql = "select distinct(SchoolId) from dbo.VW_UserOnClassGradeSchool where UserId='" + FloginUser.UserId + "' and SchoolId<>''";
                DataTable dt     = Rc.Common.DBUtility.DbHelperSQL.Query(strsql).Tables[0];

                Model_ResourceShare rs = new Model_ResourceShare();
                rs.ResourceShareId             = Guid.NewGuid().ToString();
                rs.ResourceToResourceFolder_Id = ResourceToResourceFolder_Id;
                rs.ShareObjectId = dt.Rows.Count > 0 ? dt.Rows[0]["SchoolId"].ToString() : "";
                rs.CreateUserId  = FloginUser.UserId;
                rs.CreateTime    = DateTime.Now;

                Model_ResourceToResourceFolder rtr    = new Model_ResourceToResourceFolder();
                BLL_ResourceToResourceFolder   rtrbll = new BLL_ResourceToResourceFolder();
                rtr = rtrbll.GetModel(ResourceToResourceFolder_Id);
                rtr.Resource_shared = "1";
                BLL_ResourceShare bllrs = new BLL_ResourceShare();
                if (bllrs.ShareResource(rs, rtr))
                {
                    return("1");
                }
                else
                {
                    return("");
                }
            }
            catch (Exception)
            {
                return("");
            }
        }
コード例 #2
0
ファイル: DAL_F_User.cs プロジェクト: a157591984/jiguang
        public bool Add(Rc.Model.Resources.Model_F_User model)
        {
            StringBuilder builder = new StringBuilder();

            builder.Append("insert into F_User(");
            builder.Append("UserId,UserName,Password,TrueName,UserIdentity,Birthday,Sex,Email,Mobile,Province,City,County,School,CreateTime,Stoken,StokenTime,Resource_Version,GradeTerm,Subject,UserPost,ExpirationDate)");
            builder.Append(" values (");
            builder.Append("@UserId,@UserName,@Password,@TrueName,@UserIdentity,@Birthday,@Sex,@Email,@Mobile,@Province,@City,@County,@School,@CreateTime,@Stoken,@StokenTime,@Resource_Version,@GradeTerm,@Subject,@UserPost,@ExpirationDate)");
            SqlParameter[] cmdParms = new SqlParameter[] {
                new SqlParameter("@UserId", SqlDbType.Char, 0x24), new SqlParameter("@UserName", SqlDbType.VarChar, 50), new SqlParameter("@Password", SqlDbType.Char, 0x20), new SqlParameter("@TrueName", SqlDbType.NVarChar, 250), new SqlParameter("@UserIdentity", SqlDbType.Char, 1), new SqlParameter("@Birthday", SqlDbType.DateTime), new SqlParameter("@Sex", SqlDbType.Char, 1), new SqlParameter("@Email", SqlDbType.VarChar, 200), new SqlParameter("@Mobile", SqlDbType.VarChar, 20), new SqlParameter("@Province", SqlDbType.NVarChar, 250), new SqlParameter("@City", SqlDbType.NVarChar, 250), new SqlParameter("@County", SqlDbType.NVarChar, 250), new SqlParameter("@School", SqlDbType.NVarChar, 250), new SqlParameter("@CreateTime", SqlDbType.DateTime), new SqlParameter("@Stoken", SqlDbType.NVarChar, 50), new SqlParameter("@StokenTime", SqlDbType.DateTime),
                new SqlParameter("@Resource_Version", SqlDbType.Char, 0x24), new SqlParameter("@GradeTerm", SqlDbType.Char, 0x24), new SqlParameter("@Subject", SqlDbType.Char, 0x24), new SqlParameter("@UserPost", SqlDbType.Char, 0x24), new SqlParameter("@ExpirationDate", SqlDbType.DateTime)
            };
            cmdParms[0].Value    = model.UserId;
            cmdParms[1].Value    = model.UserName;
            cmdParms[2].Value    = model.Password;
            cmdParms[3].Value    = model.TrueName;
            cmdParms[4].Value    = model.UserIdentity;
            cmdParms[5].Value    = model.Birthday;
            cmdParms[6].Value    = model.Sex;
            cmdParms[7].Value    = model.Email;
            cmdParms[8].Value    = model.Mobile;
            cmdParms[9].Value    = model.Province;
            cmdParms[10].Value   = model.City;
            cmdParms[11].Value   = model.County;
            cmdParms[12].Value   = model.School;
            cmdParms[13].Value   = model.CreateTime;
            cmdParms[14].Value   = model.Stoken;
            cmdParms[15].Value   = model.StokenTime;
            cmdParms[0x10].Value = model.Resource_Version;
            cmdParms[0x11].Value = model.GradeTerm;
            cmdParms[0x12].Value = model.Subject;
            cmdParms[0x13].Value = model.UserPost;
            cmdParms[20].Value   = model.ExpirationDate;
            return(DbHelperSQL.ExecuteSql(builder.ToString(), cmdParms) > 0);
        }
コード例 #3
0
ファイル: DAL_F_User.cs プロジェクト: a157591984/jiguang
        public bool Update(Rc.Model.Resources.Model_F_User model)
        {
            StringBuilder builder = new StringBuilder();

            builder.Append("update F_User set ");
            builder.Append("UserName=@UserName,");
            builder.Append("Password=@Password,");
            builder.Append("TrueName=@TrueName,");
            builder.Append("UserIdentity=@UserIdentity,");
            builder.Append("Birthday=@Birthday,");
            builder.Append("Sex=@Sex,");
            builder.Append("Email=@Email,");
            builder.Append("Mobile=@Mobile,");
            builder.Append("Province=@Province,");
            builder.Append("City=@City,");
            builder.Append("County=@County,");
            builder.Append("School=@School,");
            builder.Append("CreateTime=@CreateTime,");
            builder.Append("Stoken=@Stoken,");
            builder.Append("StokenTime=@StokenTime,");
            builder.Append("Resource_Version=@Resource_Version,");
            builder.Append("GradeTerm=@GradeTerm,");
            builder.Append("Subject=@Subject,");
            builder.Append("UserPost=@UserPost,");
            builder.Append("ExpirationDate=@ExpirationDate");
            builder.Append(" where UserId=@UserId ");
            SqlParameter[] cmdParms = new SqlParameter[] {
                new SqlParameter("@UserName", SqlDbType.VarChar, 50), new SqlParameter("@Password", SqlDbType.Char, 0x20), new SqlParameter("@TrueName", SqlDbType.NVarChar, 250), new SqlParameter("@UserIdentity", SqlDbType.Char, 1), new SqlParameter("@Birthday", SqlDbType.DateTime), new SqlParameter("@Sex", SqlDbType.Char, 1), new SqlParameter("@Email", SqlDbType.VarChar, 200), new SqlParameter("@Mobile", SqlDbType.VarChar, 20), new SqlParameter("@Province", SqlDbType.NVarChar, 250), new SqlParameter("@City", SqlDbType.NVarChar, 250), new SqlParameter("@County", SqlDbType.NVarChar, 250), new SqlParameter("@School", SqlDbType.NVarChar, 250), new SqlParameter("@CreateTime", SqlDbType.DateTime), new SqlParameter("@Stoken", SqlDbType.NVarChar, 50), new SqlParameter("@StokenTime", SqlDbType.DateTime), new SqlParameter("@Resource_Version", SqlDbType.Char, 0x24),
                new SqlParameter("@GradeTerm", SqlDbType.Char, 0x24), new SqlParameter("@Subject", SqlDbType.Char, 0x24), new SqlParameter("@UserPost", SqlDbType.Char, 0x24), new SqlParameter("@ExpirationDate", SqlDbType.DateTime), new SqlParameter("@UserId", SqlDbType.Char, 0x24)
            };
            cmdParms[0].Value    = model.UserName;
            cmdParms[1].Value    = model.Password;
            cmdParms[2].Value    = model.TrueName;
            cmdParms[3].Value    = model.UserIdentity;
            cmdParms[4].Value    = model.Birthday;
            cmdParms[5].Value    = model.Sex;
            cmdParms[6].Value    = model.Email;
            cmdParms[7].Value    = model.Mobile;
            cmdParms[8].Value    = model.Province;
            cmdParms[9].Value    = model.City;
            cmdParms[10].Value   = model.County;
            cmdParms[11].Value   = model.School;
            cmdParms[12].Value   = model.CreateTime;
            cmdParms[13].Value   = model.Stoken;
            cmdParms[14].Value   = model.StokenTime;
            cmdParms[15].Value   = model.Resource_Version;
            cmdParms[0x10].Value = model.GradeTerm;
            cmdParms[0x11].Value = model.Subject;
            cmdParms[0x12].Value = model.UserPost;
            cmdParms[0x13].Value = model.ExpirationDate;
            cmdParms[20].Value   = model.UserId;
            return(DbHelperSQL.ExecuteSql(builder.ToString(), cmdParms) > 0);
        }
コード例 #4
0
ファイル: DAL_F_User.cs プロジェクト: a157591984/jiguang
        public int APPReg(Rc.Model.Resources.Model_F_User model, Model_f_user_token modelToken)
        {
            Dictionary <string, SqlParameter[]> dictionary = new Dictionary <string, SqlParameter[]>();
            StringBuilder builder = new StringBuilder();

            builder = new StringBuilder();
            builder.Append("insert into F_User(");
            builder.Append("UserId,UserName,Password,TrueName,UserIdentity,Birthday,Sex,Email,Mobile,Province,City,County,School,CreateTime,Stoken,StokenTime,Resource_Version,GradeTerm,Subject,UserPost,ExpirationDate)");
            builder.Append(" values (");
            builder.Append("@UserId,@UserName,@Password,@TrueName,@UserIdentity,@Birthday,@Sex,@Email,@Mobile,@Province,@City,@County,@School,@CreateTime,@Stoken,@StokenTime,@Resource_Version,@GradeTerm,@Subject,@UserPost,@ExpirationDate)");
            SqlParameter[] parameterArray = new SqlParameter[] {
                new SqlParameter("@UserId", SqlDbType.Char, 0x24), new SqlParameter("@UserName", SqlDbType.VarChar, 50), new SqlParameter("@Password", SqlDbType.Char, 0x20), new SqlParameter("@TrueName", SqlDbType.NVarChar, 250), new SqlParameter("@UserIdentity", SqlDbType.Char, 1), new SqlParameter("@Birthday", SqlDbType.DateTime), new SqlParameter("@Sex", SqlDbType.Char, 1), new SqlParameter("@Email", SqlDbType.VarChar, 200), new SqlParameter("@Mobile", SqlDbType.VarChar, 20), new SqlParameter("@Province", SqlDbType.NVarChar, 250), new SqlParameter("@City", SqlDbType.NVarChar, 250), new SqlParameter("@County", SqlDbType.NVarChar, 250), new SqlParameter("@School", SqlDbType.NVarChar, 250), new SqlParameter("@CreateTime", SqlDbType.DateTime), new SqlParameter("@Stoken", SqlDbType.NVarChar, 50), new SqlParameter("@StokenTime", SqlDbType.DateTime),
                new SqlParameter("@Resource_Version", SqlDbType.Char, 0x24), new SqlParameter("@GradeTerm", SqlDbType.Char, 0x24), new SqlParameter("@Subject", SqlDbType.Char, 0x24), new SqlParameter("@UserPost", SqlDbType.Char, 0x24), new SqlParameter("@ExpirationDate", SqlDbType.DateTime)
            };
            parameterArray[0].Value    = model.UserId;
            parameterArray[1].Value    = model.UserName;
            parameterArray[2].Value    = model.Password;
            parameterArray[3].Value    = model.TrueName;
            parameterArray[4].Value    = model.UserIdentity;
            parameterArray[5].Value    = model.Birthday;
            parameterArray[6].Value    = model.Sex;
            parameterArray[7].Value    = model.Email;
            parameterArray[8].Value    = model.Mobile;
            parameterArray[9].Value    = model.Province;
            parameterArray[10].Value   = model.City;
            parameterArray[11].Value   = model.County;
            parameterArray[12].Value   = model.School;
            parameterArray[13].Value   = model.CreateTime;
            parameterArray[14].Value   = model.Stoken;
            parameterArray[15].Value   = model.StokenTime;
            parameterArray[0x10].Value = model.Resource_Version;
            parameterArray[0x11].Value = model.GradeTerm;
            parameterArray[0x12].Value = model.Subject;
            parameterArray[0x13].Value = model.UserPost;
            parameterArray[20].Value   = model.ExpirationDate;
            dictionary.Add(builder.ToString(), parameterArray);
            builder = new StringBuilder();
            builder.Append("insert into f_user_token(");
            builder.Append("user_id,product_type,token,token_time,login_time,login_ip)");
            builder.Append(" values (");
            builder.Append("@user_id,@product_type,@token,@token_time,@login_time,@login_ip)");
            SqlParameter[] parameterArray2 = new SqlParameter[] { new SqlParameter("@user_id", SqlDbType.Char, 0x24), new SqlParameter("@product_type", SqlDbType.VarChar, 50), new SqlParameter("@token", SqlDbType.VarChar, 50), new SqlParameter("@token_time", SqlDbType.DateTime), new SqlParameter("@login_time", SqlDbType.DateTime), new SqlParameter("@login_ip", SqlDbType.VarChar, 50) };
            parameterArray2[0].Value = modelToken.user_id;
            parameterArray2[1].Value = modelToken.product_type;
            parameterArray2[2].Value = modelToken.token;
            parameterArray2[3].Value = modelToken.token_time;
            parameterArray2[4].Value = modelToken.login_time;
            parameterArray2[5].Value = modelToken.login_ip;
            dictionary.Add(builder.ToString(), parameterArray2);
            return(DbHelperSQL.ExecuteSqlTran(dictionary));
        }
コード例 #5
0
ファイル: student.aspx.cs プロジェクト: a157591984/jiguang
 public static string GetmyBaby(int PageIndex, int PageSize)
 {
     try
     {
         string strWhere = string.Empty;
         BLL_StudentToParent             bll        = new BLL_StudentToParent();
         Rc.Model.Resources.Model_F_User FloginUser = Rc.Common.StrUtility.clsUtility.IsFPageFlag() as Rc.Model.Resources.Model_F_User;
         strWhere  = "and Parent_ID='" + FloginUser.UserId + "'";
         PageIndex = Convert.ToInt32(PageIndex.ToString().Filter());
         GH_PagerInfo <List <Model_StudentToParent> > pageInfo = bll.GetAllList(strWhere, "", PageIndex, PageSize);
         List <Model_StudentToParent> list = pageInfo.PageData;
         List <object> listReturn          = new List <object>();
         int           inum = 1;
         foreach (var item in list)
         {
             listReturn.Add(new
             {
                 Num       = inum + PageSize * (PageIndex - 1),
                 BabyName  = item.UserName,
                 struserid = item.Student_ID,
                 Email     = string.IsNullOrEmpty(item.Email) ? "" : item.Email
             });
             inum++;
         }
         if (inum > 1)
         {
             return(JsonConvert.SerializeObject(new
             {
                 err = "null",
                 PageIndex = pageInfo.CurrentPage,
                 PageSize = pageInfo.PageSize,
                 TotalCount = pageInfo.RecordCount,
                 list = listReturn
             }));
         }
         else
         {
             return(JsonConvert.SerializeObject(new
             {
                 err = "暂无数据"
             }));
         }
     }
     catch (Exception ex)
     {
         return(JsonConvert.SerializeObject(new
         {
             err = ex.Message.ToString()
         }));
     }
 }
コード例 #6
0
ファイル: DAL_F_User.cs プロジェクト: a157591984/jiguang
        public bool Exists(Rc.Model.Resources.Model_F_User f_user, string type)
        {
            StringBuilder builder = new StringBuilder();

            builder.Append("select count(1) from F_User where 1=1 ");
            if (type == "1")
            {
                builder.AppendFormat(" and UserName='******'", f_user.UserName);
            }
            if (type == "2")
            {
                builder.AppendFormat(" and UserId!='{0}' and UserName='******'", f_user.UserId, f_user.UserName);
            }
            if (Convert.ToInt32(DbHelperSQL.GetSingle(builder.ToString())) <= 0)
            {
                return(false);
            }
            return(true);
        }
コード例 #7
0
        public static string DeleteHw(string HomeWorkId)
        {
            try
            {
                HomeWorkId = HomeWorkId.Filter();

                if (new BLL_HomeWork().RevokeHW(HomeWorkId))
                {
                    Rc.Model.Resources.Model_F_User FloginUser = Rc.Common.StrUtility.clsUtility.IsFPageFlag() as Rc.Model.Resources.Model_F_User;
                    Rc.Common.SystemLog.SystemLog.AddLogFromBS("", "撤销作业", string.Format("撤销作业完成,RevokeHW|老师标识{0}", FloginUser.UserId));

                    return("1");
                }
                else
                {
                    return("2");
                }
            }
            catch (Exception)
            {
                return("2");
            }
        }
コード例 #8
0
 public static string cancel(string ResourceToResourceFolder_Id)
 {
     Rc.Model.Resources.Model_F_User FloginUser = Rc.Common.StrUtility.clsUtility.IsFPageFlag() as Rc.Model.Resources.Model_F_User;
     try
     {
         Model_ResourceToResourceFolder rtr    = new Model_ResourceToResourceFolder();
         BLL_ResourceToResourceFolder   rtrbll = new BLL_ResourceToResourceFolder();
         rtr = rtrbll.GetModel(ResourceToResourceFolder_Id);
         rtr.Resource_shared = "";
         BLL_ResourceShare bllrs = new BLL_ResourceShare();
         if (bllrs.CancelShareResource(ResourceToResourceFolder_Id, rtr))
         {
             return("1");
         }
         else
         {
             return("");
         }
     }
     catch (Exception)
     {
         return("");
     }
 }
コード例 #9
0
        public static string GetResourceFolderListPage(string ParticularYear, string GradeTerm, string Subject, string Resource_Version, string Province, string City, string Name, int PageIndex, int PageSize)
        {
            try
            {
                StringBuilder strHtml = new StringBuilder();
                Rc.Model.Resources.Model_F_User loginUser = Rc.Common.StrUtility.clsUtility.IsFPageFlag() as Rc.Model.Resources.Model_F_User;
                DataTable     dtRes       = new DataTable();
                List <object> listReturn  = new List <object>();
                string        strSql      = string.Empty;
                string        strSqlCount = string.Empty;
                string        strWhere    = string.Empty;
                if (ParticularYear != "")
                {
                    strWhere += " and ParticularYear = '" + ParticularYear.Filter() + "' ";                      //年份
                }
                if (GradeTerm != "")
                {
                    strWhere += " and GradeTerm = '" + GradeTerm.Filter() + "' ";                 //年级学期
                }
                if (Subject != "")
                {
                    strWhere += " and Subject = '" + Subject.Filter() + "' ";               //学科
                }
                if (Resource_Version != "")
                {
                    strWhere += " and Resource_Version = '" + Resource_Version.Filter() + "' ";                         //教材版本
                }
                if (Name != "")
                {
                    strWhere += " and ResourceFolder_Name like '%" + Name.Filter() + "%' ";             //名称
                }
                string strWhereCount = strWhere;
                if (Province != "-1" && City != "-1")//选择省市
                {
                    strWhereCount = string.Format(" and t.ResourceFolder_Id in(select ResourceFolder_Id from BookArea where City_ID='{0}') ", City);
                    strWhere     += string.Format(" and ResourceFolder_Id in(select ResourceFolder_Id from BookArea where City_ID='{0}') ", City);
                }
                else if (Province != "-1" && City == "-1")//只选择省
                {
                    strWhereCount = string.Format(" and t.ResourceFolder_Id in(select ResourceFolder_Id from BookArea where Province_ID='{0}') ", Province);
                    strWhere     += string.Format(" and ResourceFolder_Id in(select ResourceFolder_Id from BookArea where Province_ID='{0}') ", Province);
                }

                strSqlCount = @"select count(1) from(SELECT DISTINCT t1.BookImg_Url ,t.*,t1.bookShelvesstate from ResourceFolder t 
                                left join Bookshelves t1 on t.ResourceFolder_ID=t1.ResourceFolder_ID 
                                left join UserBuyResources t2 on t.ResourceFolder_ID=t2.book_id
                                where t.Resource_Type='" + Resource_TypeConst.testPaper类型文件 + "' and  t1.BookShelvesState=1 " + strWhereCount + " ) a ";

                strSql = @"select * from (select  ROW_NUMBER() over(ORDER BY CreateTime DESC) row,* from (
                            SELECT DISTINCT t1.BookImg_Url ,t.*,t1.bookShelvesstate,t1.BookPrice,t2.userid,t1.Book_Name from ResourceFolder t 
                            left join Bookshelves t1 on t.ResourceFolder_ID=t1.ResourceFolder_ID 
                            left join UserBuyResources t2 on t.ResourceFolder_ID=t2.book_id and t2.userid='" + loginUser.UserId + "' where t.Resource_Type='" + Resource_TypeConst.testPaper类型文件 + "' and t1.BookShelvesState=1 ) a  where 1=1 " + strWhere
                         + " ) z where row between " + ((PageIndex - 1) * PageSize + 1) + " and " + (PageIndex * PageSize) + "  ";

                dtRes = Rc.Common.DBUtility.DbHelperSQL.Query(strSql).Tables[0];
                int rCount = Convert.ToInt32(Rc.Common.DBUtility.DbHelperSQL.GetSingle(strSqlCount).ToString());
                int inum   = 0;
                for (int i = 0; i < dtRes.Rows.Count; i++)
                {
                    #region 处理图片显示宽高
                    int    imgHeight   = 0;
                    int    imgWidth    = 0;
                    string imgFilePath = HttpContext.Current.Server.MapPath(dtRes.Rows[i]["BookImg_Url"].ToString());
                    if (System.IO.File.Exists(imgFilePath))
                    {
                        System.Drawing.Image img = System.Drawing.Image.FromFile(imgFilePath);
                        imgHeight = img.Height;
                        imgWidth  = img.Width;
                        if (imgHeight / 218.0 > imgWidth / 160.0)
                        {
                            imgWidth = 0;
                            if (imgHeight > 218)
                            {
                                imgHeight = 218;
                            }
                        }
                        else
                        {
                            imgHeight = 0;
                            if (imgWidth > 160)
                            {
                                imgWidth = 160;
                            }
                        }
                        img.Dispose();
                    }
                    #endregion
                    inum++;
                    listReturn.Add(new
                    {
                        inum              = (i + 1),
                        Book_Name         = dtRes.Rows[i]["Book_Name"].ToString(),
                        BookImg_Url       = dtRes.Rows[i]["BookImg_Url"].ToString(),
                        BookPrice         = dtRes.Rows[i]["BookPrice"].ToString(),
                        ResourceFolder_ID = dtRes.Rows[i]["ResourceFolder_ID"].ToString(),
                        isGouMai          = (dtRes.Rows[i]["userid"].ToString() != "" ? "1" : "0"),
                        imgHeight         = imgHeight,
                        imgWidth          = imgWidth
                    });
                }
                if (inum > 0)
                {
                    return(JsonConvert.SerializeObject(new
                    {
                        err = "null",
                        PageIndex = PageIndex,
                        PageSize = PageSize,
                        TotalCount = rCount,
                        list = listReturn
                    }));
                }
                else
                {
                    return(JsonConvert.SerializeObject(new
                    {
                        err = "暂无数据"
                    }));
                }
            }
            catch (Exception)
            {
                return(JsonConvert.SerializeObject(new
                {
                    err = "error"//ex.Message.ToString()
                }));
            }
        }
コード例 #10
0
ファイル: microClass.aspx.cs プロジェクト: a157591984/jiguang
        public static string GetCloudResource(string ResourceFolder_Id, string DocName, string IType, int PageIndex, int PageSize)
        {
            Rc.Model.Resources.Model_F_User FloginUser = Rc.Common.StrUtility.clsUtility.IsFPageFlag() as Rc.Model.Resources.Model_F_User;
            try
            {
                ResourceFolder_Id = ResourceFolder_Id.Filter();
                DocName           = DocName.Filter();
                IType             = IType.Filter();

                int pageSize = 10;
                PageIndex = Convert.ToInt32(PageIndex.ToString().Filter());
                #region 资源信息
                DataTable     dtRes       = new DataTable();
                List <object> listReturn  = new List <object>();
                string        strSql      = string.Empty;
                string        strSqlCount = string.Empty;
                string        strWhere    = " Resource_Type='" + Resource_TypeConst.class类型微课件 + "' ";
                if (!string.IsNullOrEmpty(DocName))
                {
                    strWhere = " and File_Name like '%" + DocName.Filter() + "%' ";
                }
                strWhere += string.Format(" and Resource_Class = '{0}'", Resource_ClassConst.云资源);
                strWhere += string.Format(" AND Book_ID IN(SELECT Book_ID FROM UserBuyResources WHERE A.Book_ID=UserBuyResources.Book_id AND UserBuyResources.UserId='{0}' )", FloginUser.UserId);


                if (IType == "1")
                {
                    strWhere += " and Subject='" + ResourceFolder_Id + "' ";
                }
                else
                {
                    strWhere += " and ResourceFolder_Id='" + ResourceFolder_Id + "' ";
                }

                strSqlCount = @"select count(*) from ResourceToResourceFolder A
INNER JOIN Resource B ON A.Resource_Id=B.Resource_Id  where " + strWhere + " ";
                strSql      = @"select * from (select ROW_NUMBER() over(ORDER BY A.ResourceToResourceFolder_Order,A.Resource_Name) row,A.*,B.Resource_ContentLength from ResourceToResourceFolder A
INNER JOIN Resource B ON A.Resource_Id=B.Resource_Id  where "
                              + strWhere + " ) t where row between " + ((PageIndex - 1) * pageSize + 1) + " and " + (PageIndex * pageSize) + "  ";
                dtRes = Rc.Common.DBUtility.DbHelperSQL.Query(strSql).Tables[0];
                int rCount = Convert.ToInt32(Rc.Common.DBUtility.DbHelperSQL.GetSingle(strSqlCount).ToString());
                int inum   = 0;
                for (int i = 0; i < dtRes.Rows.Count; i++)
                {
                    Rc.Cloud.Web.AuthApi.index.BookAttrModel bkAttrModel = GetBookAttrValue(dtRes.Rows[i]["Book_ID"].ToString());
                    inum++;
                    string docName = dtRes.Rows[i]["File_Name"].ToString();
                    string resUrl  = "Upload/Resource/" + dtRes.Rows[i]["Resource_Url"].ToString().Replace("\\", "/");
                    if (!string.IsNullOrEmpty(resUrl) && resUrl.IndexOf(".") > 0)
                    {
                        resUrl = resUrl.Substring(0, resUrl.LastIndexOf(".")) + ".htm";
                    }
                    listReturn.Add(new
                    {
                        inum       = (i + 1),
                        docId      = dtRes.Rows[i]["ResourceToResourceFolder_Id"].ToString(),
                        docName    = docName,
                        docType    = dtRes.Rows[i]["File_Suffix"].ToString(),
                        docSize    = pfunction.ConvertDocSizeUnit(dtRes.Rows[i]["Resource_ContentLength"].ToString()),
                        docUrl     = pfunction.GetResourceHost("TeachingPlanViewWebSiteUrl") + resUrl,
                        docTime    = pfunction.ConvertToLongDateTime(dtRes.Rows[i]["CreateTime"].ToString()),
                        IsDownload = bkAttrModel.IsSave
                    });
                }
                #endregion

                if (inum > 0)
                {
                    return(JsonConvert.SerializeObject(new
                    {
                        err = "null",
                        PageIndex = PageIndex,
                        PageSize = pageSize,
                        TotalCount = rCount,
                        list = listReturn
                    }));
                }
                else
                {
                    return(JsonConvert.SerializeObject(new
                    {
                        err = "暂无数据"
                    }));
                }
            }
            catch (Exception)
            {
                return(JsonConvert.SerializeObject(new
                {
                    err = "error"//ex.Message.ToString()
                }));
            }
        }
コード例 #11
0
        public static string GetTestpaper(string Two_WayChecklist_Id, string UserGroupId, int PageIndex, int PageSize)
        {
            Rc.Model.Resources.Model_F_User FloginUser = Rc.Common.StrUtility.clsUtility.IsFPageFlag() as Rc.Model.Resources.Model_F_User;
            try
            {
                PageIndex = Convert.ToInt32(PageIndex.ToString().Filter());
                #region 资源信息
                DataTable     dtRes       = new DataTable();
                List <object> listReturn  = new List <object>();
                string        strSql      = string.Empty;
                string        strSqlCount = string.Empty;
                string        strWhere    = string.Empty;
                strWhere   += string.Format(" Two_WayChecklist_Id='{0}' and User_Id='{1}'", Two_WayChecklist_Id.Filter(), FloginUser.UserId);
                strSqlCount = @"select count(*) from AlreadyedTestpaper where " + strWhere;
                strSql      = @"select * from (select ROW_NUMBER() over(ORDER BY A.ResourceToResourceFolder_Order,A.Resource_Name ) row,A.*,hw.HomeWork_Id
from ResourceToResourceFolder A
INNER JOIN AlreadyedTestpaper B ON A.ResourceToResourceFolder_Id=B.ResourceToResourceFolder_Id
left join HomeWork hw on hw.UserGroup_Id='" + UserGroupId + "' and hw.ResourceToResourceFolder_Id=A.ResourceToResourceFolder_Id where "
                              + strWhere + " ) t where row between " + ((PageIndex - 1) * PageSize + 1) + " and " + (PageIndex * PageSize);
                dtRes = Rc.Common.DBUtility.DbHelperSQL.Query(strSql).Tables[0];
                int rCount = Convert.ToInt32(Rc.Common.DBUtility.DbHelperSQL.GetSingle(strSqlCount).ToString());
                int inum   = 0;
                for (int i = 0; i < dtRes.Rows.Count; i++)
                {
                    inum++;
                    string docName = dtRes.Rows[i]["Resource_Name"].ToString();
                    listReturn.Add(new
                    {
                        inum            = (i + 1),
                        docId           = dtRes.Rows[i]["ResourceToResourceFolder_Id"].ToString(),
                        docName         = docName,
                        EnHomeWork_Name = HttpContext.Current.Server.UrlEncode(dtRes.Rows[i]["Resource_Name"].ToString()),
                        docTime         = Rc.Cloud.Web.Common.pfunction.ConvertToLongDateTime(dtRes.Rows[i]["CreateTime"].ToString()),
                        HomeWork_Id     = dtRes.Rows[i]["HomeWork_Id"].ToString()
                    });
                }
                #endregion

                if (inum > 0)
                {
                    return(JsonConvert.SerializeObject(new
                    {
                        err = "null",
                        PageIndex = PageIndex,
                        PageSize = PageSize,
                        TotalCount = rCount,
                        list = listReturn
                    }));
                }
                else
                {
                    return(JsonConvert.SerializeObject(new
                    {
                        err = "暂无数据"
                    }));
                }
            }
            catch (Exception)
            {
                return(JsonConvert.SerializeObject(new
                {
                    err = "error"//ex.Message.ToString()
                }));
            }
        }
コード例 #12
0
        public static string GetTestpaper(string Two_WayChecklist_Id, string UserGroupId, int PageIndex, int PageSize)
        {
            Rc.Model.Resources.Model_F_User FloginUser = (Rc.Model.Resources.Model_F_User)HttpContext.Current.Session["FLoginUser"];
            try
            {
                Two_WayChecklist_Id = Two_WayChecklist_Id.Filter();
                UserGroupId         = UserGroupId.Filter();
                PageIndex           = Convert.ToInt32(PageIndex.ToString().Filter());
                #region 资源信息
                DataTable     dtRes       = new DataTable();
                List <object> listReturn  = new List <object>();
                string        strSql      = string.Empty;
                string        strSqlCount = string.Empty;
                string        strWhere    = string.Empty;
                string        str         = string.Empty;
                strSqlCount = string.Format(@"select count(*) from (
select A.*,hw.HomeWork_Id
from ResourceToResourceFolder A
INNER JOIN AlreadyedTestpaper B ON A.ResourceToResourceFolder_Id=B.ResourceToResourceFolder_Id and Two_WayChecklist_Id='{0}' and user_id='{1}'
left join HomeWork hw on hw.UserGroup_Id='{2}' and hw.ResourceToResourceFolder_Id=A.ResourceToResourceFolder_Id 
union 
select A.*,hw.HomeWork_Id
from ResourceToResourceFolder A
INNER JOIN AlreadyedTestpaper B ON A.ResourceToResourceFolder_Id=B.ResourceToResourceFolder_Id
inner join Two_WayChecklistToTeacher C on B.Two_WayChecklist_Id=C.Two_NewWayChecklist_Id and Teacher_Id='{1}'
left join HomeWork hw on hw.UserGroup_Id='{2}' and hw.ResourceToResourceFolder_Id=A.ResourceToResourceFolder_Id 
where C.Two_WayChecklist_Id='{0}'
) a", Two_WayChecklist_Id, FloginUser.UserId, UserGroupId);
                strSql      = string.Format(@"select * from (
select *,ROW_NUMBER() over(ORDER BY A.CreateTime) row  from
(
select A.*,hw.HomeWork_Id
from ResourceToResourceFolder A
INNER JOIN AlreadyedTestpaper B ON A.ResourceToResourceFolder_Id=B.ResourceToResourceFolder_Id and Two_WayChecklist_Id='{0}' and user_id='{1}'
left join HomeWork hw on hw.UserGroup_Id='{2}' and hw.ResourceToResourceFolder_Id=A.ResourceToResourceFolder_Id 
union 
select A.*,hw.HomeWork_Id
from ResourceToResourceFolder A
INNER JOIN AlreadyedTestpaper B ON A.ResourceToResourceFolder_Id=B.ResourceToResourceFolder_Id
inner join Two_WayChecklistToTeacher C on B.Two_WayChecklist_Id=C.Two_NewWayChecklist_Id and Teacher_Id='{1}'
left join HomeWork hw on hw.UserGroup_Id='{2}' and hw.ResourceToResourceFolder_Id=A.ResourceToResourceFolder_Id 
where C.Two_WayChecklist_Id='{0}'
) a ) t where row between " + ((PageIndex - 1) * PageSize + 1) + " and " + (PageIndex * PageSize), Two_WayChecklist_Id, FloginUser.UserId, UserGroupId);
                dtRes       = Rc.Common.DBUtility.DbHelperSQL.Query(strSql).Tables[0];
                int rCount = Convert.ToInt32(Rc.Common.DBUtility.DbHelperSQL.GetSingle(strSqlCount).ToString());
                int inum   = 0;
                for (int i = 0; i < dtRes.Rows.Count; i++)
                {
                    inum++;
                    string docName = dtRes.Rows[i]["Resource_Name"].ToString().ReplaceForFilter();
                    listReturn.Add(new
                    {
                        inum            = (i + 1),
                        docId           = dtRes.Rows[i]["ResourceToResourceFolder_Id"].ToString(),
                        docName         = docName,
                        EnHomeWork_Name = HttpContext.Current.Server.UrlEncode(dtRes.Rows[i]["Resource_Name"].ToString().ReplaceForFilter()),
                        docTime         = pfunction.ConvertToLongDateTime(dtRes.Rows[i]["CreateTime"].ToString()),
                        HomeWork_Id     = dtRes.Rows[i]["HomeWork_Id"].ToString()
                    });
                }
                #endregion

                if (inum > 0)
                {
                    return(JsonConvert.SerializeObject(new
                    {
                        err = "null",
                        PageIndex = PageIndex,
                        PageSize = PageSize,
                        TotalCount = rCount,
                        list = listReturn
                    }));
                }
                else
                {
                    return(JsonConvert.SerializeObject(new
                    {
                        err = "暂无数据"
                    }));
                }
            }
            catch (Exception)
            {
                return(JsonConvert.SerializeObject(new
                {
                    err = "error"//ex.Message.ToString()
                }));
            }
        }
コード例 #13
0
        public static string GetCloudResource(string Resource_Type, int PageSize, int PageIndex)
        {
            Rc.Model.Resources.Model_F_User FloginUser = Rc.Common.StrUtility.clsUtility.IsFPageFlag() as Rc.Model.Resources.Model_F_User;
            try
            {
                Resource_Type = Resource_Type.Filter();
                PageIndex     = Convert.ToInt32(PageIndex.ToString().Filter());
                #region 资源信息
                DataTable     dtRes       = new DataTable();
                List <object> listReturn  = new List <object>();
                string        strSql      = string.Empty;
                string        strSqlCount = string.Empty;
                string        strWhere    = " 1=1 ";
                if (!string.IsNullOrEmpty(Resource_Type) && Resource_Type != "1")
                {
                    strWhere += string.Format(" and rtr.Resource_Type = '{0}'", Resource_Type.Filter());
                }
                if (!string.IsNullOrEmpty(FloginUser.Subject) && FloginUser.Subject != "-1")
                {
                    strWhere += " and rtr.Subject='" + FloginUser.Subject + "'";
                }
                strWhere   += " and rs.ResourceToResourceFolder_Id in(select distinct (ResourceToResourceFolder_Id) from ResourceShare where ShareObjectId in (select distinct(SchoolId) from dbo.VW_UserOnClassGradeSchool where UserId='" + FloginUser.UserId + "' and SchoolId<>''))";
                strSqlCount = @"select count(*) from(select rtr.ResourceFolder_Id,rtr.ResourceToResourceFolder_Id,rtr.Subject,rtr.Resource_Type,
rtr.Resource_Name,rtr.Resource_Url,rs.CreateTime,ISNULL(fu.TrueName,fu.UserName) TeacherName,r.Resource_ContentLength
,rtr.File_Suffix,rtr.Book_ID,rtr.File_Name from dbo.ResourceShare rs
left join ResourceToResourceFolder rtr on rtr.ResourceToResourceFolder_Id=rs.ResourceToResourceFolder_Id
left join ResourceFolder rf on rf.ResourceFolder_Id=rtr.ResourceFolder_Id
left join Resource  r on r.Resource_Id=rtr.Resource_Id
left join F_User fu on fu.UserId=rs.CreateUserId where " + strWhere + " ) a ";
                strSql      = @"select * from (select ROW_NUMBER() over(ORDER BY A.Resource_Name) row,A.* from (select rtr.ResourceFolder_Id,rtr.ResourceToResourceFolder_Id,rtr.Subject,rtr.Resource_Type,
rtr.Resource_Name,rtr.Resource_Url,rs.CreateTime,ISNULL(fu.TrueName,fu.UserName) TeacherName,r.Resource_ContentLength
,rtr.File_Suffix,rtr.Book_ID,rtr.File_Name from dbo.ResourceShare rs
left join ResourceToResourceFolder rtr on rtr.ResourceToResourceFolder_Id=rs.ResourceToResourceFolder_Id
left join ResourceFolder rf on rf.ResourceFolder_Id=rtr.ResourceFolder_Id
left join Resource  r on r.Resource_Id=rtr.Resource_Id
left join F_User fu on fu.UserId=rs.CreateUserId  where "
                              + strWhere + " ) A ) t where row between " + ((PageIndex - 1) * PageSize + 1) + " and " + (PageIndex * PageSize) + "  ";
                dtRes = Rc.Common.DBUtility.DbHelperSQL.Query(strSql).Tables[0];
                int rCount = Convert.ToInt32(Rc.Common.DBUtility.DbHelperSQL.GetSingle(strSqlCount).ToString());
                int inum   = 0;
                for (int i = 0; i < dtRes.Rows.Count; i++)
                {
                    Rc.Cloud.Web.AuthApi.index.BookAttrModel bkAttrModel = GetBookAttrValue(dtRes.Rows[i]["Book_ID"].ToString());
                    inum++;
                    string docName = dtRes.Rows[i]["File_Name"].ToString();
                    //docName = pfunction.GetDocFileName(docName);
                    string resUrl = "Upload/Resource/" + dtRes.Rows[i]["Resource_Url"].ToString().Replace("\\", "/");
                    if (!string.IsNullOrEmpty(resUrl) && resUrl.IndexOf(".") > 0)
                    {
                        resUrl = resUrl.Substring(0, resUrl.LastIndexOf(".")) + ".htm";
                    }
                    listReturn.Add(new
                    {
                        inum    = (i + 1),
                        docId   = dtRes.Rows[i]["ResourceToResourceFolder_Id"].ToString(),
                        docName = docName,
                        docType = dtRes.Rows[i]["File_Suffix"].ToString(),
                        // docTypeAll = dtRes.Rows[i]["File_Suffix"].ToString(),
                        docSize     = pfunction.ConvertDocSizeUnit(dtRes.Rows[i]["Resource_ContentLength"].ToString()),
                        docUrl      = pfunction.GetResourceHost("TeachingPlanViewWebSiteUrl") + resUrl,
                        docTime     = pfunction.ConvertToLongDateTime(dtRes.Rows[i]["CreateTime"].ToString()),
                        IsDownload  = bkAttrModel.IsSave,
                        TeacherName = dtRes.Rows[i]["TeacherName"].ToString()
                                      //Opearate = operateStr
                    });
                }
                #endregion

                if (inum > 0)
                {
                    return(JsonConvert.SerializeObject(new
                    {
                        err = "null",
                        PageIndex = PageIndex,
                        PageSize = PageSize,
                        TotalCount = rCount,
                        list = listReturn
                    }));
                }
                else
                {
                    return(JsonConvert.SerializeObject(new
                    {
                        err = "暂无数据"
                    }));
                }
            }
            catch (Exception)
            {
                return(JsonConvert.SerializeObject(new
                {
                    err = "error"//ex.Message.ToString()
                }));
            }
        }
コード例 #14
0
ファイル: DAL_F_User.cs プロジェクト: a157591984/jiguang
 public Rc.Model.Resources.Model_F_User DataRowToModel(DataRow row)
 {
     Rc.Model.Resources.Model_F_User user = new Rc.Model.Resources.Model_F_User();
     if (row != null)
     {
         if (row["UserId"] != null)
         {
             user.UserId = row["UserId"].ToString();
         }
         if (row["UserName"] != null)
         {
             user.UserName = row["UserName"].ToString();
         }
         if (row["Password"] != null)
         {
             user.Password = row["Password"].ToString();
         }
         if (row["TrueName"] != null)
         {
             user.TrueName = row["TrueName"].ToString();
         }
         if (row["UserIdentity"] != null)
         {
             user.UserIdentity = row["UserIdentity"].ToString();
         }
         if ((row["Birthday"] != null) && (row["Birthday"].ToString() != ""))
         {
             user.Birthday = new DateTime?(DateTime.Parse(row["Birthday"].ToString()));
         }
         if (row["Sex"] != null)
         {
             user.Sex = row["Sex"].ToString();
         }
         if (row["Email"] != null)
         {
             user.Email = row["Email"].ToString();
         }
         if (row["Mobile"] != null)
         {
             user.Mobile = row["Mobile"].ToString();
         }
         if (row["Province"] != null)
         {
             user.Province = row["Province"].ToString();
         }
         if (row["City"] != null)
         {
             user.City = row["City"].ToString();
         }
         if (row["County"] != null)
         {
             user.County = row["County"].ToString();
         }
         if (row["School"] != null)
         {
             user.School = row["School"].ToString();
         }
         if ((row["CreateTime"] != null) && (row["CreateTime"].ToString() != ""))
         {
             user.CreateTime = new DateTime?(DateTime.Parse(row["CreateTime"].ToString()));
         }
         if (row["Stoken"] != null)
         {
             user.Stoken = row["Stoken"].ToString();
         }
         if ((row["StokenTime"] != null) && (row["StokenTime"].ToString() != ""))
         {
             user.StokenTime = new DateTime?(DateTime.Parse(row["StokenTime"].ToString()));
         }
         if (row["Resource_Version"] != null)
         {
             user.Resource_Version = row["Resource_Version"].ToString();
         }
         if (row["GradeTerm"] != null)
         {
             user.GradeTerm = row["GradeTerm"].ToString();
         }
         if (row["Subject"] != null)
         {
             user.Subject = row["Subject"].ToString();
         }
         if (row["UserPost"] != null)
         {
             user.UserPost = row["UserPost"].ToString();
         }
         if ((row["ExpirationDate"] != null) && (row["ExpirationDate"].ToString() != ""))
         {
             user.ExpirationDate = new DateTime?(DateTime.Parse(row["ExpirationDate"].ToString()));
         }
     }
     return(user);
 }
コード例 #15
0
ファイル: teaching.aspx.cs プロジェクト: a157591984/jiguang
        public static string GetResourceFolderListPage(int PageIndex, int PageSize)
        {
            try
            {
                StringBuilder strHtml = new StringBuilder();
                Rc.Model.Resources.Model_F_User loginUser = Rc.Common.StrUtility.clsUtility.IsFPageFlag() as Rc.Model.Resources.Model_F_User;
                DataTable     dtRes       = new DataTable();
                List <object> listReturn  = new List <object>();
                string        strSql      = string.Empty;
                string        strSqlCount = string.Empty;

                strSqlCount = @"SELECT count(1) from ResourceFolder t 
                                left join Bookshelves t1 on t.ResourceFolder_ID=t1.ResourceFolder_ID 
                                where t.Resource_Type='" + Resource_TypeConst.testPaper类型文件 + "' and  t.ResourceFolder_ID in(SELECT book_id from UserBuyResources where userid='" + loginUser.UserId + "') ";

                strSql = @"select * from (select ROW_NUMBER() over(ORDER BY t.CreateTime DESC) row,t1.BookImg_Url,t.*,t1.bookShelvesstate,t1.BookPrice,t1.Book_Name  from ResourceFolder t 
                                left join Bookshelves t1 on t.ResourceFolder_ID=t1.ResourceFolder_ID 
                                where t.Resource_Type='" + Resource_TypeConst.testPaper类型文件 + "' and  t.ResourceFolder_ID in(SELECT book_id from UserBuyResources where userid='" + loginUser.UserId + "') "
                         + " ) z where row between " + ((PageIndex - 1) * PageSize + 1) + " and " + (PageIndex * PageSize) + "  ";

                dtRes = Rc.Common.DBUtility.DbHelperSQL.Query(strSql).Tables[0];
                int rCount = Convert.ToInt32(Rc.Common.DBUtility.DbHelperSQL.GetSingle(strSqlCount).ToString());
                int inum   = 0;
                for (int i = 0; i < dtRes.Rows.Count; i++)
                {
                    inum++;
                    listReturn.Add(new
                    {
                        inum              = (i + 1),
                        BookImg_Url       = dtRes.Rows[i]["BookImg_Url"].ToString(),
                        Book_Name         = dtRes.Rows[i]["Book_Name"].ToString(),
                        BookPrice         = dtRes.Rows[i]["BookPrice"].ToString(),
                        ResourceFolder_ID = dtRes.Rows[i]["ResourceFolder_ID"].ToString(),
                    });
                }
                if (inum > 0)
                {
                    return(JsonConvert.SerializeObject(new
                    {
                        err = "null",
                        PageIndex = PageIndex,
                        PageSize = PageSize,
                        TotalCount = rCount,
                        list = listReturn
                    }));
                }
                else
                {
                    return(JsonConvert.SerializeObject(new
                    {
                        err = "暂无数据"
                    }));
                }
            }
            catch (Exception)
            {
                return(JsonConvert.SerializeObject(new
                {
                    err = "error"//ex.Message.ToString()
                }));
            }
        }
コード例 #16
0
        public static string GetcHomework(string ResourceFolder_Id, string DocName, string ShowFolderIn, string UserGroupId, int PageIndex, int PageSize)
        {
            Rc.Model.Resources.Model_F_User FloginUser = Rc.Common.StrUtility.clsUtility.IsFPageFlag() as Rc.Model.Resources.Model_F_User;
            try
            {
                DocName   = DocName.Filter();
                PageIndex = Convert.ToInt32(PageIndex.ToString().Filter());
                #region 资源信息
                DataTable     dtRes       = new DataTable();
                List <object> listReturn  = new List <object>();
                string        strSql      = string.Empty;
                string        strSqlCount = string.Empty;
                string        strWhere    = string.Empty;
                string        strOrder    = string.Empty;
                if (!string.IsNullOrEmpty(DocName))
                {
                    strWhere += " and File_Name like '%" + DocName.Filter() + "%' ";
                }

                strWhere += " and ResourceFolder_Id='" + ResourceFolder_Id.Filter() + "' ";

                strWhere   += string.Format(" and Resource_Type='{0}'", Rc.Common.Config.Resource_TypeConst.testPaper类型文件);
                strSqlCount = @"select count(*) from ResourceToResourceFolder A
INNER JOIN Resource B ON A.Resource_Id=B.Resource_Id 
left join HomeWork hw on hw.UserGroup_Id='" + UserGroupId + "' and hw.ResourceToResourceFolder_Id=A.ResourceToResourceFolder_Id where 1=1 " + strWhere + " ";
                strSql      = @"select * from (select ROW_NUMBER() over(ORDER BY A.ResourceToResourceFolder_Order,A.Resource_Name ) row,A.*,B.Resource_ContentLength,hw.HomeWork_Id
from ResourceToResourceFolder A
INNER JOIN Resource B ON A.Resource_Id=B.Resource_Id
left join HomeWork hw on hw.UserGroup_Id='" + UserGroupId + "' and hw.ResourceToResourceFolder_Id=A.ResourceToResourceFolder_Id where 1=1 "
                              + strWhere + " ) t where row between " + ((PageIndex - 1) * PageSize + 1) + " and " + (PageIndex * PageSize);
                dtRes = Rc.Common.DBUtility.DbHelperSQL.Query(strSql).Tables[0];
                int rCount = Convert.ToInt32(Rc.Common.DBUtility.DbHelperSQL.GetSingle(strSqlCount).ToString());
                int inum   = 0;
                for (int i = 0; i < dtRes.Rows.Count; i++)
                {
                    inum++;
                    string docName = dtRes.Rows[i]["Resource_Name"].ToString().ReplaceForFilter();
                    listReturn.Add(new
                    {
                        inum            = (i + 1),
                        docId           = dtRes.Rows[i]["ResourceToResourceFolder_Id"].ToString(),
                        docName         = docName,
                        EnHomeWork_Name = HttpContext.Current.Server.UrlEncode(dtRes.Rows[i]["Resource_Name"].ToString().ReplaceForFilter()),
                        docTime         = pfunction.ConvertToLongDateTime(dtRes.Rows[i]["CreateTime"].ToString()),
                        HomeWork_Id     = dtRes.Rows[i]["HomeWork_Id"].ToString()
                    });
                }
                #endregion

                if (inum > 0)
                {
                    return(JsonConvert.SerializeObject(new
                    {
                        err = "null",
                        PageIndex = PageIndex,
                        PageSize = PageSize,
                        TotalCount = rCount,
                        list = listReturn
                    }));
                }
                else
                {
                    return(JsonConvert.SerializeObject(new
                    {
                        err = "暂无数据"
                    }));
                }
            }
            catch (Exception)
            {
                return(JsonConvert.SerializeObject(new
                {
                    err = "error"//ex.Message.ToString()
                }));
            }
        }
コード例 #17
0
ファイル: DAL_F_User.cs プロジェクト: a157591984/jiguang
        public bool resettingPwd(Rc.Model.Resources.Model_F_User model, Model_Msg modelMsg)
        {
            Dictionary <string, SqlParameter[]> dictionary = new Dictionary <string, SqlParameter[]>();
            StringBuilder builder = new StringBuilder();

            builder.Append("update F_User set ");
            builder.Append("UserName=@UserName,");
            builder.Append("Password=@Password,");
            builder.Append("TrueName=@TrueName,");
            builder.Append("UserIdentity=@UserIdentity,");
            builder.Append("Birthday=@Birthday,");
            builder.Append("Sex=@Sex,");
            builder.Append("Email=@Email,");
            builder.Append("Mobile=@Mobile,");
            builder.Append("Province=@Province,");
            builder.Append("City=@City,");
            builder.Append("County=@County,");
            builder.Append("School=@School,");
            builder.Append("CreateTime=@CreateTime,");
            builder.Append("Stoken=@Stoken,");
            builder.Append("StokenTime=@StokenTime,");
            builder.Append("Resource_Version=@Resource_Version,");
            builder.Append("GradeTerm=@GradeTerm,");
            builder.Append("Subject=@Subject,");
            builder.Append("UserPost=@UserPost,");
            builder.Append("ExpirationDate=@ExpirationDate");
            builder.Append(" where UserId=@UserId ");
            SqlParameter[] parameterArray = new SqlParameter[] {
                new SqlParameter("@UserName", SqlDbType.VarChar, 50), new SqlParameter("@Password", SqlDbType.Char, 0x20), new SqlParameter("@TrueName", SqlDbType.NVarChar, 250), new SqlParameter("@UserIdentity", SqlDbType.Char, 1), new SqlParameter("@Birthday", SqlDbType.DateTime), new SqlParameter("@Sex", SqlDbType.Char, 1), new SqlParameter("@Email", SqlDbType.VarChar, 200), new SqlParameter("@Mobile", SqlDbType.VarChar, 20), new SqlParameter("@Province", SqlDbType.NVarChar, 250), new SqlParameter("@City", SqlDbType.NVarChar, 250), new SqlParameter("@County", SqlDbType.NVarChar, 250), new SqlParameter("@School", SqlDbType.NVarChar, 250), new SqlParameter("@CreateTime", SqlDbType.DateTime), new SqlParameter("@Stoken", SqlDbType.NVarChar, 50), new SqlParameter("@StokenTime", SqlDbType.DateTime), new SqlParameter("@Resource_Version", SqlDbType.Char, 0x24),
                new SqlParameter("@GradeTerm", SqlDbType.Char, 0x24), new SqlParameter("@Subject", SqlDbType.Char, 0x24), new SqlParameter("@UserPost", SqlDbType.Char, 0x24), new SqlParameter("@ExpirationDate", SqlDbType.DateTime), new SqlParameter("@UserId", SqlDbType.Char, 0x24)
            };
            parameterArray[0].Value    = model.UserName;
            parameterArray[1].Value    = model.Password;
            parameterArray[2].Value    = model.TrueName;
            parameterArray[3].Value    = model.UserIdentity;
            parameterArray[4].Value    = model.Birthday;
            parameterArray[5].Value    = model.Sex;
            parameterArray[6].Value    = model.Email;
            parameterArray[7].Value    = model.Mobile;
            parameterArray[8].Value    = model.Province;
            parameterArray[9].Value    = model.City;
            parameterArray[10].Value   = model.County;
            parameterArray[11].Value   = model.School;
            parameterArray[12].Value   = model.CreateTime;
            parameterArray[13].Value   = model.Stoken;
            parameterArray[14].Value   = model.StokenTime;
            parameterArray[15].Value   = model.Resource_Version;
            parameterArray[0x10].Value = model.GradeTerm;
            parameterArray[0x11].Value = model.Subject;
            parameterArray[0x12].Value = model.UserPost;
            parameterArray[0x13].Value = model.ExpirationDate;
            parameterArray[20].Value   = model.UserId;
            dictionary.Add(builder.ToString(), parameterArray);
            builder = new StringBuilder();
            builder.Append("insert into Msg(");
            builder.Append("MsgId,MsgEnum,MsgTypeEnum,ResourceDataId,MsgTitle,MsgContent,MsgStatus,MsgSender,MsgAccepter,CreateTime,CreateUser)");
            builder.Append(" values (");
            builder.Append("@MsgId,@MsgEnum,@MsgTypeEnum,@ResourceDataId,@MsgTitle,@MsgContent,@MsgStatus,@MsgSender,@MsgAccepter,@CreateTime,@CreateUser)");
            SqlParameter[] parameterArray2 = new SqlParameter[] { new SqlParameter("@MsgId", SqlDbType.Char, 0x24), new SqlParameter("@MsgEnum", SqlDbType.VarChar, 20), new SqlParameter("@MsgTypeEnum", SqlDbType.VarChar, 20), new SqlParameter("@ResourceDataId", SqlDbType.Char, 0x24), new SqlParameter("@MsgTitle", SqlDbType.NVarChar, 100), new SqlParameter("@MsgContent", SqlDbType.NVarChar, 500), new SqlParameter("@MsgStatus", SqlDbType.VarChar, 20), new SqlParameter("@MsgSender", SqlDbType.Char, 0x24), new SqlParameter("@MsgAccepter", SqlDbType.Char, 0x24), new SqlParameter("@CreateTime", SqlDbType.DateTime), new SqlParameter("@CreateUser", SqlDbType.Char, 0x24) };
            parameterArray2[0].Value  = modelMsg.MsgId;
            parameterArray2[1].Value  = modelMsg.MsgEnum;
            parameterArray2[2].Value  = modelMsg.MsgTypeEnum;
            parameterArray2[3].Value  = modelMsg.ResourceDataId;
            parameterArray2[4].Value  = modelMsg.MsgTitle;
            parameterArray2[5].Value  = modelMsg.MsgContent;
            parameterArray2[6].Value  = modelMsg.MsgStatus;
            parameterArray2[7].Value  = modelMsg.MsgSender;
            parameterArray2[8].Value  = modelMsg.MsgAccepter;
            parameterArray2[9].Value  = modelMsg.CreateTime;
            parameterArray2[10].Value = modelMsg.CreateUser;
            dictionary.Add(builder.ToString(), parameterArray2);
            return(DbHelperSQL.ExecuteSqlTran(dictionary) > 0);
        }