public List <PersonStruct> GetAccesList() { string query = "SELECT FelhasznaloTipusok.Tipus from FelhasznaloTipusok", error = string.Empty; SqlDataReader rdr = myExecuteReader(query, ref error); List <PersonStruct> accList = new List <PersonStruct>(); if (error == "OK") { while (rdr.Read()) { PersonStruct item = new PersonStruct(); item.Hozzaferesek = rdr[0].ToString(); accList.Add(item); } } CloseConnection(); return(accList); }
public List <PersonStruct> GetPersonNameList() { string query = "SELECT Szemelyek.Nev from Szemelyek order by Nev", error = string.Empty; SqlDataReader rdr = myExecuteReader(query, ref error); List <PersonStruct> persList = new List <PersonStruct>(); if (error == "OK") { while (rdr.Read()) { PersonStruct item = new PersonStruct(); item.szemelyName = rdr[0].ToString(); persList.Add(item); } } CloseConnection(); return(persList); }
public List <PersonStruct> GetPersonDataList() { string query = "SELECT Szemelyek.Nev, Szemelyek.CNP from Szemelyek order by Szemelyek.Nev", error = string.Empty; SqlDataReader rdr = myExecuteReader(query, ref error); List <PersonStruct> persList = new List <PersonStruct>(); if (error == "OK") { while (rdr.Read()) { PersonStruct item = new PersonStruct(); int year = Convert.ToInt32(DateTime.Now.Year.ToString()); int month = Convert.ToInt32(DateTime.Now.Month.ToString()); int day = Convert.ToInt32(DateTime.Now.Day.ToString()); int tempYear = Convert.ToInt32("19" + rdr[1].ToString().Substring(1, 2)); int tempMonth = Convert.ToInt32(rdr[1].ToString().Substring(3, 2)); int tempDay = Convert.ToInt32(rdr[1].ToString().Substring(5, 2)); int ev; if (month > tempMonth || (month == tempMonth && day >= tempDay)) { ev = year - tempYear; } else { ev = year - tempYear - 1; } item.szemelyName = rdr[0].ToString(); item.szemelyCNP = rdr[1].ToString(); item.eletkor = ev; persList.Add(item); } } CloseConnection(); return(persList); }