Example #1
0
        /// <summary>
        /// Create a new PersonalDetail object.
        /// </summary>
        /// <param name="autoId">Initial value of the AutoId property.</param>
        public static PersonalDetail CreatePersonalDetail(global::System.Int32 autoId)
        {
            PersonalDetail personalDetail = new PersonalDetail();

            personalDetail.AutoId = autoId;
            return(personalDetail);
        }
Example #2
0
        public IList <PersonalDetail> LoadData()
        {
            IList <PersonalDetail> list = new List <PersonalDetail>();

            using (SqlConnection conn = new SqlConnection(_connStr))
            {
                string sql = "SELECT * FROM PersonalDetails ORDER BY FirstName ASC";
                using (SqlCommand cmd = new SqlCommand(sql, conn))
                {
                    conn.Open();
                    using (SqlDataReader reader = cmd.ExecuteReader(CommandBehavior.CloseConnection))
                    {
                        while (reader.Read())
                        {
                            PersonalDetail pd = new PersonalDetail()
                            {
                                Active    = reader.GetBoolean(reader.GetOrdinal("Active")),
                                AutoId    = reader.GetInt32(reader.GetOrdinal("AutoId")),
                                FirstName = reader.GetString(reader.GetOrdinal("FirstName")),
                                LastName  = reader.GetString(reader.GetOrdinal("LastName")),
                                Age       = reader.GetInt32(reader.GetOrdinal("Age"))
                            };

                            list.Add(pd);
                        }
                    }
                }
            }

            return(list);
        }
Example #3
0
 /// <summary>
 /// Deprecated Method for adding a new object to the PersonalDetails EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToPersonalDetails(PersonalDetail personalDetail)
 {
     base.AddObject("PersonalDetails", personalDetail);
 }