Beispiel #1
0
        /// <summary>
        ///
        /// select a row from table t_RBSR_AUFW_u_Entitlement.
        /// </summary>
        /// <param name="ID"></param>
        /// <returns>returnGetEntitlement</returns>
        public returnGetEntitlement GetEntitlement(int ID)
        {
            returnGetEntitlement rv = new returnGetEntitlement();

            DBConnect();
            OdbcCommand cmd = _dbConnection.CreateCommand();

            cmd.CommandText = "select \"c_id\",\"c_u_StandardActivity\",\"c_u_RoleType\",\"c_u_System\",\"c_u_Platform\",\"c_u_EntitlementName\",\"c_u_EntitlementValue\",\"c_u_AuthObjName\",\"c_u_AuthObjValue\",\"c_u_FieldSecName\",\"c_u_FieldSecValue\",\"c_u_Level4SecName\",\"c_u_Level4SecValue\",\"c_u_Commentary\",\"c_u_GENmanifestValue\",\"c_u_Application\",\"c_u_CHECKSUM\",\"c_u_Status\" from \"t_RBSR_AUFW_u_Entitlement\" where \"c_id\"= ?";
            cmd.Parameters.Add("c_id", OdbcType.Int);
            cmd.Parameters["c_id"].Value = (object)ID;
            cmd.Connection = _dbConnection;
            OdbcDataReader dr    = cmd.ExecuteReader();
            int            drctr = 0;

            while (dr.Read())
            {
                drctr++;
                if (dr.IsDBNull(0))
                {
                    throw new Exception("Value 'null' is not allowed for 'ID'");
                }
                else
                {
                    rv.ID = dr.GetInt32(0);
                }
                if (dr.IsDBNull(1))
                {
                    throw new Exception("Value 'null' is not allowed for 'StandardActivity'");
                }
                else
                {
                    rv.StandardActivity = dr.GetString(1);
                }
                if (dr.IsDBNull(2))
                {
                    throw new Exception("Value 'null' is not allowed for 'RoleType'");
                }
                else
                {
                    rv.RoleType = dr.GetString(2);
                }
                if (dr.IsDBNull(3))
                {
                    throw new Exception("Value 'null' is not allowed for 'System'");
                }
                else
                {
                    rv.System = dr.GetString(3);
                }
                if (dr.IsDBNull(4))
                {
                    throw new Exception("Value 'null' is not allowed for 'Platform'");
                }
                else
                {
                    rv.Platform = dr.GetString(4);
                }
                if (dr.IsDBNull(5))
                {
                    throw new Exception("Value 'null' is not allowed for 'EntitlementName'");
                }
                else
                {
                    rv.EntitlementName = dr.GetString(5);
                }
                if (dr.IsDBNull(6))
                {
                    throw new Exception("Value 'null' is not allowed for 'EntitlementValue'");
                }
                else
                {
                    rv.EntitlementValue = dr.GetString(6);
                }
                if (dr.IsDBNull(7))
                {
                    rv.AuthObjName = null;
                }
                else
                {
                    rv.AuthObjName = dr.GetString(7);
                }
                if (dr.IsDBNull(8))
                {
                    rv.AuthObjValue = null;
                }
                else
                {
                    rv.AuthObjValue = dr.GetString(8);
                }
                if (dr.IsDBNull(9))
                {
                    rv.FieldSecName = null;
                }
                else
                {
                    rv.FieldSecName = dr.GetString(9);
                }
                if (dr.IsDBNull(10))
                {
                    rv.FieldSecValue = null;
                }
                else
                {
                    rv.FieldSecValue = dr.GetString(10);
                }
                if (dr.IsDBNull(11))
                {
                    rv.Level4SecName = null;
                }
                else
                {
                    rv.Level4SecName = dr.GetString(11);
                }
                if (dr.IsDBNull(12))
                {
                    rv.Level4SecValue = null;
                }
                else
                {
                    rv.Level4SecValue = dr.GetString(12);
                }
                if (dr.IsDBNull(13))
                {
                    rv.Commentary = null;
                }
                else
                {
                    rv.Commentary = dr.GetString(13);
                }
                if (dr.IsDBNull(14))
                {
                    rv.GENmanifestValue = null;
                }
                else
                {
                    rv.GENmanifestValue = dr.GetString(14);
                }
                if (dr.IsDBNull(15))
                {
                    throw new Exception("Value 'null' is not allowed for 'Application'");
                }
                else
                {
                    rv.Application = dr.GetString(15);
                }
                if (dr.IsDBNull(16))
                {
                    throw new Exception("Value 'null' is not allowed for 'CHECKSUM'");
                }
                else
                {
                    rv.CHECKSUM = dr.GetString(16);
                }
                if (dr.IsDBNull(17))
                {
                    rv.Status = null;
                }
                else
                {
                    rv.Status = dr.GetString(17);
                }
            }
            dr.Close();
            dr.Dispose();
            if (drctr != 1)
            {
                throw new Exception("Operation selected no rows!");
            }
            cmd.Dispose();
            DBClose();
            return(rv);
        }