Persons Info class
using System;
using System.Diagnostics;
using System.IO;
using System.ServiceModel;
using System.Collections.Generic;
using System.Collections;
using System.Runtime.Serialization;
using System.Text;
namespace Common
{
[DataContract]
public class PersonsInfo
{
private int m_Id;
private string m_NickName;
private string m_FirstName;
private string m_LastName;
private DateTime m_Birthday;
private string m_Gender;
private int m_Status;
private string m_Email;
private SortedList<int, string> m_Contacts;
private bool m_NotPublic;
public PersonsInfo(int id, string firstname, string lastname, DateTime birthday, string gender, string nickname, string email, int status, bool notpulic)
{
m_Id = id;
m_LastName = lastname;
m_FirstName = firstname;
m_Birthday = birthday;
m_Gender = gender;
m_NickName = nickname;
m_Email = email;
m_Status = status;
m_Contacts = new SortedList<int, string>();
m_NotPublic = notpulic;
}
public PersonsInfo()
{ }
public bool AddContact(int id, string AltName)
{
if (!m_Contacts.ContainsKey(id) && !m_NotPublic)
{
m_Contacts.Add(id, AltName);
return true;
}
else return false;
}
[DataMember]
public int Id
{
get
{
return m_Id;
}
set { m_Id = value; }
}
[DataMember]
public string NickName
{
get
{
return m_NickName;
}
set { m_NickName = value; }
}
[DataMember]
public string FirstName
{
get
{
return m_FirstName;
}
set { m_FirstName = value; }
}
[DataMember]
public string LastName
{
get
{
return m_LastName;
}
set { m_LastName = value; }
}
[DataMember]
public DateTime Birthday
{
get
{
return m_Birthday;
}
set { m_Birthday = value; }
}
[DataMember]
public string Gender
{
get
{
return m_Gender;
}
set { m_Gender = value; }
}
[DataMember]
public int Status
{
get
{
return m_Status;
}
set { m_Status = value; }
}
[DataMember]
public string Email
{
get
{
return m_Email;
}
set { m_Email = value; }
}
[DataMember]
public SortedList<int, string> Contacts
{
get
{
if (!m_NotPublic)
return m_Contacts;
else return null;
}
set { m_Contacts = value; }
}
}
}
Related examples in the same category