示例#1
0
        protected CUserEntity CreateUser(CUserEntity newUser)
        {
            try
            {
                COrganizeEntity organize = new COrganizeEntity(ConnString).Load(Usr_Organize);

                // create resource for user's folder
                CResourceEntity folderRes = new CResourceEntity(ConnString);
                folderRes.Res_Name   = "";
                folderRes.Res_Parent = organize.Org_Resource;
                folderRes.Res_Type   = (int)RESOURCETYPE.FOLDERRESOURCE;
                folderRes.Res_Id     = folderRes.Insert();

                folderRes.Res_Name = folderRes.Res_Id.ToString() + newUser.Usr_Member;
                folderRes.Update();

                // create user's folder
                String userPath = folderRes.MakeFullPath();
                Directory.CreateDirectory(userPath);

                // create user
                newUser.Usr_Resource = folderRes.Res_Id;
                newUser.ConnString   = ConnString;
                newUser.Usr_Id       = newUser.Insert();
                return(newUser);
            }
            catch (Exception e)
            {
                throw e;
            }
        }
示例#2
0
        /// <summary>
        /// 更改关键字——赵英武
        /// </summary>
        /// <param name="resId"></param>
        /// <param name="keyword"></param>
        public void KeyWordChange(int resId, string keyword)
        {
            if (resId <= 0)
            {
                throw new Exception("系统错误");
            }

            CResourceEntity aRes = new CResourceEntity().Load(resId);

            aRes.Res_KeyWord = keyword;
            aRes.Update();
        }
示例#3
0
        /// <summary>
        /// 更新文件——赵英武
        /// </summary>
        /// <param name="resId"></param>
        /// <param name="fileName"></param>
        /// <param name="filePath"></param>
        /// <returns></returns>
        public CResourceEntity UpdateFile(int resId, String fileName, out String filePath)
        {
            CACLEntity acl = new CACLEntity();

            acl.Acl_Resource  = resId;
            acl.Acl_Operation = (int)ACLOPERATION.WRITE;
            if (!CheckPrivilege(acl))
            {
                throw new Exception("没有写权限");
            }

            CResourceEntity res  = new CResourceEntity().Load(resId);
            string          path = res.MakeFullPath();

            if (!System.IO.File.Exists(path))
            {
                throw new Exception("要更新的文件不存在!");
            }

            filePath     = path;
            res.Res_Name = fileName;
            res.Update();
            return(res);
        }