Ejemplo n.º 1
0
        /// <summary>
        /// 得到资源目录 table
        /// </summary>
        /// <param name="strResource_Class"></param>
        /// <param name="strResource_Type"></param>
        /// <param name="strSubject"></param>
        /// <param name="strResource_Version"></param>
        /// <param name="strGradeTerm"></param>
        /// <returns></returns>
        private DataTable GetResourceFolder(string strResource_Class, string strResource_Type, string strSubject, string strResource_Version, string strGradeTermActive)
        {
            string strWhere = string.Empty;

            strWhere = string.Format(@"  1=1
            AND Resource_Class='{0}'
            AND Resource_Type='{1}'
            ", strResource_Class, strResource_Type);
            if (strResource_Class == Resource_ClassConst.自有资源)
            {
                strWhere += string.Format(" AND CreateFUser ='******'", FloginUser.UserId);
            }
            else if (strResource_Class == Resource_ClassConst.云资源)
            {
                //if (strGradeTermActive!="")
                //{
                //    strWhere += string.Format(" AND GradeTerm ='{0}'", strGradeTermActive);
                //}

                // strWhere += string.Format(" AND Subject ='{0}'", strSubject);
                //strWhere += string.Format(" AND Resource_Version ='{0}'", strResource_Version);
                strWhere += string.Format(" AND Book_ID IN(SELECT Book_ID FROM UserBuyResources WHERE ResourceFolder.Book_ID=UserBuyResources.Book_id AND UserBuyResources.UserId='{0}' )"
                                          , FloginUser.UserId);
            }
            //else if (strResource_Class == Resource_ClassConst.共享资源)
            //{
            //    strWhere = " Resource_Type='" + strResource_Type + "' and  ResourceFolder_Id in(select distinct (ResourceFolder_Id) from ResourceShare where ShareObjectId=(select SchoolId from dbo.VW_UserOnClassGradeSchool where UserId='" + FloginUser.UserId + "'))";
            //}
            strWhere += " order by ResourceFolder_Order,ResourceFolder_Name ";
            DataTable dtResourceFolder = new Rc.BLL.Resources.BLL_ResourceFolder().GetList(strWhere).Tables[0];

            return(dtResourceFolder);
            //DataTable dtUser_GradeTerm = GetUser_GradeTerm();
            //return GetSubNaivNew(strResource_Type, dtUser_GradeTerm, strGradeTermActive);
        }
Ejemplo n.º 2
0
        private DataTable GetTestForder(string strResource_Class, string strResource_Type, string strUserGroup_IdActivity)
        {
            DataTable dtTestForder = new DataTable();
            string    strWhere     = string.Empty;

            strWhere  = string.Format(@"  1=1
            AND Resource_Class='{0}'
            AND Resource_Type='{1}'
            ", strResource_Class, strResource_Type);
            strWhere += string.Format(" AND ResourceFolder_Level>={0}", 4);//练习册只取第一级目录(云习题集第一级目录从4开始的)

            strWhere    += " ORDER BY ResourceFolder_Level,ResourceFolder_Order,ResourceFolder_Name";
            dtTestForder = new Rc.BLL.Resources.BLL_ResourceFolder().GetList(strWhere).Tables[0];
            return(dtTestForder);
        }
Ejemplo n.º 3
0
        private DataTable GetTestForder(string strResource_Class, string strResource_Type, string strSubject, string strResource_Version, string strUserGroup_IdActivity)
        {
            DataTable dtTestForder = new DataTable();
            string    strWhere     = string.Empty;

            strWhere  = string.Format(@"  1=1
            AND Resource_Class='{0}'
            AND Resource_Type='{1}'
            ", strResource_Class, strResource_Type);
            strWhere += string.Format("AND CreateFUser ='******'"
                                      , FloginUser.UserId);
            strWhere    += " ORDER BY ResourceFolder_Level,ResourceFolder_Order,ResourceFolder_Name";
            dtTestForder = new Rc.BLL.Resources.BLL_ResourceFolder().GetList(strWhere).Tables[0];
            return(dtTestForder);
        }
Ejemplo n.º 4
0
        private DataTable GetTestForder(string strResource_Class, string strResource_Type, string strSubject, string strResource_Version, string strUserGroup_IdActivity)
        {
            DataTable dtTestForder = new DataTable();
            string    strWhere     = string.Empty;

            strWhere  = string.Format(@"  1=1
            AND Resource_Class='{0}'
            AND Resource_Type='{1}'
            ", strResource_Class, strResource_Type);
            strWhere += string.Format(" AND ResourceFolder_Level>={0}", 4);//练习册只取第一级目录(云习题集第一级目录从4开始的)

            strWhere += string.Format(" AND Book_ID IN(SELECT Book_ID FROM UserBuyResources WHERE ResourceFolder.Book_ID=UserBuyResources.Book_id AND UserBuyResources.UserId='{0}' )"
                                      , FloginUser.UserId);
            strWhere    += " ORDER BY ResourceFolder_Level,ResourceFolder_Order,ResourceFolder_Name";
            dtTestForder = new Rc.BLL.Resources.BLL_ResourceFolder().GetList(strWhere).Tables[0];
            return(dtTestForder);
        }
Ejemplo n.º 5
0
        /// <summary>
        /// 资源属性
        /// </summary>
        /// <returns></returns>
        private StringBuilder GetResourceAttribute()
        {
            StringBuilder sb       = new StringBuilder();
            string        strWhere = string.Empty;

            strWhere = string.Empty;
            if (ddlResource_Version.SelectedValue != "-1" &&
                ddlLessonPlan_Type.SelectedValue != "-1" &&
                ddlGradeTerm.SelectedValue != "-1" &&
                ddlSubject.SelectedValue != "-1")
            {
                table_content.Visible = true;
                tableConfirm.Visible  = false;
                strWhere += string.Format(" 1=1 and Resource_Version='{0}' and LessonPlan_Type='{1}' and GradeTerm='{2}' and Subject='{3}' "
                                          , ddlResource_Version.SelectedValue.Filter()
                                          , ddlLessonPlan_Type.SelectedValue.Filter()
                                          , ddlGradeTerm.SelectedValue.Filter()
                                          , ddlSubject.SelectedValue.Filter()
                                          );
                strWhere += "  order by ResourceFolder_Name ";
                DataTable dt = new Rc.BLL.Resources.BLL_ResourceFolder().GetList(strWhere).Tables[0];
                if (dt.Rows.Count > 0)
                {
                    sb.Append(GetFolderHtml(dt));
                }
                else
                {
                    sb.Append("<div> 此目录位置下尚未维护目录,您可以在右方区域维护目录。</div>");
                }

                strHtml = new StringBuilder();
            }
            else
            {
                //如果条件不全不可维护目录。
                table_content.Visible = false;
                tableConfirm.Visible  = true;
            }

            return(sb);
        }
Ejemplo n.º 6
0
        /// <summary>
        /// 得到资源目录 table
        /// </summary>
        private DataTable GetResourceFolder(string strResource_Class, string strResource_Type)
        {
            string strWhere = string.Empty;

            strWhere = string.Format(@"  1=1
            AND Resource_Class='{0}'
            AND Resource_Type='{1}'
            ", strResource_Class, strResource_Type);
            if (strResource_Class == Resource_ClassConst.自有资源)
            {
                strWhere += string.Format(" AND CreateFUser ='******'", FloginUser.UserId);
            }
            else if (strResource_Class == Resource_ClassConst.云资源)
            {
                strWhere += string.Format(" AND Book_ID IN(SELECT Book_ID FROM UserBuyResources WHERE ResourceFolder.Book_ID=UserBuyResources.Book_id AND UserBuyResources.UserId='{0}' )"
                                          , FloginUser.UserId);
            }
            strWhere += " order by ResourceFolder_Order,ResourceFolder_Name ";
            DataTable dtResourceFolder = new Rc.BLL.Resources.BLL_ResourceFolder().GetList(strWhere).Tables[0];

            return(dtResourceFolder);
        }
Ejemplo n.º 7
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="InsertOrUpdate"></param>
        /// <returns></returns>
        private void SaveResourceFolder(int InsertOrUpdate)
        {
            string ResourceFolder_Id       = Guid.NewGuid().ToString();
            string ResourceFolder_ParentId = this.hidResourceFolder_ParentId.Value.Filter();
            string ResourceFolder_Name     = this.txtResourceFolder_Name.Text.Filter();

            int ResourceFolder_Level = GetTreeLevel(ResourceFolder_ParentId);

            string Resource_Type    = strResource_Type.Filter();
            string Resource_Class   = strResource_Class.Filter();
            string Resource_Version = ddlResource_Version.SelectedValue.Filter();
            //string ResourceFolder_Remark = this.txtResourceFolder_Remark.Text;
            //int ResourceFolder_Order = int.Parse(this.txtResourceFolder_Order.Text);
            string   ResourceFolder_Owner = loginUser.SysUser_ID;
            string   CreateFUser          = loginUser.SysUser_ID;
            string   LessonPlan_Type      = ddlLessonPlan_Type.SelectedValue.Filter();
            string   GradeTerm            = ddlGradeTerm.SelectedValue.Filter();
            string   Subject               = ddlSubject.SelectedValue.Filter();
            DateTime CreateTime            = DateTime.Now;
            string   ResourceFolder_isLast = this.ddlResourceFolder_isLast.SelectedValue.Filter();

            //如果插入
            if (InsertOrUpdate == 1)
            {
                ResourceFolder_Id = Guid.NewGuid().ToString();
            }
            else
            {
                ResourceFolder_Id = hidResourceFolder_Id.Value.Filter();
            }

            Rc.Model.Resources.Model_ResourceFolder model = new Rc.Model.Resources.Model_ResourceFolder();
            model.ResourceFolder_Id       = ResourceFolder_Id;
            model.ResourceFolder_ParentId = ResourceFolder_ParentId;
            model.ResourceFolder_Name     = ResourceFolder_Name;
            model.ResourceFolder_Level    = ResourceFolder_Level;
            model.Resource_Type           = Resource_Type;
            model.Resource_Class          = Resource_Class;
            model.Resource_Version        = Resource_Version;
            //model.ResourceFolder_Remark = ResourceFolder_Remark;
            //model.ResourceFolder_Order = ResourceFolder_Order;
            model.LessonPlan_Type       = LessonPlan_Type;
            model.GradeTerm             = GradeTerm;
            model.Subject               = Subject;
            model.ResourceFolder_Owner  = ResourceFolder_Owner;
            model.CreateFUser           = CreateFUser;
            model.CreateTime            = CreateTime;
            model.ResourceFolder_isLast = ResourceFolder_isLast;

            Rc.BLL.Resources.BLL_ResourceFolder bll = new Rc.BLL.Resources.BLL_ResourceFolder();
            bool b = true;

            if (InsertOrUpdate == 1)
            {
                b = bll.Add(model);
            }
            else if (InsertOrUpdate == 2)
            {
                b = bll.Update(model);
            }

            if (b)
            {
                OperationSuccess("操作成功。");
            }
            else
            {
                OperationFailed("操作失败。");
            }
            // litTree.Text = GetTreeHtml();
        }
Ejemplo n.º 8
0
        /// <summary>
        /// 得到请求内容
        /// </summary>
        /// <param name="context"></param>
        public void ProcessRequest(HttpContext context)
        {
            try
            {
                context.Response.ContentType = "text/plain";
                context.Response.Charset     = "utf-8";

                string   strResource_ID            = string.Empty;    //资源标识
                string   strFile_Suffix            = string.Empty;    //资源扩展名
                string   strFile_Name              = string.Empty;    //资源名称
                string   strResource_MD5           = string.Empty;    //资源MD5
                string   strResource_DataStream    = string.Empty;    //资源数据流
                int      strResource_ContentLength = 0;               //资源内容长度
                string   strResource_ContentHtml   = string.Empty;    //资源HTML内容
                string   strResourceFolder_Id      = string.Empty;    //资源所在文件夹标识
                DateTime strCreateTime             = DateTime.Now;    //资源上传时间

                string strResourceToResourceFolder_Id = string.Empty; //资源文件关系标识


                string strResource_Type  = string.Empty;   //资源类型
                string strResource_Class = string.Empty;   //资源类别
                string strFile_Owner     = string.Empty;   //资源所属
                string strCreateUser     = string.Empty;   //资源创建人

                string strResource_Version = string.Empty; //教材版本

                //教案类型
                string strLessonPlan_Type = string.Empty;
                //年级学期
                string strGradeTerm = string.Empty;
                //学科
                string strSubject = string.Empty;

                strResourceToResourceFolder_Id = Guid.NewGuid().ToString();
                //获取前端提交的文件流
                HttpPostedFile file = context.Request.Files["Filedata"];
                //获取文件的长度
                strResource_ContentLength = file.ContentLength;
                //获取文件名称
                strFile_Name = file.FileName;
                //获取的文件流转
                byte[] bytes = null;
                using (var binaryReader = new BinaryReader(file.InputStream))
                {
                    bytes = binaryReader.ReadBytes(file.ContentLength);
                }
                //在最后得到MD5 原因是 方法体内有清除stream的方法。

                strResource_DataStream = Convert.ToBase64String(bytes);
                strResource_MD5        = Rc.Common.StrUtility.clsUtility.GetMd5(strResource_DataStream);
                if (!String.IsNullOrEmpty(context.Request["fid"]))
                {
                    strResourceFolder_Id = context.Request["fid"].ToString().Filter();
                }
                if (!String.IsNullOrEmpty(context.Request["R_Version"]))
                {
                    strResource_Version = context.Request["R_Version"].ToString().Filter();
                }
                if (!String.IsNullOrEmpty(context.Request["LP_Type"]))
                {
                    strLessonPlan_Type = context.Request["LP_Type"].ToString().Filter();
                }
                if (!String.IsNullOrEmpty(context.Request["GT"]))
                {
                    strGradeTerm = context.Request["GT"].ToString().Filter();
                }
                if (!String.IsNullOrEmpty(context.Request["subj"]))
                {
                    strSubject = context.Request["subj"].ToString().Filter();
                }
                if (!String.IsNullOrEmpty(context.Request["R_Type"]))
                {
                    strResource_Type = context.Request["R_Type"].ToString().Filter();
                }
                if (!String.IsNullOrEmpty(context.Request["R_Class"]))
                {
                    strResource_Class = context.Request["R_Class"].ToString().Filter();
                }
                if (!String.IsNullOrEmpty(context.Request["uid"]))
                {
                    strFile_Owner = context.Request["uid"].ToString().Filter();
                    strCreateUser = context.Request["uid"].ToString().Filter();
                }

                if (file != null)
                {
                    if (file.FileName.LastIndexOf('.') != -1)
                    {
                        strFile_Suffix = file.FileName.Substring(file.FileName.LastIndexOf('.'), file.FileName.Length - file.FileName.LastIndexOf('.'));
                    }



                    string isExistResource = string.Empty;
                    isExistResource = new Rc.BLL.Resources.BLL_Resource().ExistsByMD5(strResource_MD5);
                    //服务器上没有这个文件则添加文件
                    if (isExistResource == "")
                    {
                        strResource_ID = Guid.NewGuid().ToString();
                        Model_Resource modelResource = new Model_Resource();
                        modelResource.Resource_Id            = strResource_ID;
                        modelResource.Resource_MD5           = strResource_MD5;
                        modelResource.Resource_DataStrem     = strResource_DataStream;
                        modelResource.Resource_ContentLength = strResource_ContentLength;

                        modelResource.CreateTime = strCreateTime;

                        //添加资源
                        bool i = new Rc.BLL.Resources.BLL_Resource().Add(modelResource);
                    }
                    else
                    {
                        strResource_ID = isExistResource;
                    }
                    //得到教材版本
                    List <Model_ResourceFolder> listmodelRf = new Rc.BLL.Resources.BLL_ResourceFolder().GetModelList(" ResourceFolder_ID = '" + strResourceFolder_Id + "'");
                    if (listmodelRf != null)
                    {
                        strResource_Version = listmodelRf[0].Resource_Version;
                    }
                    else
                    {
                        //如果没得到使用通用版
                        strResource_Version = Resource_VersionConst.通用版;
                    }
                    Model_ResourceToResourceFolder modelRTOF = new Model_ResourceToResourceFolder();
                    modelRTOF.ResourceToResourceFolder_Id = strResourceToResourceFolder_Id;
                    modelRTOF.ResourceFolder_Id           = strResourceFolder_Id;
                    modelRTOF.Resource_Id      = strResource_ID;
                    modelRTOF.File_Name        = strFile_Name;
                    modelRTOF.Resource_Name    = strFile_Name;
                    modelRTOF.Resource_Type    = strResource_Type;
                    modelRTOF.Resource_Class   = strResource_Class;
                    modelRTOF.Resource_Version = strResource_Version;
                    modelRTOF.LessonPlan_Type  = strLessonPlan_Type;
                    modelRTOF.GradeTerm        = strGradeTerm;
                    modelRTOF.Subject          = strSubject;

                    modelRTOF.File_Suffix = strFile_Suffix;
                    modelRTOF.File_Owner  = strFile_Owner;
                    modelRTOF.CreateFUser = strCreateUser;
                    modelRTOF.CreateTime  = strCreateTime;

                    //添加资源与文件的关系
                    bool j = new Rc.BLL.Resources.BLL_ResourceToResourceFolder().Add(modelRTOF);
                }

                context.Response.Write("1");
            }
            catch (Exception ex)
            {
                context.Response.Write(ex.Message.ToString());
            }
        }