Beispiel #1
0
        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);
        }
Beispiel #2
0
        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);
        }
Beispiel #3
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 #4
0
        public List <RoleInfoEntity> MakeRoleInfoList(DataTable dt)
        {
            List <RoleInfoEntity> list = new List <RoleInfoEntity>();

            if (dt != null)
            {
                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    RoleInfoEntity roleInfoEntity = MakeRoleInfo(dt.Rows[i]);
                    list.Add(roleInfoEntity);
                }
            }
            return(list);
        }
Beispiel #5
0
        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 #6
0
        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 #7
0
        public RoleInfoEntity GetRoleInfo(Int64 roleID)
        {
            RoleInfoEntity roleInfoEntity = null;
            StringBuilder  sqlCommandText = new StringBuilder();

            sqlCommandText.Append("SELECT TOP 1  RoleID,JournalID,RoleName,Note,GroupID,AddDate FROM dbo.RoleInfo WITH(NOLOCK)");
            sqlCommandText.Append(" WHERE  RoleID=@RoleID");

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

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

            using (IDataReader dr = db.ExecuteReader(cmd))
            {
                roleInfoEntity = MakeRoleInfo(dr);
            }
            return(roleInfoEntity);
        }
Beispiel #8
0
        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);
        }
Beispiel #9
0
 /// <summary>
 /// 新增
 /// </summary>
 /// <param name="t_RoleInfo"></param>
 /// <returns></returns>
 public long InsertRoleInfo(RoleInfoDTO t_RoleInfo)
 {
     using (B2CDbContext ctx = new B2CDbContext())
     {
         List <SysFunEntity> sysFunEntities = new List <SysFunEntity>();
         foreach (var item in t_RoleInfo.SysfunIds)
         {
             sysFunEntities.Add(ctx.SysFuns.Where(u => u.Id == item).SingleOrDefault());
         }
         RoleInfoEntity roleInfoEntity = new RoleInfoEntity()
         {
             DisCount = t_RoleInfo.DisCount,
             RoleName = t_RoleInfo.RoleName,
             RoleDesc = t_RoleInfo.RoleDesc,
             SysFuns  = sysFunEntities
         };
         ctx.RolesInfo.Add(roleInfoEntity);
         ctx.SaveChanges();
         return(roleInfoEntity.Id);
     }
 }
Beispiel #10
0
        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);
        }
Beispiel #11
0
 /// <summary>
 /// 从存储媒介删除实体数据
 /// </summary>
 /// <param name="roleInfo">RoleInfoEntity实体对象</param>
 /// <returns>true:删除成功 false:删除失败</returns>
 public bool DeleteRoleInfo(RoleInfoEntity roleInfo)
 {
     return(RoleInfoDataAccess.Instance.DeleteRoleInfo(roleInfo));
 }
Beispiel #12
0
 /// <summary>
 /// 更新存储媒介中的实体数据
 /// </summary>
 /// <param name="roleInfo">RoleInfoEntity实体对象</param>
 /// <returns>true:更新成功 false:更新失败</returns>
 public bool UpdateRoleInfo(RoleInfoEntity roleInfo)
 {
     return(RoleInfoDataAccess.Instance.UpdateRoleInfo(roleInfo));
 }
Beispiel #13
0
 /// <summary>
 /// 将实体数据存入存储媒介(持久化一个对象)
 /// </summary>
 /// <param name="roleInfo">RoleInfoEntity实体对象</param>
 /// <returns>true:存储成功 false:存储失败</returns>
 public bool AddRoleInfo(RoleInfoEntity roleInfo)
 {
     return(RoleInfoDataAccess.Instance.AddRoleInfo(roleInfo));
 }
Beispiel #14
0
 /// <summary>
 /// 从存储媒介删除实体数据
 /// </summary>
 /// <param name="roleInfo">RoleInfoEntity实体对象</param>
 /// <returns>true:删除成功 false:删除失败</returns>
 public bool DeleteRoleInfo(RoleInfoEntity roleInfo)
 {
     return(RoleInfoBusProvider.DeleteRoleInfo(roleInfo));
 }
Beispiel #15
0
 /// <summary>
 /// 更新存储媒介中的实体数据
 /// </summary>
 /// <param name="roleInfo">RoleInfoEntity实体对象</param>
 /// <returns>true:更新成功 false:更新失败</returns>
 public bool UpdateRoleInfo(RoleInfoEntity roleInfo)
 {
     return(RoleInfoBusProvider.UpdateRoleInfo(roleInfo));
 }
Beispiel #16
0
 /// <summary>
 /// 将实体数据存入存储媒介(持久化一个对象)
 /// </summary>
 /// <param name="roleInfo">RoleInfoEntity实体对象</param>
 /// <returns>true:存储成功 false:存储失败</returns>
 public bool AddRoleInfo(RoleInfoEntity roleInfo)
 {
     return(RoleInfoBusProvider.AddRoleInfo(roleInfo));
 }