コード例 #1
0
 public Contact(long clientId, long contactId, Contact.CONTACT_TYPE contactType)
 {
     _phones        = new List <Phone>();
     _clientId      = clientId;
     _contactId     = contactId;
     _contactTypeId = contactType;
 }
コード例 #2
0
 // typically used for creating a new employee on-the-fly, when doing shipment Assignments
 public Contact(long clientId, string fullName, long phoneNumber)
 {
     _phones        = new List <Phone>();
     _clientId      = clientId;
     _contactId     = -1; // new contact, that would need to be saved to the DB, if required
     _fullName      = fullName;
     _phoneNumber   = phoneNumber;
     _contactTypeId = CONTACT_TYPE.UNKNOWN;
 }
コード例 #3
0
ファイル: ContactManager.cs プロジェクト: Grace3579/PODParser
        public SortedList <long, Contact> getContactsByType(CONTACT_TYPE contactType, SqlConnection conn)
        {
            SortedList <long, Contact> contacts = new SortedList <long, Contact>();

            SqlCommand cmd = conn.CreateCommand();

            cmd.CommandType = System.Data.CommandType.StoredProcedure;

            //get the contacts
            cmd.CommandText = "spGetContactsByTypeId";
            SqlParameter paramContactType = new SqlParameter("@ContactTypeId", contactType);

            cmd.Parameters.Add(paramContactType);
            SqlDataReader dr = cmd.ExecuteReader();

            while (dr.Read())
            {
                Console.WriteLine(dr[0] + "-" + dr[1] + "-" + dr[2] + "-" + dr[3]
                                  + "-" + dr[4]);
                Contact currContact = new Contact(Convert.ToInt64(dr["CONTACT_ID"]));
                if (!DBNull.Value.Equals(dr["PREFIX"]))
                {
                    currContact.Prefix = Convert.ToString(dr["PREFIX"]);
                }

                currContact.FirstName = Convert.ToString(dr["FIRST_NAME"]);
                if (!DBNull.Value.Equals(dr["MIDDLE_INITIAL"]))
                {
                    currContact.MiddleInitial = Convert.ToString(dr["MIDDLE_INITIAL"]);
                }
                currContact.LastName     = Convert.ToString(dr["LAST_NAME"]);
                currContact.CreatedDtime = Convert.ToDateTime(dr["CREATED"]);
                if (!DBNull.Value.Equals(dr["UPDATED"]))
                {
                    currContact.UpadtedDtime = Convert.ToDateTime(dr["UPDATED"]);
                }
                currContact.Active = Convert.ToBoolean(dr["ACTIVE"]);

//                object timpestamp  = dr["TIME_STAMP"];

                contacts.Add(currContact.ContactId, currContact);
            }

            dr.Close();
            dr.Dispose();

            // get contact phone numbers
            cmd.Parameters.Clear();
            cmd.CommandText = "spGetContactPhonesByTypeId";
//            SqlParameter paramContactType = new SqlParameter("@ContactTypeId", contactType);

            cmd.Parameters.Add(paramContactType);
            dr = cmd.ExecuteReader();

            while (dr.Read())
            {
                Console.WriteLine(dr[0] + "-" + dr[1] + "-" + dr[2] + "-" + dr[3]
                                  + "-" + dr[4] + "-" + dr[5]);

                Phone currPhone = new Phone();
                currPhone.PhoneId      = Convert.ToInt64(dr["PHONE_ID"]);
                currPhone.PhoneTypeId  = Convert.ToInt64(dr["PHONE_TYPE_ID"]);
                currPhone.ContactId    = Convert.ToInt64(dr["CONTACT_ID"]);
                currPhone.CountryCode  = Convert.ToInt16(dr["COUNTRY_CODE"]);
                currPhone.AreaCode     = Convert.ToInt16(dr["AREA_CODE"]);
                currPhone.PhoneNumber  = Convert.ToInt32(dr["PHONE_NUMBER"]);
                currPhone.CreatedDtime = Convert.ToDateTime(dr["CREATED"]);
                if (!DBNull.Value.Equals(dr["UPDATED"]))
                {
                    currPhone.UpadtedDtime = Convert.ToDateTime(dr["UPDATED"]);
                }
                currPhone.EffectiveFrom = Convert.ToDateTime(dr["EFF_FROM"]);
                currPhone.EffectiveTo   = Convert.ToDateTime(dr["EFF_TO"]);
                currPhone.UserCode      = Convert.ToString(dr["USER_CODE"]);

                contacts[currPhone.ContactId].addPhone(currPhone);
            }

            return(contacts);
        }
コード例 #4
0
 public Contact(long clientId, long contactId)
 {
     _phones        = new List <Phone>();
     _clientId      = clientId;
     _contactTypeId = CONTACT_TYPE.UNKNOWN;
 }