public class Doctors :IObject
{
public Doctors()
}
[PrimaryKey, AutoIncrement]
public int ID { get; set; }
[MaxLength(25)]
public string Names { get; set; }
[MaxLength(40)]
public string Specialization { get; set; }
public string Username { get; set; }
public string Email { get; set; }
public int Phoneno { get; set; }
[MaxLength(20)]
public string Password { get; set; }
[MaxLength(30)]
public string Confirmpassword { get; set; }
public string Address { get; set; }
//------------------second table---------------------------//
public Patient()
[MaxLength (40)]
public string Name { get; set; }
public class ItemDatabaseGeneric
static object locker = new object();
SQLiteConnection database;
public ItemDatabaseGeneric()
database = new SQLiteConnection(databasePath);
database.CreateTable<Patient>();
database.CreateTable<Doctors>();
database.CreateTable<Clinicorhospital>();
string databasePath
get
var dbName = "ItemsSQLite.db3";
#if __IOS__
string folder = Environment.GetFolderPath(Environment.SpecialFolder.Personal);
folder = Path.Combine(folder, "..", "Library");
var databasePath = Path.Combine(folder, dbName);
#else
#if __ANDROID__
string folder = Environment.GetFolderPath (Environment.SpecialFolder.Personal);
// WinPhone
var databasePath = Path.Combine(Windows.Storage.ApplicationData.Current.LocalFolder.Path, dbName);;
#endif
return databasePath;
public IEnumerable<T> GetObjects<T>() where T : IObject, new()
lock(locker)
return (from i in database.Table<T>() select i).ToList();
public IEnumerable<T> GetFirstObjects<T>() where T : IObject, new()
lock (locker)
return database.Query<T>("SELECT * FROM Item WHERE Name = '+ Name +'");
public IEnumerable<T>Getnameobjects<T>() where T:IObject,new()
return database.Query<T>("select my_column from Item WHERE Name = '+ name +'");
// public IEnumerable<T> query = from dt in dtEmployees.AsEnumerable()
// select dt.Field<string>("Name");
public T GetObject<T>(string username) where T : IObject,new()
return database.Table<T>().FirstOrDefault(X => X.Username == username);
//public Task> GetPropertiesAsync()
//{
// return database.Table().ToListAsync();
//}
public T GetObject<T>(string username,string password) where T : IObject, new()
return database.Table<T>().FirstOrDefault(X => X.Username == username&& X.Password==password);
public int SaveObject<T>(T obj) where T : IObject
if (obj.ID != 0)
database.Update(obj);
return obj.ID;
else
return database.Insert(obj);
public int DeleteObject<T>(int id) where T : IObject, new()
return database.Delete<T>(id);
}}