using System;

namespace Winson.EntityOP.Entity
{	
	/// <summary>
    /// Suppliers表实体类
    /// </summary>
	public class SuppliersDS
    {
        public SuppliersDS(){}
        
		#region 成员
		/// <summary>
		/// 获取或设置Supplierid(可读写)
		/// </summary>
		public int Supplierid{get;set;}
		/// <summary>
		/// 获取或设置Companyname(可读写)
		/// </summary>
		public string Companyname{get;set;}
		/// <summary>
		/// 获取或设置Contactname(可读写)
		/// </summary>
		public string Contactname{get;set;}
		/// <summary>
		/// 获取或设置Contacttitle(可读写)
		/// </summary>
		public string Contacttitle{get;set;}
		/// <summary>
		/// 获取或设置Address(可读写)
		/// </summary>
		public string Address{get;set;}
		/// <summary>
		/// 获取或设置City(可读写)
		/// </summary>
		public string City{get;set;}
		/// <summary>
		/// 获取或设置Region(可读写)
		/// </summary>
		public string Region{get;set;}
		/// <summary>
		/// 获取或设置Postalcode(可读写)
		/// </summary>
		public string Postalcode{get;set;}
		/// <summary>
		/// 获取或设置Country(可读写)
		/// </summary>
		public string Country{get;set;}
		/// <summary>
		/// 获取或设置Phone(可读写)
		/// </summary>
		public string Phone{get;set;}
		/// <summary>
		/// 获取或设置Fax(可读写)
		/// </summary>
		public string Fax{get;set;}
		/// <summary>
		/// 获取或设置Homepage(可读写)
		/// </summary>
		public string Homepage{get;set;}
		/// <summary>
		/// 获取字段数量(只读)
		/// </summary>
        public int Count{get { return 12; }}
        #endregion

		#region 索引器
        public object this[int index, int type, int maxID]
        {			 
			get
			{
				if(type==1)
                {
                    #region 返回字段名
                    switch (index)
                    {
						 case 0:
							 if (maxID > 0 || Supplierid > 0)
								 return "Supplierid";
							 else
								 return null;
						 case 1:
							 if(Companyname != null && Companyname.Length > 0)
								 return "Companyname";
							 else
								 return null;
						 case 2:
							 if(Contactname != null && Contactname.Length > 0)
								 return "Contactname";
							 else
								 return null;
						 case 3:
							 if(Contacttitle != null && Contacttitle.Length > 0)
								 return "Contacttitle";
							 else
								 return null;
						 case 4:
							 if(Address != null && Address.Length > 0)
								 return "Address";
							 else
								 return null;
						 case 5:
							 if(City != null && City.Length > 0)
								 return "City";
							 else
								 return null;
						 case 6:
							 if(Region != null && Region.Length > 0)
								 return "Region";
							 else
								 return null;
						 case 7:
							 if(Postalcode != null && Postalcode.Length > 0)
								 return "Postalcode";
							 else
								 return null;
						 case 8:
							 if(Country != null && Country.Length > 0)
								 return "Country";
							 else
								 return null;
						 case 9:
							 if(Phone != null && Phone.Length > 0)
								 return "Phone";
							 else
								 return null;
						 case 10:
							 if(Fax != null && Fax.Length > 0)
								 return "Fax";
							 else
								 return null;
						 case 11:
							 if(Homepage != null && Homepage.Length > 0)
								 return "Homepage";
							 else
								 return null;
                        default:
                            return null;                           
                    }
                    #endregion
                }
                else
                {
                    #region 返回字段值
                    switch (index)
                    {
						 case 0:
							 if (maxID > 0)
								 return maxID;
							 else if(Supplierid > 0)
								 return  Supplierid;
							 else
								 return null;
						 case 1:
								 return Companyname;
						 case 2:
								 return Contactname;
						 case 3:
								 return Contacttitle;
						 case 4:
								 return Address;
						 case 5:
								 return City;
						 case 6:
								 return Region;
						 case 7:
								 return Postalcode;
						 case 8:
								 return Country;
						 case 9:
								 return Phone;
						 case 10:
								 return Fax;
						 case 11:
								 return Homepage;
                        default:
                            return null;                           
                    }
                    #endregion
                }
			}	            
        }
		#endregion
	}
}


