public static void InitializeContext(string appPath, string accessToken) { CaffeDbContext context = new CaffeDbContext(new Uri(appPath)); context.SendingRequest += new EventHandler<SendingRequestEventArgs>(OnSendingRequest); context.MergeOption = System.Data.Services.Client.MergeOption.OverwriteChanges; _instance = context; }
public ManagerMainPageModel() { _context = CaffeDataContext.Instance; StatsPeriod = 0; Cashiers = new List<Cashier>(); CashierStats = new List<CashierStatsModel>(); }
public ManagerMainPage(Manager manager) { InitializeComponent(); _context = CaffeDataContext.Instance; Model = new ManagerMainPageModel() { Name = manager.Name, }; DataContext = Model; Model.UpdateCashiersList(); }
public ManagerMainPage(CafeManagerLib.SharedModels.UserClientModel userModel) { InitializeComponent(); _context = CaffeDataContext.Instance; Model = new ManagerMainPageModel() { Name = userModel.Name, }; DataContext = Model; Model.UpdateCashiersList(); }
public SuperuserMainPageViewModel(String superuserName) { _context = CaffeDataContext.Instance; var superuser = _context.Superusers.Expand(m => m.Managers).Where(s => s.Login == superuserName).FirstOrDefault(); if (superuser != null) { Model = superuser; } else { throw new KeyNotFoundException(); } _addManagerCommand = new AsyncCommand(async () => { AddManager(); }); }
public override async Task GrantResourceOwnerCredentials(OAuthGrantResourceOwnerCredentialsContext context) { context.OwinContext.Response.Headers.Add("Access-Control-Allow-Origin", new[] { "*" }); User user; using (CaffeDbContext _db = new CaffeDbContext()) { user = _db.GetUserByName(context.UserName); if (user == null || context.Password != user.Password) { context.SetError("invalid_grant", "The user name or password is incorrect."); return; } } var identity = new ClaimsIdentity(context.Options.AuthenticationType); identity.AddClaim(new Claim(ClaimTypes.Name, user.Login)); identity.AddClaim(new Claim(ClaimTypes.Role, user.Role.ToString())); context.Validated(identity); }
public CashierPageModel() { _context = CaffeDataContext.Instance; Menu = _context.MenuItems.ToList(); CurrentOrder = new List<OrderItem>(); }