/// <summary>
        /// 持久化一个新对象(保存新对象到存储媒介中)
        /// </summary>
        /// <param name="roleAuthor"></param>
        /// <returns></returns>
        public ExecResult AddRoleAuthor(RoleAuthorEntity roleAuthor)
        {
            ExecResult result = new ExecResult();

            try
            {
                IRoleAuthorService roleAuthorService = ServiceContainer.Instance.Container.Resolve <IRoleAuthorService>();
                bool flag = roleAuthorService.AddRoleAuthor(roleAuthor);
                if (flag)
                {
                    result.result = EnumJsonResult.success.ToString();
                    result.msg    = "成功";
                }
                else
                {
                    result.result = EnumJsonResult.failure.ToString();
                    result.msg    = "操作失败,请确认登录信息是否正确";
                }
            }
            catch (Exception ex)
            {
                result.result = EnumJsonResult.error.ToString();
                result.msg    = "更新角色作者信息时出现异常:" + ex.Message;
            }
            return(result);
        }
        /// <summary>
        /// 从存储媒介中删除对象
        /// </summary>
        /// <param name="roleAuthor"></param>
        /// <returns></returns>
        public ExecResult DeleteRoleAuthor(RoleAuthorEntity roleAuthor)
        {
            HttpClientHelper clientHelper = new HttpClientHelper();
            ExecResult       execResult   = clientHelper.PostAuth <ExecResult, RoleAuthorEntity>(GetAPIUrl(APIConstant.DELETEROLEAUTHOR), roleAuthor);

            return(execResult);
        }
Beispiel #3
0
        public bool UpdateRoleAuthor(RoleAuthorEntity roleAuthorEntity)
        {
            bool          flag             = false;
            StringBuilder whereCommandText = new StringBuilder();

            whereCommandText.Append("  MapID=@MapID");
            StringBuilder sqlCommandText = new StringBuilder();

            sqlCommandText.Append(" JournalID=@JournalID");
            sqlCommandText.Append(", RoleID=@RoleID");
            sqlCommandText.Append(", AuthorID=@AuthorID");
            sqlCommandText.Append(", AddDate=@AddDate");

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

            db.AddInParameter(cmd, "@MapID", DbType.Int64, roleAuthorEntity.MapID);
            db.AddInParameter(cmd, "@JournalID", DbType.Int64, roleAuthorEntity.JournalID);
            db.AddInParameter(cmd, "@RoleID", DbType.Int64, roleAuthorEntity.RoleID);
            db.AddInParameter(cmd, "@AuthorID", DbType.Int64, roleAuthorEntity.AuthorID);
            db.AddInParameter(cmd, "@AddDate", DbType.DateTime, roleAuthorEntity.AddDate);

            try
            {
                db.ExecuteNonQuery(cmd);
                flag = true;
            }
            catch (SqlException sqlEx)
            {
                throw sqlEx;
            }
            return(flag);
        }
Beispiel #4
0
        public bool DeleteRoleAuthor(RoleAuthorEntity roleAuthorEntity)
        {
            bool          flag           = false;
            StringBuilder sqlCommandText = new StringBuilder();

            sqlCommandText.Append("DELETE FROM dbo.RoleAuthor");
            sqlCommandText.Append(" WHERE  RoleID=@RoleID AND AuthorID=@AuthorID");

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

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


            try
            {
                db.ExecuteNonQuery(cmd);
                flag = true;
            }
            catch (SqlException sqlEx)
            {
                throw sqlEx;
            }
            return(flag);
        }
Beispiel #5
0
        /// <summary>
        /// 赋权
        /// </summary>
        /// <param name="roleAuthorEntity"></param>
        /// <returns></returns>
        public bool AddRoleAuthor(RoleAuthorEntity roleAuthorEntity)
        {
            bool          flag           = false;
            StringBuilder sqlCommandText = new StringBuilder();

            sqlCommandText.Append("@JournalID");
            sqlCommandText.Append(", @RoleID");
            sqlCommandText.Append(", @AuthorID");

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

            db.AddInParameter(cmd, "@JournalID", DbType.Int64, roleAuthorEntity.JournalID);
            db.AddInParameter(cmd, "@RoleID", DbType.Int64, roleAuthorEntity.RoleID);
            db.AddInParameter(cmd, "@AuthorID", DbType.Int64, roleAuthorEntity.AuthorID);

            try
            {
                db.ExecuteNonQuery(cmd);
                flag = true;
            }
            catch (SqlException sqlEx)
            {
                throw sqlEx;
            }
            return(flag);
        }
        /// <summary>
        /// 获取一个实体对象
        /// </summary>
        /// <param name="mapID"></param>
        /// <returns></returns>
        public RoleAuthorEntity GetRoleAuthor(long mapID)
        {
            HttpClientHelper clientHelper    = new HttpClientHelper();
            RoleAuthorQuery  roleAuthorQuery = new RoleAuthorQuery();

            roleAuthorQuery.MapID = mapID;
            RoleAuthorEntity roleAuthorEntity = clientHelper.PostAuth <RoleAuthorEntity, RoleAuthorQuery>(GetAPIUrl(APIConstant.GETROLEAUTHORLIST), roleAuthorQuery);

            return(roleAuthorEntity);
        }
Beispiel #7
0
        public List <RoleAuthorEntity> MakeRoleAuthorDetailList(DataTable dt)
        {
            List <RoleAuthorEntity> list = new List <RoleAuthorEntity>();

            if (dt != null)
            {
                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    RoleAuthorEntity roleAuthorEntity = MakeRoleAuthorDetail(dt.Rows[i]);
                    list.Add(roleAuthorEntity);
                }
            }
            return(list);
        }
Beispiel #8
0
        public RoleAuthorEntity MakeRoleAuthor(DataRow dr)
        {
            RoleAuthorEntity roleAuthorEntity = null;

            if (dr != null)
            {
                roleAuthorEntity           = new RoleAuthorEntity();
                roleAuthorEntity.MapID     = (Int64)dr["MapID"];
                roleAuthorEntity.JournalID = (Int64)dr["JournalID"];
                roleAuthorEntity.RoleID    = (Int64)dr["RoleID"];
                roleAuthorEntity.AuthorID  = (Int64)dr["AuthorID"];
                roleAuthorEntity.AddDate   = (DateTime)dr["AddDate"];
            }
            return(roleAuthorEntity);
        }
Beispiel #9
0
        public RoleAuthorEntity MakeRoleAuthor(IDataReader dr)
        {
            RoleAuthorEntity roleAuthorEntity = null;

            if (dr.Read())
            {
                roleAuthorEntity           = new RoleAuthorEntity();
                roleAuthorEntity.MapID     = (Int64)dr["MapID"];
                roleAuthorEntity.JournalID = (Int64)dr["JournalID"];
                roleAuthorEntity.RoleID    = (Int64)dr["RoleID"];
                roleAuthorEntity.AuthorID  = (Int64)dr["AuthorID"];
                roleAuthorEntity.AddDate   = (DateTime)dr["AddDate"];
            }
            dr.Close();
            return(roleAuthorEntity);
        }
Beispiel #10
0
        public List <RoleAuthorEntity> MakeRoleAuthorList(IDataReader dr)
        {
            List <RoleAuthorEntity> list = new List <RoleAuthorEntity>();

            while (dr.Read())
            {
                RoleAuthorEntity roleAuthorEntity = new RoleAuthorEntity();
                roleAuthorEntity.MapID     = (Int64)dr["MapID"];
                roleAuthorEntity.JournalID = (Int64)dr["JournalID"];
                roleAuthorEntity.RoleID    = (Int64)dr["RoleID"];
                roleAuthorEntity.AuthorID  = (Int64)dr["AuthorID"];
                roleAuthorEntity.AddDate   = (DateTime)dr["AddDate"];
                list.Add(roleAuthorEntity);
            }
            dr.Close();
            return(list);
        }
Beispiel #11
0
        public RoleAuthorEntity GetRoleAuthor(Int64 mapID)
        {
            RoleAuthorEntity roleAuthorEntity = null;
            StringBuilder    sqlCommandText   = new StringBuilder();

            sqlCommandText.Append("SELECT TOP 1  MapID,JournalID,RoleID,AuthorID,AddDate FROM dbo.RoleAuthor WITH(NOLOCK)");
            sqlCommandText.Append(" WHERE  MapID=@MapID");

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

            db.AddInParameter(cmd, "@MapID", DbType.Int64, mapID);

            using (IDataReader dr = db.ExecuteReader(cmd))
            {
                roleAuthorEntity = MakeRoleAuthor(dr);
            }
            return(roleAuthorEntity);
        }
Beispiel #12
0
        public RoleAuthorEntity MakeRoleAuthorDetail(DataRow dr)
        {
            RoleAuthorEntity roleAuthorEntity = null;

            if (dr != null)
            {
                roleAuthorEntity           = new RoleAuthorEntity();
                roleAuthorEntity.MapID     = (Int64)dr["MapID"];
                roleAuthorEntity.JournalID = (Int64)dr["JournalID"];
                roleAuthorEntity.RoleID    = (Int64)dr["RoleID"];
                roleAuthorEntity.RoleName  = (String)dr["RoleName"];
                roleAuthorEntity.AuthorID  = (Int64)dr["AuthorID"];
                roleAuthorEntity.RealName  = (String)dr["RealName"];
                roleAuthorEntity.LoginName = (String)dr["LoginName"];
                roleAuthorEntity.AddDate   = (DateTime)dr["AddDate"];
            }
            return(roleAuthorEntity);
        }
Beispiel #13
0
        public List <RoleAuthorEntity> MakeRoleAuthorDetailList(IDataReader dr)
        {
            List <RoleAuthorEntity> list = new List <RoleAuthorEntity>();

            while (dr.Read())
            {
                RoleAuthorEntity roleAuthorEntity = new RoleAuthorEntity();
                roleAuthorEntity.MapID     = (Int64)dr["MapID"];
                roleAuthorEntity.JournalID = (Int64)dr["JournalID"];
                roleAuthorEntity.RoleID    = (Int64)dr["RoleID"];
                roleAuthorEntity.RoleName  = dr["RoleName"] == System.DBNull.Value?"":(String)dr["RoleName"];
                roleAuthorEntity.AuthorID  = (Int64)dr["AuthorID"];
                roleAuthorEntity.RealName  = (String)dr["RealName"];
                roleAuthorEntity.LoginName = (String)dr["LoginName"];
                roleAuthorEntity.AddDate   = (DateTime)dr["AddDate"];
                list.Add(roleAuthorEntity);
            }
            dr.Close();
            return(list);
        }
Beispiel #14
0
 /// <summary>
 /// 更新存储媒介中的实体数据
 /// </summary>
 /// <param name="roleAuthor">RoleAuthorEntity实体对象</param>
 /// <returns>true:更新成功 false:更新失败</returns>
 public bool UpdateRoleAuthor(RoleAuthorEntity roleAuthor)
 {
     return(RoleAuthorBusProvider.UpdateRoleAuthor(roleAuthor));
 }
Beispiel #15
0
 /// <summary>
 /// 从存储媒介删除实体数据
 /// </summary>
 /// <param name="roleAuthor">RoleAuthorEntity实体对象</param>
 /// <returns>true:删除成功 false:删除失败</returns>
 public bool DeleteRoleAuthor(RoleAuthorEntity roleAuthor)
 {
     return(RoleAuthorBusProvider.DeleteRoleAuthor(roleAuthor));
 }
Beispiel #16
0
 /// <summary>
 /// 将实体数据存入存储媒介(持久化一个对象)
 /// </summary>
 /// <param name="roleAuthor">RoleAuthorEntity实体对象</param>
 /// <returns>true:存储成功 false:存储失败</returns>
 public bool AddRoleAuthor(RoleAuthorEntity roleAuthor)
 {
     return(RoleAuthorDataAccess.Instance.AddRoleAuthor(roleAuthor));
 }
Beispiel #17
0
 /// <summary>
 /// 从存储媒介删除实体数据
 /// </summary>
 /// <param name="roleAuthor">RoleAuthorEntity实体对象</param>
 /// <returns>true:删除成功 false:删除失败</returns>
 public bool DeleteRoleAuthor(RoleAuthorEntity roleAuthor)
 {
     return(RoleAuthorDataAccess.Instance.DeleteRoleAuthor(roleAuthor));
 }
Beispiel #18
0
 /// <summary>
 /// 将实体数据存入存储媒介(持久化一个对象)
 /// </summary>
 /// <param name="roleAuthor">RoleAuthorEntity实体对象</param>
 /// <returns>true:存储成功 false:存储失败</returns>
 public bool AddRoleAuthor(RoleAuthorEntity roleAuthor)
 {
     return(RoleAuthorBusProvider.AddRoleAuthor(roleAuthor));
 }