示例#1
0
        /// <summary>
        /// Selects Contact records by PK
        /// </summary>
        public static ContactDO[] GetByPK(Int32 ContactID)
        {
            SqlParameter _ContactID = new SqlParameter("ContactID", SqlDbType.Int);

            _ContactID.Value = ContactID;

            SqlParameter[] _params = new SqlParameter[] {
                _ContactID
            };

            SafeReader sr = DataCommon.ExecuteSafeReader("[dbo].[Contact_GetByPK]", _params, "dbo");

            List<ContactDO> objs = new List<ContactDO>();

            while(sr.Read())
            {
                ContactDO obj = new ContactDO();

                obj.ContactID = sr.GetInt32(sr.GetOrdinal("ContactID"));
                obj.ContactTypeID = sr.GetString(sr.GetOrdinal("ContactTypeID"));
                obj.PermitKey = sr.GetInt32(sr.GetOrdinal("PermitKey"));
                obj.AddressID = sr.GetInt32(sr.GetOrdinal("AddressID"));
                if (sr.IsDBNull(sr.GetOrdinal("SalutationID"))) { obj.SalutationID = null; } else { obj.SalutationID = sr.GetString(sr.GetOrdinal("SalutationID")); }
                if (sr.IsDBNull(sr.GetOrdinal("FirstName"))) { obj.FirstName = null; } else { obj.FirstName = sr.GetString(sr.GetOrdinal("FirstName")); }
                if (sr.IsDBNull(sr.GetOrdinal("LastName"))) { obj.LastName = null; } else { obj.LastName = sr.GetString(sr.GetOrdinal("LastName")); }
                if (sr.IsDBNull(sr.GetOrdinal("Title"))) { obj.Title = null; } else { obj.Title = sr.GetString(sr.GetOrdinal("Title")); }
                if (sr.IsDBNull(sr.GetOrdinal("CompanyID"))) { obj.CompanyID = null; } else { obj.CompanyID = sr.GetInt32(sr.GetOrdinal("CompanyID")); }
                if (sr.IsDBNull(sr.GetOrdinal("TaxID"))) { obj.TaxID = null; } else { obj.TaxID = sr.GetString(sr.GetOrdinal("TaxID")); }
                if (sr.IsDBNull(sr.GetOrdinal("Phone"))) { obj.Phone = null; } else { obj.Phone = sr.GetString(sr.GetOrdinal("Phone")); }
                if (sr.IsDBNull(sr.GetOrdinal("PhoneExtension"))) { obj.PhoneExtension = null; } else { obj.PhoneExtension = sr.GetString(sr.GetOrdinal("PhoneExtension")); }
                if (sr.IsDBNull(sr.GetOrdinal("Fax"))) { obj.Fax = null; } else { obj.Fax = sr.GetString(sr.GetOrdinal("Fax")); }
                if (sr.IsDBNull(sr.GetOrdinal("Email"))) { obj.Email = null; } else { obj.Email = sr.GetString(sr.GetOrdinal("Email")); }
                if (sr.IsDBNull(sr.GetOrdinal("LegalEntityID"))) { obj.LegalEntityID = null; } else { obj.LegalEntityID = sr.GetString(sr.GetOrdinal("LegalEntityID")); }
                if (sr.IsDBNull(sr.GetOrdinal("OtherLegalEntityDescription"))) { obj.OtherLegalEntityDescription = null; } else { obj.OtherLegalEntityDescription = sr.GetString(sr.GetOrdinal("OtherLegalEntityDescription")); }
                if (sr.IsDBNull(sr.GetOrdinal("LegalStructureDescription"))) { obj.LegalStructureDescription = null; } else { obj.LegalStructureDescription = sr.GetString(sr.GetOrdinal("LegalStructureDescription")); }
                if (sr.IsDBNull(sr.GetOrdinal("DateOfIncorporation"))) { obj.DateOfIncorporation = null; } else { obj.DateOfIncorporation = sr.GetDateTime(sr.GetOrdinal("DateOfIncorporation")); }
                if (sr.IsDBNull(sr.GetOrdinal("StateOfIncorporationID"))) { obj.StateOfIncorporationID = null; } else { obj.StateOfIncorporationID = sr.GetString(sr.GetOrdinal("StateOfIncorporationID")); }
                if (sr.IsDBNull(sr.GetOrdinal("ResponsiblePartyForAbandonedMineReclamationFee"))) { obj.ResponsiblePartyForAbandonedMineReclamationFee = null; } else { obj.ResponsiblePartyForAbandonedMineReclamationFee = sr.GetString(sr.GetOrdinal("ResponsiblePartyForAbandonedMineReclamationFee")); }
                if (sr.IsDBNull(sr.GetOrdinal("OwnershipTypeID"))) { obj.OwnershipTypeID = null; } else { obj.OwnershipTypeID = sr.GetString(sr.GetOrdinal("OwnershipTypeID")); }
                if (sr.IsDBNull(sr.GetOrdinal("OwnershipStatusID"))) { obj.OwnershipStatusID = null; } else { obj.OwnershipStatusID = sr.GetString(sr.GetOrdinal("OwnershipStatusID")); }
                if (sr.IsDBNull(sr.GetOrdinal("DatePositionAssumed"))) { obj.DatePositionAssumed = null; } else { obj.DatePositionAssumed = sr.GetDateTime(sr.GetOrdinal("DatePositionAssumed")); }
                if (sr.IsDBNull(sr.GetOrdinal("DateOfDeparture"))) { obj.DateOfDeparture = null; } else { obj.DateOfDeparture = sr.GetDateTime(sr.GetOrdinal("DateOfDeparture")); }
                if (sr.IsDBNull(sr.GetOrdinal("PercentageOfOwnership"))) { obj.PercentageOfOwnership = null; } else { obj.PercentageOfOwnership = sr.GetDecimal(sr.GetOrdinal("PercentageOfOwnership")); }
                if (sr.IsDBNull(sr.GetOrdinal("RelationshipToApplicant"))) { obj.RelationshipToApplicant = null; } else { obj.RelationshipToApplicant = sr.GetString(sr.GetOrdinal("RelationshipToApplicant")); }
                if (sr.IsDBNull(sr.GetOrdinal("OtherPermitTypeID"))) { obj.OtherPermitTypeID = null; } else { obj.OtherPermitTypeID = sr.GetString(sr.GetOrdinal("OtherPermitTypeID")); }
                if (sr.IsDBNull(sr.GetOrdinal("OtherPermitStatusID"))) { obj.OtherPermitStatusID = null; } else { obj.OtherPermitStatusID = sr.GetString(sr.GetOrdinal("OtherPermitStatusID")); }
                if (sr.IsDBNull(sr.GetOrdinal("OtherPermitApplicationOrId"))) { obj.OtherPermitApplicationOrId = null; } else { obj.OtherPermitApplicationOrId = sr.GetString(sr.GetOrdinal("OtherPermitApplicationOrId")); }
                if (sr.IsDBNull(sr.GetOrdinal("Description"))) { obj.Description = null; } else { obj.Description = sr.GetString(sr.GetOrdinal("Description")); }
                if (sr.IsDBNull(sr.GetOrdinal("NameOfIssuingAuthority"))) { obj.NameOfIssuingAuthority = null; } else { obj.NameOfIssuingAuthority = sr.GetString(sr.GetOrdinal("NameOfIssuingAuthority")); }
                if (sr.IsDBNull(sr.GetOrdinal("DateOfApproval"))) { obj.DateOfApproval = null; } else { obj.DateOfApproval = sr.GetDateTime(sr.GetOrdinal("DateOfApproval")); }
                if (sr.IsDBNull(sr.GetOrdinal("DateOfDenial"))) { obj.DateOfDenial = null; } else { obj.DateOfDenial = sr.GetDateTime(sr.GetOrdinal("DateOfDenial")); }
                if (sr.IsDBNull(sr.GetOrdinal("MSHAID"))) { obj.MSHAID = null; } else { obj.MSHAID = sr.GetString(sr.GetOrdinal("MSHAID")); }
                if (sr.IsDBNull(sr.GetOrdinal("NameOfPublicOffice"))) { obj.NameOfPublicOffice = null; } else { obj.NameOfPublicOffice = sr.GetString(sr.GetOrdinal("NameOfPublicOffice")); }

                objs.Add(obj);
            }

            return objs.ToArray();
        }
示例#2
0
        /// <summary>
        /// Creates a new Contact record
        /// </summary>
        public static int Create(ContactDO DO)
        {
            SqlParameter _ContactTypeID = new SqlParameter("ContactTypeID", SqlDbType.VarChar);
            SqlParameter _PermitKey = new SqlParameter("PermitKey", SqlDbType.Int);
            SqlParameter _SalutationID = new SqlParameter("SalutationID", SqlDbType.VarChar);
            SqlParameter _FirstName = new SqlParameter("FirstName", SqlDbType.VarChar);
            SqlParameter _LastName = new SqlParameter("LastName", SqlDbType.VarChar);
            SqlParameter _Title = new SqlParameter("Title", SqlDbType.VarChar);
            SqlParameter _CompanyID = new SqlParameter("CompanyID", SqlDbType.Int);
            SqlParameter _AddressID = new SqlParameter("AddressID", SqlDbType.Int);
            SqlParameter _TaxID = new SqlParameter("TaxID", SqlDbType.VarChar);
            SqlParameter _Phone = new SqlParameter("Phone", SqlDbType.VarChar);
            SqlParameter _PhoneExtension = new SqlParameter("PhoneExtension", SqlDbType.VarChar);
            SqlParameter _Fax = new SqlParameter("Fax", SqlDbType.VarChar);
            SqlParameter _Email = new SqlParameter("Email", SqlDbType.VarChar);
            SqlParameter _LegalEntityID = new SqlParameter("LegalEntityID", SqlDbType.VarChar);
            SqlParameter _OtherLegalEntityDescription = new SqlParameter("OtherLegalEntityDescription", SqlDbType.VarChar);
            SqlParameter _LegalStructureDescription = new SqlParameter("LegalStructureDescription", SqlDbType.VarChar);
            SqlParameter _DateOfIncorporation = new SqlParameter("DateOfIncorporation", SqlDbType.DateTime);
            SqlParameter _StateOfIncorporationID = new SqlParameter("StateOfIncorporationID", SqlDbType.VarChar);
            SqlParameter _ResponsiblePartyForAbandonedMineReclamationFee = new SqlParameter("ResponsiblePartyForAbandonedMineReclamationFee", SqlDbType.VarChar);
            SqlParameter _OwnershipTypeID = new SqlParameter("OwnershipTypeID", SqlDbType.VarChar);
            SqlParameter _OwnershipStatusID = new SqlParameter("OwnershipStatusID", SqlDbType.VarChar);
            SqlParameter _DatePositionAssumed = new SqlParameter("DatePositionAssumed", SqlDbType.DateTime);
            SqlParameter _DateOfDeparture = new SqlParameter("DateOfDeparture", SqlDbType.DateTime);
            SqlParameter _PercentageOfOwnership = new SqlParameter("PercentageOfOwnership", SqlDbType.Decimal);
            SqlParameter _RelationshipToApplicant = new SqlParameter("RelationshipToApplicant", SqlDbType.VarChar);
            SqlParameter _OtherPermitTypeID = new SqlParameter("OtherPermitTypeID", SqlDbType.VarChar);
            SqlParameter _OtherPermitStatusID = new SqlParameter("OtherPermitStatusID", SqlDbType.VarChar);
            SqlParameter _OtherPermitApplicationOrId = new SqlParameter("OtherPermitApplicationOrId", SqlDbType.VarChar);
            SqlParameter _Description = new SqlParameter("Description", SqlDbType.VarChar);
            SqlParameter _NameOfIssuingAuthority = new SqlParameter("NameOfIssuingAuthority", SqlDbType.VarChar);
            SqlParameter _DateOfApproval = new SqlParameter("DateOfApproval", SqlDbType.DateTime);
            SqlParameter _DateOfDenial = new SqlParameter("DateOfDenial", SqlDbType.DateTime);
            SqlParameter _MSHAID = new SqlParameter("MSHAID", SqlDbType.VarChar);
            SqlParameter _NameOfPublicOffice = new SqlParameter("NameOfPublicOffice", SqlDbType.VarChar);

            _ContactTypeID.Value = DO.ContactTypeID;
            _PermitKey.Value = DO.PermitKey;
            _SalutationID.Value = DO.SalutationID;
            _FirstName.Value = DO.FirstName;
            _LastName.Value = DO.LastName;
            _Title.Value = DO.Title;
            _CompanyID.Value = DO.CompanyID;
            _AddressID.Value = DO.AddressID;
            _TaxID.Value = DO.TaxID;
            _Phone.Value = DO.Phone;
            _PhoneExtension.Value = DO.PhoneExtension;
            _Fax.Value = DO.Fax;
            _Email.Value = DO.Email;
            _LegalEntityID.Value = DO.LegalEntityID;
            _OtherLegalEntityDescription.Value = DO.OtherLegalEntityDescription;
            _LegalStructureDescription.Value = DO.LegalStructureDescription;
            _DateOfIncorporation.Value = DO.DateOfIncorporation;
            _StateOfIncorporationID.Value = DO.StateOfIncorporationID;
            _ResponsiblePartyForAbandonedMineReclamationFee.Value = DO.ResponsiblePartyForAbandonedMineReclamationFee;
            _OwnershipTypeID.Value = DO.OwnershipTypeID;
            _OwnershipStatusID.Value = DO.OwnershipStatusID;
            _DatePositionAssumed.Value = DO.DatePositionAssumed;
            _DateOfDeparture.Value = DO.DateOfDeparture;
            _PercentageOfOwnership.Value = DO.PercentageOfOwnership;
            _RelationshipToApplicant.Value = DO.RelationshipToApplicant;
            _OtherPermitTypeID.Value = DO.OtherPermitTypeID;
            _OtherPermitStatusID.Value = DO.OtherPermitStatusID;
            _OtherPermitApplicationOrId.Value = DO.OtherPermitApplicationOrId;
            _Description.Value = DO.Description;
            _NameOfIssuingAuthority.Value = DO.NameOfIssuingAuthority;
            _DateOfApproval.Value = DO.DateOfApproval;
            _DateOfDenial.Value = DO.DateOfDenial;
            _MSHAID.Value = DO.MSHAID;
            _NameOfPublicOffice.Value = DO.NameOfPublicOffice;

            SqlParameter[] _params = new SqlParameter[] {
                _ContactTypeID,
                _PermitKey,
                _SalutationID,
                _FirstName,
                _LastName,
                _Title,
                _CompanyID,
                _AddressID,
                _TaxID,
                _Phone,
                _PhoneExtension,
                _Fax,
                _Email,
                _LegalEntityID,
                _OtherLegalEntityDescription,
                _LegalStructureDescription,
                _DateOfIncorporation,
                _StateOfIncorporationID,
                _ResponsiblePartyForAbandonedMineReclamationFee,
                _OwnershipTypeID,
                _OwnershipStatusID,
                _DatePositionAssumed,
                _DateOfDeparture,
                _PercentageOfOwnership,
                _RelationshipToApplicant,
                _OtherPermitTypeID,
                _OtherPermitStatusID,
                _OtherPermitApplicationOrId,
                _Description,
                _NameOfIssuingAuthority,
                _DateOfApproval,
                _DateOfDenial,
                _MSHAID,
                _NameOfPublicOffice
            };

            return DataCommon.ExecuteScalar("[dbo].[Contact_Insert]", _params, "dbo");
        }
示例#3
0
        /// <summary>
        /// Deletes a Contact record
        /// </summary>
        public static int Delete(ContactDO DO)
        {
            SqlParameter _ContactID = new SqlParameter("ContactID", SqlDbType.Int);

            _ContactID.Value = DO.ContactID;

            SqlParameter[] _params = new SqlParameter[] {
                _ContactID
            };

            return DataCommon.ExecuteScalar("[dbo].[Contact_Delete]", _params, "dbo");
        }