Ejemplo n.º 1
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(Entity.ROLEINFO model)
        {
            StringBuilder strSql   = new StringBuilder();
            DbAPI         dbHelper = new DbAPI();

            strSql.Append("update ROLEINFO set ");

            strSql.Append(" F_ROLECODE = :F_ROLECODE , ");
            strSql.Append(" F_NAME = :F_NAME , ");
            strSql.Append(" F_DESCRIPTION = :F_DESCRIPTION  ");
            strSql.Append(" where F_ROLECODE=:F_ROLECODE  ");

            OracleParameter[] parameters =
            {
                new OracleParameter(":F_ROLECODE",    OracleType.VarChar,   36),
                new OracleParameter(":F_NAME",        OracleType.NVarChar),
                new OracleParameter(":F_DESCRIPTION", OracleType.NVarChar)
            };

            parameters[0].Value = model.F_ROLECODE;
            parameters[1].Value = model.F_NAME;
            parameters[2].Value = model.F_DESCRIPTION;
            int rows = dbHelper.ExecuteNonQuery(strSql.ToString(), parameters);

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public Entity.ROLEINFO GetModel(string F_ROLECODE)
        {
            StringBuilder strSql   = new StringBuilder();
            DbAPI         dbHelper = new DbAPI();

            strSql.Append("select F_ROLECODE, F_NAME, F_DESCRIPTION  ");
            strSql.Append("  from ROLEINFO ");
            strSql.Append(" where F_ROLECODE=:F_ROLECODE ");
            OracleParameter[] parameters =
            {
                new OracleParameter(":F_ROLECODE", OracleType.VarChar, 36)
            };
            parameters[0].Value = F_ROLECODE;


            Entity.ROLEINFO model = new Entity.ROLEINFO();
            DataTable       ds    = dbHelper.GetDataTable(strSql.ToString(), parameters);

            if (ds.Rows.Count > 0)
            {
                model.F_ROLECODE    = ds.Rows[0]["F_ROLECODE"].ToString();
                model.F_NAME        = ds.Rows[0]["F_NAME"].ToString();
                model.F_DESCRIPTION = ds.Rows[0]["F_DESCRIPTION"].ToString();

                return(model);
            }
            else
            {
                return(null);
            }
        }
        /// <summary>
        /// 新增/修改角色
        /// </summary>
        /// <param name="roleinfo">角色实体类</param>
        /// <returns>返回状态对象</returns>
        public dynamic EditRole(Entity.ROLEINFO roleinfo)
        {
            var  bn   = new ROLEINFO_BN();
            bool isOk = string.IsNullOrWhiteSpace(roleinfo.F_ROLECODE)
                ? bn.AddRoleMain(roleinfo)
                : bn.EditRoleMain(roleinfo);

            return(JsonConvert.DeserializeObject <dynamic>(isOk
                ? "{\"status\":true,\"msg\":\"\"}"
                : "{\"status\":false,\"msg\":\"\"}"));
        }