Esempio n. 1
0
        private static ContactSupplement PopulateFromDBDetailsObject(ContactSupplementDetails obj)
        {
            ContactSupplement objNew = new ContactSupplement();

            objNew.ContactNo         = obj.ContactNo;
            objNew.Birthday          = obj.Birthday;
            objNew.PartnerName       = obj.PartnerName;
            objNew.PartnerBirthday   = obj.PartnerBirthday;
            objNew.Anniversary       = obj.Anniversary;
            objNew.NumberOfChildren  = obj.NumberOfChildren;
            objNew.ChildName1        = obj.ChildName1;
            objNew.ChildBirthday1    = obj.ChildBirthday1;
            objNew.ChildName2        = obj.ChildName2;
            objNew.ChildBirthday2    = obj.ChildBirthday2;
            objNew.ChildName3        = obj.ChildName3;
            objNew.ChildBirthday3    = obj.ChildBirthday3;
            objNew.PersonalCellphone = obj.PersonalCellphone;
            objNew.FavouriteSport    = obj.FavouriteSport;
            objNew.FavouriteTeam     = obj.FavouriteTeam;
            objNew.Hobbies           = obj.Hobbies;
            objNew.Inactive          = obj.Inactive;
            objNew.UpdatedBy         = obj.UpdatedBy;
            objNew.DLUP              = obj.DLUP;
            objNew.GenderNo          = obj.GenderNo;
            objNew.MaritalStatusNo   = obj.MaritalStatusNo;
            objNew.ChildGenderNo1    = obj.ChildGenderNo1;
            objNew.ChildGenderNo2    = obj.ChildGenderNo2;
            objNew.ChildGenderNo3    = obj.ChildGenderNo3;
            objNew.MaritalStatusName = obj.MaritalStatusName;
            return(objNew);
        }
Esempio n. 2
0
        /// <summary>
        /// Get
        /// Calls [usp_select_ContactSupplement]
        /// </summary>
        public override ContactSupplementDetails Get(System.Int32?contactNo)
        {
            SqlConnection cn  = null;
            SqlCommand    cmd = null;

            try {
                cn                 = new SqlConnection(this.ConnectionString);
                cmd                = new SqlCommand("usp_select_ContactSupplement", cn);
                cmd.CommandType    = CommandType.StoredProcedure;
                cmd.CommandTimeout = 30;
                cmd.Parameters.Add("@ContactNo", SqlDbType.Int).Value = contactNo;
                cn.Open();
                DbDataReader reader = ExecuteReader(cmd, CommandBehavior.SingleRow);
                if (reader.Read())
                {
                    //return GetContactSupplementFromReader(reader);
                    ContactSupplementDetails obj = new ContactSupplementDetails();
                    obj.ContactNo         = GetReaderValue_Int32(reader, "ContactNo", 0);
                    obj.Birthday          = GetReaderValue_NullableDateTime(reader, "Birthday", null);
                    obj.PartnerName       = GetReaderValue_String(reader, "PartnerName", "");
                    obj.PartnerBirthday   = GetReaderValue_NullableDateTime(reader, "PartnerBirthday", null);
                    obj.Anniversary       = GetReaderValue_NullableDateTime(reader, "Anniversary", null);
                    obj.NumberOfChildren  = GetReaderValue_NullableInt32(reader, "NumberOfChildren", null);
                    obj.ChildName1        = GetReaderValue_String(reader, "ChildName1", "");
                    obj.ChildBirthday1    = GetReaderValue_NullableDateTime(reader, "ChildBirthday1", null);
                    obj.ChildName2        = GetReaderValue_String(reader, "ChildName2", "");
                    obj.ChildBirthday2    = GetReaderValue_NullableDateTime(reader, "ChildBirthday2", null);
                    obj.ChildName3        = GetReaderValue_String(reader, "ChildName3", "");
                    obj.ChildBirthday3    = GetReaderValue_NullableDateTime(reader, "ChildBirthday3", null);
                    obj.PersonalCellphone = GetReaderValue_String(reader, "PersonalCellphone", "");
                    obj.FavouriteSport    = GetReaderValue_String(reader, "FavouriteSport", "");
                    obj.FavouriteTeam     = GetReaderValue_String(reader, "FavouriteTeam", "");
                    obj.Hobbies           = GetReaderValue_String(reader, "Hobbies", "");
                    obj.Inactive          = GetReaderValue_Boolean(reader, "Inactive", false);
                    obj.UpdatedBy         = GetReaderValue_NullableInt32(reader, "UpdatedBy", null);
                    obj.DLUP              = GetReaderValue_DateTime(reader, "DLUP", DateTime.MinValue);
                    obj.GenderNo          = GetReaderValue_NullableInt32(reader, "GenderNo", null);
                    obj.MaritalStatusNo   = GetReaderValue_NullableInt32(reader, "MaritalStatusNo", null);
                    obj.ChildGenderNo1    = GetReaderValue_NullableInt32(reader, "ChildGenderNo1", null);
                    obj.ChildGenderNo2    = GetReaderValue_NullableInt32(reader, "ChildGenderNo2", null);
                    obj.ChildGenderNo3    = GetReaderValue_NullableInt32(reader, "ChildGenderNo3", null);
                    obj.MaritalStatusName = GetReaderValue_String(reader, "MaritalStatusName", "");
                    return(obj);
                }
                else
                {
                    return(null);
                }
            } catch (SqlException sqlex) {
                //LogException(sqlex);
                throw new Exception("Failed to get ContactSupplement", sqlex);
            } finally {
                cmd.Dispose();
                cn.Close();
                cn.Dispose();
            }
        }