public Administrator(string username, string password, UserEnum userType) { this.username = username; this.password = password; this.userType = userType; this.id = Guid.NewGuid(); }
public void SeeActivity(IUser user, string password, UserEnum type) { if (string.Equals(user.Password, password)) { //Utilities.ShowActivity(user); } }
private void CreateAccount_Click(object sender, EventArgs e) { this.Name = this.textName.Text; this.Password = this.textPassword.Text; Role = UserEnum.User; try { passwordAndLogin.Add(Name, Password); User user = new User() { Name = this.textName.Text, Password = this.textPassword.Text, Role = UserEnum.User }; users.Add(user); string serializeString = JsonConvert.SerializeObject(users, Formatting.Indented, new JsonSerializerSettings { ReferenceLoopHandling = ReferenceLoopHandling.Ignore }); File.WriteAllText(UserDataPath, serializeString); this.DialogResult = DialogResult.OK; } catch (ArgumentException) { MessageBox.Show(@"User name is exist"); } catch (Exception exception) { MessageBox.Show(exception.Message); } }
public Administrator(string username, string password, UserEnum userType) { Username = username; //Password = password; UserType = userType; ID = Guid.NewGuid(); }
internal ShoppingCart GetShoppingCart(UserEnum userId) { return(userId switch { UserEnum.Quantrell => new ShoppingCart() { UserId = UserEnum.Quantrell, Items = new List <CartItem>() { new CartItem() { ItemName = "Cherry MX Red Switches", Quantity = 104 } } }, UserEnum.Greta => new ShoppingCart() { UserId = UserEnum.Greta, Items = new List <CartItem>() { new CartItem() { ItemName = "Paintballs", Quantity = 400 } } }, _ => throw new KeyNotFoundException("Could not find user in database"), });
public UserModel(string username, SecureString password, string firstName, string lastName, UserEnum userType) { Username = username; PasswordSalt = SecurePasswordUtility.CreateSalt(); PasswordHash = new SecurePasswordUtility(password, PasswordSalt).ComputeSaltedHash(); FirstName = firstName; LastName = lastName; UserType = userType; ID = Guid.NewGuid(); }
public async Task <UpdateResult> UpdateUser(string id, UserEnum role) { var filter = Builders <User> .Filter.Eq(s => s.Id, id); var update = Builders <User> .Update .Set(s => s.Role, role); return(await _userContext.UsersCollection. UpdateOneAsync(filter, update)); }
public Customer(string username, string password, string firstName, string lastName, UserEnum userType) { Username = username; PasswordSalt = Utilities.CreateSalt(); SecurePassword = new SecurePassword(password, PasswordSalt); PasswordHash = SecurePassword.ComputeSaltedHash(); FirstName = firstName; LastName = lastName; UserType = userType; ID = Guid.NewGuid(); }
public CreateAccount(string firstName, string lastName, string userName, string password, string email, UserEnum userType) { this.firstName = firstName; this.lastName = lastName; this.userName = userName; this.encriptPass = _PassEncription.Encript(password); this.email = email; this.userType = userType; //insert code to make new account here }
private UserEnum DefineEnum(String namespace_, String name, List <String> modifiers) { TypeAttributes attr = 0; foreach (String s in modifiers) { attr |= (TypeAttributes)Enum.Parse(typeof(TypeAttributes), s, true); } UserEnum tb = new UserEnum(name, namespace_, attr); return(tb); }
public IYearSheetRepository GetRepository(UserEnum user) { switch (user) { case UserEnum.Green: return(new YearSheetRepository(_sheetDetails.GreenSheetId, _sheetDetails, _sheetApi)); case UserEnum.Red: return(new YearSheetRepository(_sheetDetails.RedSheetId, _sheetDetails, _sheetApi)); default: throw new ArgumentException("Unknown User Enum"); } }
private void Login_Click(object sender, EventArgs e) { this.Name = this.textName.Text; // this.Password = this.textPassword.Text; string pass; if (passwordAndLogin.TryGetValue(this.textName.Text, out pass)) { if (pass == this.textPassword.Text) { this.Role = users.FirstOrDefault(user => user.Name == this.textName.Text && user.Password == this.textPassword.Text ).Role; this.DialogResult = DialogResult.OK; } } }
public decimal LoadPersonalCurrentBalance(UserEnum user) { string balanceRange = null; switch (user) { case UserEnum.Green: balanceRange = _sheetDetails.GreenCurrentBalance; break; case UserEnum.Red: balanceRange = _sheetDetails.RedCurrentBalance; break; default: break; } return(decimal.Parse(LoadSingle(balanceRange))); }
public void GetUser() { LogInPage formLogIn = new LogInPage(); formLogIn.ShowDialog(); if (formLogIn.DialogResult == DialogResult.OK) { userName = formLogIn.Name; Role = formLogIn.Role; } //else //{ // InitializeComponent(); // Vizible(); // Initializer(); // this.Close(); //} }
/// <summary> /// Partially walk the tree and define all classes and interfaces encountered in the assembly. /// </summary> /// <param name="node">The tree to walk</param> public void WalkTypes(TreeNode node) { // manually traverse the AST so we can first define all classes before references to them are made foreach (TreeNode n in node.Children) { if (n.Type == VnvdTreeWalker.NAMESPACE) { foreach (TreeNode n2 in n.Children) { if (n2.Entry != null && n2.EntryType == EntryType.Class) { UserType t = (UserType)n2.Entry.ReflectionObject; n2.Entry.ReflectionObject = DefineClass(t.FullName, t.Attributes); ((UserType)t.MakeArrayType()).Entry.ReflectionObject = ((TypeBuilder)n2.Entry.ReflectionObject).MakeArrayType(); usertypes.Add(t); types.Add(n2); } else if (n2.Entry != null && n2.EntryType == EntryType.Interface) { UserType t = (UserType)n2.Entry.ReflectionObject; n2.Entry.ReflectionObject = DefineInterface(t.FullName, t.Attributes); ((UserType)t.MakeArrayType()).Entry.ReflectionObject = ((TypeBuilder)n2.Entry.ReflectionObject).MakeArrayType(); usertypes.Insert(0, t); types.Insert(0, n2); } else if (n2.Entry != null && n2.EntryType == EntryType.Enum) { UserEnum t = (UserEnum)n2.Entry.ReflectionObject; n2.Entry.ReflectionObject = DefineEnum(t.FullName, t.Attributes); ((UserType)t.MakeArrayType()).Entry.ReflectionObject = ((TypeBuilder)n2.Entry.ReflectionObject).MakeArrayType(); usertypes.Insert(0, t); types.Insert(0, n2); } } } } }
public void ChooseMenu() { UserEnum choose = (UserEnum)int.Parse(Console.ReadLine()); while (choose == UserEnum.None) { Console.WriteLine("Envalid Input Try Again!"); choose = (UserEnum)int.Parse(Console.ReadLine()); } switch (choose) { case UserEnum.Register: var regist = new RegisterAthenticate(); regist.Registaraion(); Clear(); AskUser(); break; case UserEnum.Authenticate: //Authenticate autho = new Authenticate(); //autho.Authorize(); RegisterAthenticate valid = new RegisterAthenticate(); valid.AskAuthenticate(); Clear(); AskUser(); break; case UserEnum.Exit: ExitSystem(); break; default: Console.Clear(); Console.WriteLine("Wrong Input Try again"); AskUser(); break; } }
public async Task Put([FromBody] string id, UserEnum role) { await _userService.UpdateUser(id, role); }
public User(string name, UserEnum role) { this.Name = name; this.Role = role; }
public IList <RangeUpdateModel> PrepUpdatePersonalStartingBalance(decimal value, UserEnum user) { string balanceRange = null; switch (user) { case UserEnum.Green: balanceRange = _sheetDetails.GreenStartingBalance; break; case UserEnum.Red: balanceRange = _sheetDetails.RedStartingBalance; break; default: break; } return(PrepSingleCellUpdate(value, balanceRange)); }
public Patient(string name, UserEnum role) : base(name, role) { }
private WrappedResponse <CategoriesPersonal> SaveCategoriesToUserYearSheet(CategoriesPersonal categories, UserEnum user, DateTime effectiveDate) { var repo = _repositoryFactory.GetRepository(user); var updates = repo.PrepExpenseUpdate(categories.Expense, effectiveDate); updates.AddRange(repo.PrepIncomeUpdate(categories.Income, effectiveDate)); var updateResponse = repo.UpdateRange(updates); if (!updateResponse.Success) { return((WrappedResponse <CategoriesPersonal>)updateResponse); } var projections = repo.LoadProjections(); return(new WrappedResponse <CategoriesPersonal> { Success = true, Data = projections }); }
private IList <RangeUpdateModel> PrepCategoryProjectionsUpdate(Categories categories, UserEnum user) { var personalCategories = user == UserEnum.Green ? categories.Green : categories.Red; // build expense projections var updates = _repo.PrepExpenseCategoryProjectionUpdate(personalCategories.Expense, user); // build income projections updates.AddRange(_repo.PrepIncomeCategoryProjectionUpdate(personalCategories.Income, user)); return(updates); }
public IList <RangeUpdateModel> PrepIncomeCategoryProjectionUpdate(CategoriesIncome income, UserEnum user) { var update = new RangeUpdateModel(); update.Range = user == UserEnum.Green ? _sheetDetails.GreenIncomeProjectionRange : _sheetDetails.RedIncomeProjectionRange; update.Dimension = DimensionEnums.Columns; var catchAllValue = income.Payment + income.Gifts + income.Refund + income.Other; update.Values = new List <IList <object> > { new List <object> { 0, income.Paycheck, }, }; return(new List <RangeUpdateModel> { update }); }
private CategoriesPersonal LoadPersonalCategories(UserEnum user) { string expenseRange = null; string incomeRange = null; switch (user) { case UserEnum.Green: expenseRange = _sheetDetails.GreenExpenseCategoriesRange; incomeRange = _sheetDetails.GreenIncomeCategoriesRange; break; case UserEnum.Red: expenseRange = _sheetDetails.RedExpenseCategoriesRange; incomeRange = _sheetDetails.RedIncomeCategoriesRange; break; default: break; } // load expense categories var rawExpense = LoadRange(expenseRange); var expense = new CategoriesExpense(); if (rawExpense != null && rawExpense.Count > 0) { expense.Total = decimal .Parse(rawExpense[(int)CategoriesExpenseRowEnum.Total][0].ToString()); expense.DailyFood = decimal .Parse(rawExpense[(int)CategoriesExpenseRowEnum.DailyFood][0].ToString()); expense.Gifts = decimal .Parse(rawExpense[(int)CategoriesExpenseRowEnum.Gifts][0].ToString()); expense.Medical = decimal .Parse(rawExpense[(int)CategoriesExpenseRowEnum.Medical][0].ToString()); expense.Health = decimal .Parse(rawExpense[(int)CategoriesExpenseRowEnum.Health][0].ToString()); expense.Necessities = decimal .Parse(rawExpense[(int)CategoriesExpenseRowEnum.Necessities][0].ToString()); expense.Transportation = decimal .Parse(rawExpense[(int)CategoriesExpenseRowEnum.Transportation][0].ToString()); expense.Personal = decimal .Parse(rawExpense[(int)CategoriesExpenseRowEnum.Personal][0].ToString()); expense.Fun = decimal .Parse(rawExpense[(int)CategoriesExpenseRowEnum.Fun][0].ToString()); expense.Utilities = decimal .Parse(rawExpense[(int)CategoriesExpenseRowEnum.Utilities][0].ToString()); expense.Travel = decimal .Parse(rawExpense[(int)CategoriesExpenseRowEnum.Travel][0].ToString()); expense.Debt = decimal .Parse(rawExpense[(int)CategoriesExpenseRowEnum.Debt][0].ToString()); expense.Electronics = decimal .Parse(rawExpense[(int)CategoriesExpenseRowEnum.Electronics][0].ToString()); expense.Goals = decimal .Parse(rawExpense[(int)CategoriesExpenseRowEnum.Goals][0].ToString()); expense.Rent = decimal .Parse(rawExpense[(int)CategoriesExpenseRowEnum.Rent][0].ToString()); expense.Car = decimal .Parse(rawExpense[(int)CategoriesExpenseRowEnum.Car][0].ToString()); expense.Restaurants = decimal .Parse(rawExpense[(int)CategoriesExpenseRowEnum.Restaurants][0].ToString()); expense.Appartment = decimal .Parse(rawExpense[(int)CategoriesExpenseRowEnum.Appartment][0].ToString()); expense.Investment = decimal .Parse(rawExpense[(int)CategoriesExpenseRowEnum.Investment][0].ToString()); expense.Other = decimal .Parse(rawExpense[(int)CategoriesExpenseRowEnum.Other][0].ToString()); } // load income categories var rawIncome = LoadRange(incomeRange); var income = new CategoriesIncome(); if (rawIncome != null && rawIncome.Count > 0) { income.Total = decimal .Parse(rawIncome[(int)CategoriesIncomeRowEnum.Total][0].ToString()); income.Savings = decimal .Parse(rawIncome[(int)CategoriesIncomeRowEnum.Savings][0].ToString()); income.Paycheck = decimal .Parse(rawIncome[(int)CategoriesIncomeRowEnum.Paycheck][0].ToString()); income.Bonus = decimal .Parse(rawIncome[(int)CategoriesIncomeRowEnum.Bonus][0].ToString()); income.Personal = decimal .Parse(rawIncome[(int)CategoriesIncomeRowEnum.Personal][0].ToString()); income.Gifts = decimal .Parse(rawIncome[(int)CategoriesIncomeRowEnum.Gifts][0].ToString()); income.Refund = decimal .Parse(rawIncome[(int)CategoriesIncomeRowEnum.Refund][0].ToString()); income.Payment = decimal .Parse(rawIncome[(int)CategoriesIncomeRowEnum.Payment][0].ToString()); income.Other = decimal .Parse(rawIncome[(int)CategoriesIncomeRowEnum.Other][0].ToString()); } return(new CategoriesPersonal { Expense = expense, RawExpense = rawExpense, Income = income, RawIncome = rawIncome }); }
public void SeeActivity(IUser user, string password, UserEnum type) { //Utilities.ShowActivity(user); }
public IList <RangeUpdateModel> PrepExpenseCategoryProjectionUpdate(CategoriesExpense expenses, UserEnum user) { var expenseUpdateModel = new RangeUpdateModel(); expenseUpdateModel.Range = user == UserEnum.Green ? _sheetDetails.GreenExpenseProjectionRange : _sheetDetails.RedExpenseProjectionRange; expenseUpdateModel.Dimension = DimensionEnums.Columns; // TODO: use order-safe enum expenseUpdateModel.Values = new List <IList <object> > { new List <object> { expenses.DailyFood, expenses.Gifts, expenses.Medical, expenses.Health, expenses.Necessities, expenses.Transportation, expenses.Personal, expenses.Fun, expenses.Utilities, expenses.Travel, expenses.Debt, expenses.Electronics, expenses.Goals, expenses.Rent, expenses.Car, expenses.Restaurants, expenses.Appartment, expenses.Investment, expenses.Other }, }; return(new List <RangeUpdateModel> { expenseUpdateModel }); }