public bool PostConnectionWay(ConnectionWay connectionWay) { string userIdFinder = (from a in db.User where a.Email == connectionWay.Email select a.UserId).FirstOrDefault(); int qrCodeId = (from a in db.QrCode where a.UserId == userIdFinder select a.QrCodeId).FirstOrDefault(); int qrcodIdLoser = (from a in db.TrackQrCode where a.QrcodeId == qrCodeId select a.QrcodeId).FirstOrDefault(); string userIdLoser = (from a in db.QrCode where a.QrCodeId == qrcodIdLoser select a.UserId).FirstOrDefault(); User user = db.User.Find(userIdLoser); user.ConnectionWay = connectionWay.Connection; try { db.SaveChanges(); return(true); } catch { return(false); } }
public DataSource(string con, ConnectionWay way) { connectionStr = con; switch (way) { case ConnectionWay.ADO: items = new ADOItemsGateway(connectionStr); itemGroups = new ADOItemGroupsGateway(connectionStr); suppliers = new ADOSuppliersGateway(connectionStr); break; case ConnectionWay.EF: items = new EFItemsGateway(connectionStr); itemGroups = new EFItemGroupsGateway(connectionStr); suppliers = new EFSuppliersGateway(connectionStr); break; } }