예제 #1
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public MobileSoft.Model.Sys.Tb_Sys_Role GetModel(string RoleCode)
        {
            SqlParameter[] parameters =
            {
                new SqlParameter("@RoleCode", SqlDbType.NVarChar, 50)
            };
            parameters[0].Value = RoleCode;

            MobileSoft.Model.Sys.Tb_Sys_Role model = new MobileSoft.Model.Sys.Tb_Sys_Role();
            DataSet ds = DbHelperSQL.RunProcedure("Proc_Tb_Sys_Role_GetModel", parameters, "ds");

            if (ds.Tables[0].Rows.Count > 0)
            {
                model.RoleCode     = ds.Tables[0].Rows[0]["RoleCode"].ToString();
                model.RoleName     = ds.Tables[0].Rows[0]["RoleName"].ToString();
                model.RoleDescribe = ds.Tables[0].Rows[0]["RoleDescribe"].ToString();
                if (ds.Tables[0].Rows[0]["IsSysRole"].ToString() != "")
                {
                    model.IsSysRole = int.Parse(ds.Tables[0].Rows[0]["IsSysRole"].ToString());
                }
                if (ds.Tables[0].Rows[0]["CommID"].ToString() != "")
                {
                    model.CommID = int.Parse(ds.Tables[0].Rows[0]["CommID"].ToString());
                }
                model.DepCode     = ds.Tables[0].Rows[0]["DepCode"].ToString();
                model.SysRoleCode = ds.Tables[0].Rows[0]["SysRoleCode"].ToString();
                return(model);
            }
            else
            {
                return(null);
            }
        }
예제 #2
0
        /// <summary>
        ///  更新一条数据
        /// </summary>
        public void Update(MobileSoft.Model.Sys.Tb_Sys_Role model)
        {
            int rowsAffected;

            SqlParameter[] parameters =
            {
                new SqlParameter("@RoleCode",     SqlDbType.NVarChar,   20),
                new SqlParameter("@RoleName",     SqlDbType.NVarChar,   50),
                new SqlParameter("@RoleDescribe", SqlDbType.NVarChar, 1000),
                new SqlParameter("@IsSysRole",    SqlDbType.SmallInt,    2),
                new SqlParameter("@CommID",       SqlDbType.Int,         4),
                new SqlParameter("@DepCode",      SqlDbType.NVarChar,   20),
                new SqlParameter("@SysRoleCode",  SqlDbType.NVarChar, 20)
            };
            parameters[0].Value = model.RoleCode;
            parameters[1].Value = model.RoleName;
            parameters[2].Value = model.RoleDescribe;
            parameters[3].Value = model.IsSysRole;
            parameters[4].Value = model.CommID;
            parameters[5].Value = model.DepCode;
            parameters[6].Value = model.SysRoleCode;

            DbHelperSQL.RunProcedure("Proc_Tb_Sys_Role_Update", parameters, out rowsAffected);
        }