コード例 #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
ファイル: RoleController.cs プロジェクト: zhanglc8801/WKT2015
        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);
 }
コード例 #5
0
 /// <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
ファイル: HomeController.cs プロジェクト: zhanglc8801/WKT2015
        /// <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;
 }
コード例 #8
0
 /// <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 [email protected] 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
ファイル: RoleController.cs プロジェクト: zhanglc8801/WKT2015
        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));
        }
コード例 #22
0
 /// <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;
 }