Пример #1
0
 public ExecResult DelRole(RoleInfoQuery queryRole)
 {
     ExecResult execResult = new ExecResult();
     IRoleInfoService roleService = ServiceContainer.Instance.Container.Resolve<IRoleInfoService>();
     try
     {
         bool flag = roleService.BatchDeleteRoleInfo(queryRole);
         if (flag)
         {
             execResult.result = EnumJsonResult.success.ToString();
             execResult.msg = "删除角色成功";
         }
         else
         {
             execResult.result = EnumJsonResult.failure.ToString();
             execResult.msg = "删除角色失败,请检查输入的角色信息";
         }
     }
     catch (Exception ex)
     {
         execResult.result = EnumJsonResult.error.ToString();
         execResult.msg = "删除角色信息时出现异常:" + ex.Message;
         WKT.Log.LogProvider.Instance.Error("删除角色信息时出现异常:" + ex.Message);
     }
     return execResult;
 }
Пример #2
0
        public ActionResult DelRole(long[] IDAarry)
        {
            ExecResult exeResult = new ExecResult();
            if (IDAarry == null || IDAarry.Length == 0)
            {
                exeResult.msg = "请选择要删除的角色";
                exeResult.result = EnumJsonResult.failure.ToString();
                return Content(JsonConvert.SerializeObject(exeResult));
            }
            RoleInfoQuery roleQuery = new RoleInfoQuery();
            roleQuery.JournalID = JournalID;
            roleQuery.RoleIDList = IDAarry.ToList<long>();

            ISiteSystemFacadeService sysService = ServiceContainer.Instance.Container.Resolve<ISiteSystemFacadeService>();
            exeResult = sysService.DelRole(roleQuery);
            return Content(JsonConvert.SerializeObject(exeResult));
        }
Пример #3
0
 /// <summary>
 /// 得到角色Dict
 /// </summary>
 /// <param name="query"></param>
 /// <returns></returns>
 public IDictionary<long, string> GetRoleInfoDict(RoleInfoQuery query)
 {
     return RoleInfoBusProvider.GetRoleInfoDict(query);
 }
Пример #4
0
 /// <summary>
 /// 获取所有符合查询条件的数据
 /// </summary>
 /// <param name="roleInfoQuery">RoleInfoQuery查询实体对象</param>
 /// <returns>List<RoleInfoEntity></returns>
 public List<RoleInfoEntity> GetRoleInfoList(RoleInfoQuery roleInfoQuery)
 {
     return RoleInfoBusProvider.GetRoleInfoList(roleInfoQuery);
 }
 /// <summary>
 /// 删除角色
 /// </summary>
 /// <param name="queryRole"></param>
 /// <returns></returns>
 public ExecResult DelRole(RoleInfoQuery queryRole)
 {
     HttpClientHelper clientHelper = new HttpClientHelper();
     ExecResult execResult = clientHelper.PostAuth<ExecResult, RoleInfoQuery>(GetAPIUrl(APIConstant.SYSDELROLEINFO), queryRole);
     return execResult;
 }
Пример #6
0
        /// <summary>
        /// 角色下拉框控件
        /// </summary>
        /// <param name="id"></param>
        /// <param name="width"></param>
        /// <returns></returns>
        private string SelectRole(string id, string width)
        {
            StringBuilder sb = new StringBuilder();
            sb.AppendFormat("<select id=\"{0}\" name=\"{1}\" style=\"width:{2};border:0px;\" class=\"input-select\">", id, id, width);
            RoleInfoQuery roleQuery = new RoleInfoQuery();
            roleQuery.JournalID = SiteConfig.SiteID;
            roleQuery.GroupID = (int)EnumMemberGroup.Editor;
            ISiteSystemFacadeService sysService = ServiceContainer.Instance.Container.Resolve<ISiteSystemFacadeService>();
            IList<RoleInfoEntity> listRole = sysService.GetRoleList(roleQuery);

            foreach (RoleInfoEntity item in listRole)
            {
                // 当前用户的角色
                if (CurAuthor.RoleIDList.Contains(item.RoleID))
                {
                    if (item.RoleID == CurAuthor.RoleID)
                    {
                        sb.AppendFormat("<option value=\"{0}\" selected>{1}</option>", item.RoleID.ToString(), item.RoleName);
                    }
                    else
                    {
                        sb.AppendFormat("<option value=\"{0}\">{1}</option>", item.RoleID.ToString(), item.RoleName);
                    }
                }
            }
            sb.AppendFormat("<option value=\"{0}\">{1}</option>", 2, "投稿作者");
            sb.AppendFormat("<option value=\"{0}\">{1}</option>", 3, "审稿专家");
            sb.Append("</select>");
            return sb.ToString();
        }
Пример #7
0
 public List<RoleInfoEntity> GetRoleInfoList(RoleInfoQuery query)
 {
     List<RoleInfoEntity> list = new List<RoleInfoEntity>();
     StringBuilder sqlCommandText = new StringBuilder();
     sqlCommandText.Append("SELECT RoleID,JournalID,RoleName,Note,GroupID,AddDate FROM dbo.RoleInfo WITH(NOLOCK)");
     string whereSQL = RoleInfoQueryToSQLWhere(query);
     string orderBy=RoleInfoQueryToSQLOrder(query);
     if(!string.IsNullOrEmpty(whereSQL)) sqlCommandText.Append(" WHERE " + whereSQL);
     if(!string.IsNullOrEmpty(orderBy)) sqlCommandText.Append(" ORDER BY " + orderBy);
     DbCommand cmd = db.GetSqlStringCommand(sqlCommandText.ToString());
     using(IDataReader dr = db.ExecuteReader(cmd))
     {
         list = MakeRoleInfoList(dr);
     }
     return list;
 }
 /// <summary>
 /// 获取角色列表
 /// </summary>
 /// <param name="roleQuery"></param>
 /// <returns></returns>
 public IList<RoleInfoEntity> GetRoleList(RoleInfoQuery roleQuery)
 {
     HttpClientHelper clientHelper = new HttpClientHelper();
     IList<RoleInfoEntity> listRole = clientHelper.PostAuth<IList<RoleInfoEntity>, RoleInfoQuery>(GetAPIUrl(APIConstant.SYSGETROLELIST), roleQuery);
     return listRole;
 }
Пример #9
0
 public RoleInfoEntity GetRoleEntity(RoleInfoQuery roleQuery)
 {
     IRoleInfoService roleService = ServiceContainer.Instance.Container.Resolve<IRoleInfoService>();
     RoleInfoEntity roleEntity = roleService.GetRoleInfo(roleQuery.RoleID.Value);
     return roleEntity;
 }
Пример #10
0
 /// <summary>
 /// 将查询实体转换为Order语句
 /// <param name="query">查询实体</param>
 /// <returns>获取Order语句,不包含Order</returns>
 /// </summary>
 public string RoleInfoQueryToSQLOrder(RoleInfoQuery query)
 {
     return " RoleID DESC";
 }
Пример #11
0
 /// <summary>
 /// 得到角色Dict
 /// </summary>
 /// <param name="query"></param>
 /// <returns></returns>
 public IDictionary<long, string> GetRoleInfoDict(RoleInfoQuery query)
 {
     return RoleInfoDataAccess.Instance.GetRoleInfoDict(query);
 }
Пример #12
0
 /// <summary>
 /// 获取所有符合查询条件的数据
 /// </summary>
 /// <param name="roleInfoQuery">RoleInfoQuery查询实体对象</param>
 /// <returns>List<RoleInfoEntity></returns>
 public List<RoleInfoEntity> GetRoleInfoList(RoleInfoQuery roleInfoQuery)
 {
     return RoleInfoDataAccess.Instance.GetRoleInfoList(roleInfoQuery);
 }
Пример #13
0
 /// <summary>
 /// 批量删除
 /// </summary>
 /// <param name="roleID"></param>
 /// <returns>true:删除成功 false:删除失败</returns>
 public bool BatchDeleteRoleInfo(RoleInfoQuery queryRole)
 {
     return RoleInfoDataAccess.Instance.BatchDeleteRoleInfo(queryRole);
 }
Пример #14
0
        /// <summary>
        /// 批量删除
        /// </summary>
        /// <param name="roleID"></param>
        /// <returns>true:删除成功 false:删除失败</returns>
        public bool BatchDeleteRoleInfo(RoleInfoQuery queryRole)
        {
            bool flag = false;
            StringBuilder sqlCommandText = new StringBuilder();
            sqlCommandText.AppendFormat("DELETE FROM dbo.RoleInfo WHERE JournalID=@JournalID AND RoleID IN ({0})", string.Join(",", queryRole.RoleIDList));

            DbCommand cmd = db.GetSqlStringCommand(sqlCommandText.ToString());
            db.AddInParameter(cmd, "@JournalID", DbType.Int64, queryRole.JournalID);

            try
            {
                db.ExecuteNonQuery(cmd);
                flag = true;
            }
            catch(SqlException sqlEx)
            {
                throw sqlEx;
            }

            return flag;
        }
Пример #15
0
 /// <summary>
 /// 将查询实体转换为Where语句
 /// <param name="query">查询实体</param>
 /// <returns>获取Where语句,不包含Where</returns>
 /// </summary>
 public string RoleInfoQueryToSQLWhere(RoleInfoQuery query)
 {
     StringBuilder sbWhere = new StringBuilder(" JournalID = " + query.JournalID);
     if (query.RoleID!= null)
     {
         sbWhere.Append(" AND RoleID = " + query.RoleID);
     }
     else
     {
         if (query.GroupID != null)
         {
             sbWhere.Append(" AND GroupID = ").Append(query.GroupID.Value);
         }
     }
     return sbWhere.ToString();
 }
Пример #16
0
 /// <summary>
 /// 分页获取符合查询条件的数据
 /// </summary>
 /// <param name="roleInfoQuery">RoleInfoQuery查询实体对象</param>
 /// <returns>Pager<RoleInfoEntity></returns>
 public Pager<RoleInfoEntity> GetRoleInfoPageList(RoleInfoQuery roleInfoQuery)
 {
     return RoleInfoBusProvider.GetRoleInfoPageList(roleInfoQuery);
 }
Пример #17
0
 public IList<RoleInfoEntity> GetRoleList(RoleInfoQuery roleQuery)
 {
     IRoleInfoService roleService = ServiceContainer.Instance.Container.Resolve<IRoleInfoService>();
     IList<RoleInfoEntity> listRole = roleService.GetRoleInfoList(roleQuery);
     return listRole;
 }
Пример #18
0
 /// <summary>
 /// 批量删除
 /// </summary>
 /// <param name="roleID"></param>
 /// <returns>true:删除成功 false:删除失败</returns>
 public bool BatchDeleteRoleInfo(RoleInfoQuery queryRole)
 {
     return RoleInfoBusProvider.BatchDeleteRoleInfo(queryRole);
 }
Пример #19
0
 public Pager<RoleInfoEntity> GetRoleInfoPageList(RoleInfoQuery query)
 {
     int recordCount=0;
     string whereSQL=RoleInfoQueryToSQLWhere(query);
     string orderBy=RoleInfoQueryToSQLOrder(query);
     DataSet ds=db.GetPagingData("RoleInfo","RoleID,JournalID,RoleName,Note,GroupID,AddDate",orderBy,whereSQL,query.CurrentPage,query.PageSize,out recordCount);
     Pager<RoleInfoEntity>  pager=new Pager<RoleInfoEntity>();
     if(ds!=null && ds.Tables.Count>0)
     {
          pager.ItemList= MakeRoleInfoList(ds.Tables[0]);
     }
     pager.CurrentPage=query.CurrentPage;
     pager.PageSize=query.PageSize;
     pager.TotalRecords=recordCount;
     return pager;
 }
Пример #20
0
 public IDictionary<long, string> GetRoleInfoDict(RoleInfoQuery roleQuery)
 {
     IRoleInfoService roleService = ServiceContainer.Instance.Container.Resolve<IRoleInfoService>();
     IDictionary<long, string> dictRoleInfo = roleService.GetRoleInfoDict(roleQuery);
     return dictRoleInfo;
 }
Пример #21
0
        public ActionResult GetRoleListAjax()
        {
            RoleInfoQuery roleQuery = new RoleInfoQuery();
            roleQuery.JournalID = JournalID;
            roleQuery.GroupID = CurAuthor.GroupID;
            ISiteSystemFacadeService sysService = ServiceContainer.Instance.Container.Resolve<ISiteSystemFacadeService>();
            IList<RoleInfoEntity> listRole = sysService.GetRoleList(roleQuery);

            # region 添加专家组
            RoleInfoEntity roleEntity = new RoleInfoEntity();
            roleEntity.RoleID = (long)EnumMemberGroup.Expert;
            roleEntity.RoleName = "专家组";
            roleEntity.GroupID = 3;
            listRole.Add(roleEntity);

            # endregion

            # region 添加英文专家组
            RoleInfoEntity roleEnEntity = new RoleInfoEntity();
            roleEnEntity.RoleID = (long)EnumMemberGroup.EnExpert;
            roleEnEntity.RoleName = "英文专家组";
            roleEnEntity.GroupID = 4;
            listRole.Add(roleEnEntity);

            # endregion

            var result = new { Rows = listRole };
            return Content(JsonConvert.SerializeObject(result));
        }
 /// <summary>
 /// 获取角色实体
 /// </summary>
 /// <param name="roleQuery"></param>
 /// <returns></returns>
 public RoleInfoEntity GetRoleEntity(RoleInfoQuery roleQuery)
 {
     HttpClientHelper clientHelper = new HttpClientHelper();
     RoleInfoEntity roleEntity = clientHelper.PostAuth<RoleInfoEntity, RoleInfoQuery>(GetAPIUrl(APIConstant.SYSGETROLEENTITY), roleQuery);
     return roleEntity;
 }
Пример #23
0
 /// <summary>
 /// 得到角色Dict
 /// </summary>
 /// <param name="query"></param>
 /// <returns></returns>
 public IDictionary<long, string> GetRoleInfoDict(RoleInfoQuery query)
 {
     IDictionary<long, string> dictRole = new Dictionary<long, string>();
     StringBuilder sqlCommandText = new StringBuilder();
     sqlCommandText.Append("SELECT RoleID,RoleName FROM dbo.RoleInfo WITH(NOLOCK)");
     string whereSQL = RoleInfoQueryToSQLWhere(query);
     if (!string.IsNullOrEmpty(whereSQL)) sqlCommandText.Append(" WHERE " + whereSQL);
     DbCommand cmd = db.GetSqlStringCommand(sqlCommandText.ToString());
     long RoleID = 0;
     using (IDataReader dr = db.ExecuteReader(cmd))
     {
         while (dr.Read())
         {
             RoleID = WKT.Common.Utils.TypeParse.ToLong(dr["RoleID"],0);
             if (!dictRole.ContainsKey(RoleID))
             {
                 dictRole.Add(RoleID, dr["RoleName"].ToString());
             }
         }
         dr.Close();
     }
     return dictRole;
 }