public Boolean LoginProcess(string userNameLogin, string passwordLogin) { User user = new User { userName = userNameLogin, password = passwordLogin }; var loginCheck = UserOperations.IsThereUser(user); if (loginCheck) { // for navbar icon's add (Dashboard and Sign out) HttpCookie myCookie = new HttpCookie("isLoggedIn") { Value = "True", Expires = DateTime.Now.AddDays(1) }; Response.Cookies.Add(myCookie); // for read username after entered dashboard HttpCookie UserNameValue = new HttpCookie("userName") { Value = userNameLogin, Expires = DateTime.Now.AddDays(1) }; Response.Cookies.Add(UserNameValue); return(true); } else { return(false); } }
private void button1_Click(object sender, RoutedEventArgs e) { UserOperations operations = new UserOperations(); LoginStatus status = operations.isValidUser(textBox1.Text, passwordBox1.Password); if (status.ValidUser) { label3.Visibility = Visibility.Hidden; if (status.FirstLogin) { if (System.Windows.MessageBox.Show("You need to change your password.", "Change Password", MessageBoxButton.OK, MessageBoxImage.Information) == MessageBoxResult.OK) { ChangePassword change = new ChangePassword(textBox1.Text, passwordBox1.Password, status.Employee); change.Show(); this.Close(); } } else { HomeWindow hm = new HomeWindow(textBox1.Text, passwordBox1.Password, status.Employee); hm.Show(); this.Close(); } } else { label3.Visibility = Visibility.Visible; } }
private void btnReport_Click(object sender, EventArgs e) { string s = textBox1.Text; UserOperations ez = new UserOperations(); ez.Raport(s); }
public HomeController() { DataContext db = new DataContext(); userOperations = new UserOperations(db); rn = new Random(); }
public void Handle(IConsoleAdapter console, IErrorAdapter error, IMapper mapper) { try { var ops = new UserOperations("https://senlabltd.eu.auth0.com/api/v2/", ClientId, Secret, mapper); var user = ops.AddUser(Email, Password); console.WrapLine($"{user.UserId} created.".Cyan()); } catch (AggregateException e) { error.WrapLine($"Unable to create user {Email} due to error:".Yellow()); error.WrapLine(e.Message.Red()); foreach (var exception in e.InnerExceptions) { error.WrapLine(exception.Message.Red()); } Environment.ExitCode = -100; } catch (Exception e) { error.WrapLine($"Unable to create user {Email} due to error:".Yellow()); error.WrapLine(e.Message.Red()); if (e.InnerException != null) { error.WrapLine(e.InnerException.Message.Red()); } Environment.ExitCode = -100; } }
public void InitUserObject() { users = new List <User>() { new User() { Login = "******", Password = "******", UserId = 1 }, new User() { Login = "******", Password = "******", UserId = 2 } }.AsQueryable(); mockSetUser = Substitute.For <DbSet <User>, IQueryable <User> >(); ((IQueryable <User>)mockSetUser).Provider.Returns(users.Provider); ((IQueryable <User>)mockSetUser).Expression.Returns(users.Expression); ((IQueryable <User>)mockSetUser).ElementType.Returns(users.ElementType); ((IQueryable <User>)mockSetUser).GetEnumerator().Returns(users.GetEnumerator()); db = Substitute.For <IEFDbContext>(); db.users.Returns(mockSetUser); userOperations = new UserOperations(db); }
private void dataGridViewUsers_CellDoubleClick(object sender, DataGridViewCellEventArgs e) { buttonSaveU.Visible = true; buttonCancelU.Visible = true; modositva_user = true; int sor = dataGridViewUsers.SelectedRows[0].Index; Felhasznalok users = new Felhasznalok( Convert.ToInt32(dataGridViewUsers.SelectedRows[0].Cells["id"].Value), dataGridViewUsers.SelectedRows[0].Cells["username"].Value.ToString(), dataGridViewUsers.SelectedRows[0].Cells["neme"].Value.ToString(), dataGridViewUsers.SelectedRows[0].Cells["email"].Value.ToString(), Convert.ToBoolean(dataGridViewUsers.SelectedRows[0].Cells["admin"].Value) ); UserOperations uo = new UserOperations(users); Felhasznalok modositottFelhasznalok = uo.getModositottFelhasznalok(); dataGridViewUsers.Rows[sor].Cells["username"].Value = modositottFelhasznalok.getFnev(); dataGridViewUsers.Rows[sor].Cells["neme"].Value = modositottFelhasznalok.getNem(); dataGridViewUsers.Rows[sor].Cells["email"].Value = modositottFelhasznalok.getEmail(); dataGridViewUsers.Rows[sor].Cells["admin"].Value = modositottFelhasznalok.getAdmin(); }
public ReviewController(ReviewOperations reviewOperations, UserOperations userOperations, PictureOperations pictureOperations) { _reviewOperations = reviewOperations; _userOperations = userOperations; _pictureOperations = pictureOperations; }
private void button1_Click(object sender, RoutedEventArgs e) { //Submit if (oldPasswordBox.Password == password) { label4.Visibility = Visibility.Hidden; if (newPasswordBox.Password == confirmNewPassword.Password) { label5.Visibility = Visibility.Hidden; UserOperations operations = new UserOperations(); operations.changePassword(userName, oldPasswordBox.Password, newPasswordBox.Password); HomeWindow hm = new HomeWindow(userName, password, emp); hm.Show(); this.Close(); } else { label5.Visibility = Visibility.Visible; } } else { label4.Visibility = Visibility.Visible; } }
public int Register(Users user) { UserOperations userOperations = new UserOperations(); int result = userOperations.AddUser(user); return(result); }
private void btnLogin_Click(object sender, EventArgs e) { UserOperations bl = new UserOperations(); /* User us = new User(); * * us.id = 2; * us.IsAdmin = true; * us.name = "admin"; * us.password = "******"; * bl.AddUser(us); */ User user = bl.Login(txtUser.Text, txtPassword.Text); if (user.IsAdmin) { Admin adminForm = new Admin(); adminForm.Show(); } else { regular reg = new regular(); reg.Show(); } }
static void Main() { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); // Application.Run(new OrdersF()); //Application.Run(new ProductsF()); // Application.Run(new UsersF()); //Application.Run(new LoginForm()); var uD = new UserData(); var pD = new ProductData(); var oD = new OrderData(); var lF = new LoginForm(); var oF = new OrderForm(); var pF = new ProductForm(); var uF = new UserForm(); var uO = new UserOperations(); var rD = new ReportData(); var uP = new UserPresenter(uF, uD, rD); var oP = new OrderPresenter(oF, oD, rD); var pP = new ProductPresenter(pF, pD); var lP = new LoginPresenter(lF, uD, oF, pF, uF, uO); Application.Run(lF); }
//Login private void LoginButton_Click(object sender, EventArgs e) { if (!int.TryParse(UserNameTextBox.Text, out int ID)) { MessageBox.Show("ID has to be an integer"); UserNameTextBox.Text = ""; return; } Student s = UserOperations.LogIn(ID, PasswordTextBox.Text); if (s != null) { ActiveStudent = s; CurrentActivePanel = ViewCourses; ViewCourses.Visible = true; NavigationPanel.Visible = true; LoginPanel.Visible = false; } else { MessageBox.Show("Invalid ID or password"); UserNameTextBox.Text = ""; PasswordTextBox.Text = ""; } }
public async Task <Reservation> AddAsync(Reservation reservation) { try { UserOperations userOperations = new UserOperations(_context); var user = await userOperations.GetAsync(reservation.UserId); if (user == null) { await userOperations.RegisterAsync(reservation.User.Email); } reservation.Created = DateTime.Now; _context.Reservations.Add(reservation); await _context.SaveChangesAsync(); var newReservation = await this.GetAsync(reservation.Id); SendEmail(newReservation); return(newReservation); } catch (Exception ex) { ErrorLogger.Log("CANNOT ADD RESERVATION", ex); throw; } }
public HttpResponseMessage UpdateEmployee([FromBody] Employee _employee) { using (UserOperations _userOperation = new UserOperations()) { _userOperation.UpdateEmployeeDetails(_employee); return(new HttpResponseMessage(HttpStatusCode.OK)); } }
/// <summary> /// Creates a new WIFIPLUG client without a API key or secret. /// </summary> /// <param name="apiUrl">The custom base path of the API.</param> public ApiClient(string apiUrl) : base(apiUrl) { _deviceOperations = new DeviceOperations(this); _sessionOperations = new SessionOperations(this); _userOperations = new UserOperations(this); _groupOperations = new GroupOperations(this); _eventOperations = new EventOperations(this); }
/// <summary> /// Creates a new WIFIPLUG client without a API key or secret. /// </summary> public ApiClient() { _deviceOperations = new DeviceOperations(this); _sessionOperations = new SessionOperations(this); _userOperations = new UserOperations(this); _groupOperations = new GroupOperations(this); _eventOperations = new EventOperations(this); }
private void updateBtn_Click(object sender, EventArgs e) { UserOperations up = new UserOperations(); User user = new User(); user = retrieve(); up.UpdateUser(user); }
public HttpResponseMessage UpdateTenant([FromBody] Tenant _tenant) { using (UserOperations _userOperation = new UserOperations()) { _userOperation.UpdateTenantDetails(_tenant); return(new HttpResponseMessage(HttpStatusCode.OK)); } }
public UserControllerTest() { UserOperations userOperations = new UserOperations(_context); PictureOperations pictureOperations = new PictureOperations(_context); _controller = new UserController(userOperations, pictureOperations); MapperMappings.Map(); }
public void CreateDefaultUser(UserOperations userOperations) { if (userOperations.GetAll().Count == 0) { var user = new User("admin", "1111", "yes", "ff10def1881sh2019crtmsh1923abc"); userOperations.AddModel(user); } }
public IHttpActionResult UpdateExitDate([FromBody] Tenant _tenant) { using (UserOperations _userOperation = new UserOperations()) { _userOperation.UpdateTenantExitDate(_tenant); return(Ok("")); } }
public AjaxApiController() { DataContext context = new DataContext(); postOperations = new PostOperations(context); userOperations = new UserOperations(context); requestOperations = new RequestOperations(context); }
private void btnAddAdmin_Click(object sender, EventArgs e) { var adminForm = new Admin(); var adminRepository = new DataAccess(); var adminPresenter = new UserOperations(adminForm, adminRepository); adminForm.Show(); }
public async Task PostBanner(SetImage request) { UserInfo user = await GetUserInfoAsync(); HttpStatusCode result = await UserOperations.SetBannerImage( DbContext, user, request); result.ThrowHttpResponseExceptionIfNotSuccessful(); }
private void generateBtn_Click(object sender, EventArgs e) { DateTime data1 = date1.Value; DateTime data2 = date2.Value; int id = Convert.ToInt32(idText.Text); UserOperations up = new UserOperations(); dataGridView1.DataSource = up.generateDet(data1, data2, id); }
/// <summary> /// Adds the User object in the context to the data store. /// </summary> /// <returns> /// The ResultCode corresponding to the result of the operation. /// </returns> public ResultCode AddUser() { Context.Log.Verbose("Attempting to add the User to the data store."); ResultCode result = UserOperations.AddOrUpdateUser(); Context.Log.Verbose("ResultCode after adding the User to the data store: {0}", result); return(result); }
public void GetUserTest() { var groupOperations = new UserOperations(); groupOperations.GetUsers(); groupOperations.AddUser(new Models.MUser()); groupOperations.GetUserById(0); }
public ProfileController() { DataContext context = new DataContext(); userOperations = new UserOperations(context); postOperations = new PostOperations(context); friendOperations = new FriendsOperations(context); requestOperations = new RequestOperations(context); }
public UserService(ITokenService tokenService, IUserSessionService userSessionService, IMapper mapper, UserOperations ops, StudentDAO studDao, ProfessorDAO profDao, AssistentDAO assisDao) { _tokenService = tokenService; _userSessionService = userSessionService; _mapper = mapper; _userops = ops; _studentDao = studDao; _assistentDao = assisDao; _professorDao = profDao; }
public static string LogUserAction(UserOperations operation, AccountInfo user, LoggingOperationLevel level, object[] parameters, bool performLog = true) { string paramData = string.Empty; for (int i = 0; i < parameters.Length; i++) { paramData += parameters[i].ToString() + CsvDelimiter; } string logMessage = string.Format("{1}{0}{2}{0}{3}{0}{4}{0}{5}{0}{6}", CsvDelimiter, //{0} DateTime.Now.ToString(DateTimeFormat), //{1} level.ToString(), //{2} operation, //{3} user.AccountId, //{4} user.Role.ToString(), //{5} paramData); //{6} if (bool.Parse(ConfigurationManager.AppSettings["LoggingEnabled"]) && performLog) { Logger logger = new Logger(); logger.Log(logMessage, LogPlace.File, LogFileName, false); } return logMessage; }