public bool AddRoleInfo(RoleInfoEntity roleInfoEntity)
        {
            bool flag = false;
            StringBuilder sqlCommandText = new StringBuilder();
            sqlCommandText.Append("@JournalID");
            sqlCommandText.Append(", @RoleName");
            sqlCommandText.Append(", @GroupID");
            sqlCommandText.Append(", @Note");

            DbCommand cmd = db.GetSqlStringCommand(String.Format("INSERT INTO dbo.RoleInfo ({0}) VALUES ({1})",sqlCommandText.ToString().Replace("@", ""),sqlCommandText.ToString()));

            db.AddInParameter(cmd,"@JournalID",DbType.Int64,roleInfoEntity.JournalID);
            db.AddInParameter(cmd, "@GroupID", DbType.Int16, roleInfoEntity.GroupID);
            db.AddInParameter(cmd,"@RoleName",DbType.AnsiString,roleInfoEntity.RoleName);
            db.AddInParameter(cmd,"@Note",DbType.AnsiString,roleInfoEntity.Note);

            try
            {
                db.ExecuteNonQuery(cmd);
                flag = true;
            }
            catch(SqlException sqlEx)
            {
                throw sqlEx;
            }
            return flag;
        }
 public ExecResult AddRole(RoleInfoEntity roleEntity)
 {
     ExecResult execResult = new ExecResult();
     IRoleInfoService roleService = ServiceContainer.Instance.Container.Resolve<IRoleInfoService>();
     try
     {
         bool flag = roleService.AddRoleInfo(roleEntity);
         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;
 }
Beispiel #3
0
        public ActionResult AddRole(RoleInfoEntity roleEntity)
        {
            roleEntity.JournalID = JournalID;
            roleEntity.GroupID = CurAuthor.GroupID;

            ISiteSystemFacadeService sysService = ServiceContainer.Instance.Container.Resolve<ISiteSystemFacadeService>();
            ExecResult exeResult = sysService.AddRole(roleEntity);
            return Content(JsonConvert.SerializeObject(exeResult));
        }
Beispiel #4
0
 /// <summary>
 /// 角色修改
 /// </summary>
 /// <returns></returns>
 public ActionResult Edit(long? RoleID)
 {
     RoleInfoEntity roleEntity = new RoleInfoEntity();
     if (RoleID != null)
     {
         ISiteSystemFacadeService sysService = ServiceContainer.Instance.Container.Resolve<ISiteSystemFacadeService>();
         roleEntity = sysService.GetRoleEntity(new RoleInfoQuery { RoleID = RoleID.Value});
     }
     return View(roleEntity);
 }
Beispiel #5
0
 /// <summary>
 /// 将实体数据存入存储媒介(持久化一个对象)
 /// </summary>
 /// <param name="roleInfo">RoleInfoEntity实体对象</param>
 /// <returns>true:存储成功 false:存储失败</returns>
 public bool AddRoleInfo(RoleInfoEntity roleInfo)
 {
     return RoleInfoBusProvider.AddRoleInfo(roleInfo);
 }
Beispiel #6
0
 /// <summary>
 /// 更新存储媒介中的实体数据
 /// </summary>
 /// <param name="roleInfo">RoleInfoEntity实体对象</param>
 /// <returns>true:更新成功 false:更新失败</returns>
 public bool UpdateRoleInfo(RoleInfoEntity roleInfo)
 {
     return RoleInfoBusProvider.UpdateRoleInfo(roleInfo);
 }
 /// <summary>
 /// 新增角色
 /// </summary>
 /// <param name="roleEntity"></param>
 /// <returns></returns>
 public ExecResult AddRole(RoleInfoEntity roleEntity)
 {
     HttpClientHelper clientHelper = new HttpClientHelper();
     ExecResult execResult = clientHelper.PostAuth<ExecResult, RoleInfoEntity>(GetAPIUrl(APIConstant.SYSADDROLEINFO), roleEntity);
     return execResult;
 }
Beispiel #8
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));
        }
 public RoleInfoEntity MakeRoleInfo(IDataReader dr)
 {
     RoleInfoEntity roleInfoEntity = null;
     if(dr.Read())
     {
      roleInfoEntity=new RoleInfoEntity();
      roleInfoEntity.RoleID = (Int64)dr["RoleID"];
      roleInfoEntity.JournalID = (Int64)dr["JournalID"];
      roleInfoEntity.RoleName = (String)dr["RoleName"];
      roleInfoEntity.Note = (String)dr["Note"];
      roleInfoEntity.GroupID = (Byte)dr["GroupID"];
      roleInfoEntity.AddDate = (DateTime)dr["AddDate"];
     }
     dr.Close();
     return roleInfoEntity;
 }
Beispiel #10
0
 /// <summary>
 /// 将实体数据存入存储媒介(持久化一个对象)
 /// </summary>
 /// <param name="roleInfo">RoleInfoEntity实体对象</param>
 /// <returns>true:存储成功 false:存储失败</returns>
 public bool AddRoleInfo(RoleInfoEntity roleInfo)
 {
     return RoleInfoDataAccess.Instance.AddRoleInfo(roleInfo);
 }
Beispiel #11
0
 /// <summary>
 /// 更新存储媒介中的实体数据
 /// </summary>
 /// <param name="roleInfo">RoleInfoEntity实体对象</param>
 /// <returns>true:更新成功 false:更新失败</returns>
 public bool UpdateRoleInfo(RoleInfoEntity roleInfo)
 {
     return RoleInfoDataAccess.Instance.UpdateRoleInfo(roleInfo);
 }
        public bool UpdateRoleInfo(RoleInfoEntity roleInfoEntity)
        {
            bool flag = false;
            StringBuilder whereCommandText = new StringBuilder();
            whereCommandText.Append("  RoleID=@RoleID AND JournalID=@JournalID");
            StringBuilder sqlCommandText = new StringBuilder();
            sqlCommandText.Append("RoleName=@RoleName");
            sqlCommandText.Append(", Note=@Note");
            sqlCommandText.Append(", GroupID=@GroupID");

            DbCommand cmd = db.GetSqlStringCommand(String.Format("UPDATE dbo.RoleInfo SET {0} WHERE  {1}",sqlCommandText.ToString(),whereCommandText.ToString()));

            db.AddInParameter(cmd,"@RoleID",DbType.Int64,roleInfoEntity.RoleID);
            db.AddInParameter(cmd,"@JournalID",DbType.Int64,roleInfoEntity.JournalID);
            db.AddInParameter(cmd,"@RoleName",DbType.AnsiString,roleInfoEntity.RoleName);
            db.AddInParameter(cmd,"@Note",DbType.AnsiString,roleInfoEntity.Note);
            db.AddInParameter(cmd,"@GroupID",DbType.Byte,roleInfoEntity.GroupID);

            try
            {
                db.ExecuteNonQuery(cmd);
                flag = true;
            }
            catch(SqlException sqlEx)
            {
                throw sqlEx;
            }
            return flag;
        }
 public List<RoleInfoEntity> MakeRoleInfoList(IDataReader dr)
 {
     List<RoleInfoEntity> list=new List<RoleInfoEntity>();
     while (dr.Read())
     {
         RoleInfoEntity roleInfoEntity = new RoleInfoEntity();
         roleInfoEntity.RoleID = (Int64)dr["RoleID"];
         roleInfoEntity.JournalID = (Int64)dr["JournalID"];
         roleInfoEntity.RoleName = (String)dr["RoleName"];
         roleInfoEntity.Note = (String)dr["Note"];
         roleInfoEntity.GroupID = (Byte)dr["GroupID"];
         roleInfoEntity.AddDate = (DateTime)dr["AddDate"];
         list.Add(roleInfoEntity);
     }
     dr.Close();
     return list;
 }
 public RoleInfoEntity MakeRoleInfo(DataRow dr)
 {
     RoleInfoEntity roleInfoEntity=null;
     if(dr!=null)
     {
          roleInfoEntity=new RoleInfoEntity();
          roleInfoEntity.RoleID = (Int64)dr["RoleID"];
          roleInfoEntity.JournalID = (Int64)dr["JournalID"];
          roleInfoEntity.RoleName = (String)dr["RoleName"];
          roleInfoEntity.Note = (String)dr["Note"];
          roleInfoEntity.GroupID = (Byte)dr["GroupID"];
          roleInfoEntity.AddDate = (DateTime)dr["AddDate"];
     }
     return roleInfoEntity;
 }
Beispiel #15
0
 /// <summary>
 /// 从存储媒介删除实体数据
 /// </summary>
 /// <param name="roleInfo">RoleInfoEntity实体对象</param>
 /// <returns>true:删除成功 false:删除失败</returns>
 public bool DeleteRoleInfo(RoleInfoEntity roleInfo)
 {
     return RoleInfoBusProvider.DeleteRoleInfo(roleInfo);
 }
Beispiel #16
0
 /// <summary>
 /// 从存储媒介删除实体数据
 /// </summary>
 /// <param name="roleInfo">RoleInfoEntity实体对象</param>
 /// <returns>true:删除成功 false:删除失败</returns>
 public bool DeleteRoleInfo(RoleInfoEntity roleInfo)
 {
     return RoleInfoDataAccess.Instance.DeleteRoleInfo(roleInfo);
 }
        public bool DeleteRoleInfo(RoleInfoEntity roleInfoEntity)
        {
            bool flag = false;
            StringBuilder sqlCommandText = new StringBuilder();
            sqlCommandText.Append("DELETE FROM dbo.RoleInfo");
            sqlCommandText.Append(" WHERE  RoleID=@RoleID");

            DbCommand cmd = db.GetSqlStringCommand(sqlCommandText.ToString());

            db.AddInParameter(cmd,"@RoleID",DbType.Int64,roleInfoEntity.RoleID);

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