private void SaveCustomerLogin() { var documentsPath = Environment.GetFolderPath(Environment.SpecialFolder.Personal); var libraryPath = Path.Combine(documentsPath, DBConstant.SEPARATOR, DBConstant.LIBRARY);// Library Folder var DbPath = Path.Combine(libraryPath, DBConstant.DB_NAME); var conn = new SQLite.SQLiteConnection(DbPath); conn.CreateTable <CustomerValue>(); var record = new CustomerValue { CustomerLogin = true, CustomerLastName = AppDelegate.appDelegate.GuestLastName, CustomerEmail = AppDelegate.appDelegate.GuestEmail, CustomerPhone = AppDelegate.appDelegate.GuestPhone, StoreId = AppDelegate.appDelegate.storeId }; using (var db = new SQLite.SQLiteConnection(DbPath)) { var existingRecord = (db.Table <CustomerValue>().Where(c => c.CustomerLastName == record.CustomerLastName)).SingleOrDefault(); if (existingRecord != null) { existingRecord.CustomerLogin = record.CustomerLogin; existingRecord.CustomerLastName = record.CustomerLastName; existingRecord.CustomerEmail = record.CustomerEmail; existingRecord.CustomerPhone = record.CustomerPhone; existingRecord.StoreId = record.StoreId; db.Update(existingRecord); } else { db.Insert(record); } } }
public ReflectionExtensionsTests() { Customer = new CustomerValue(); }