private void btnNew_Click(object sender, EventArgs e) { if (IsExpand) { picExpand_Click(sender, e); } txtUsernane.Text = ""; txtUsernane.Focus(); txtFullName.Text = ""; txtPwd.Text = ""; txtPhone.Text = ""; txtEmail.Text = ""; txtNote.Text = ""; if (dgvList.RowCount > 0) { dgvList.CurrentRow.Selected = false; } Id = 0; LockControls(false); txtPwd.Enabled = true; txtPwdAgain.Enabled = true; if (dgvList.RowCount > 0) { rowIndex = dgvList.CurrentRow.Index; } SessionLogFacade.Log(Type.Priority_Information, Module, Type.Log_New, "New clicked"); }
private void frmUserList_Load(object sender, EventArgs e) { Icon = Properties.Resources.Icon; dgvList.ShowLessColumns(true); RefreshGrid(); Text += " v. " + SYS.App.version; LockControls(); SessionLogFacade.Log(Type.Priority_Information, Module, Type.Log_Open, "Form opened"); }
private void btnPwdReset_Click(object sender, EventArgs e) { SessionLogFacade.Log(Type.Priority_Caution, Module, Type.Log_ResetPwd, "Reset pwd clicked."); if (dgvList.Id == 0) { return; } var fPwdReset = new SM.frmPwdReset(txtUsernane.Text, txtFullName.Text); fPwdReset.Id = dgvList.Id; fPwdReset.ShowDialog(); }
private void btnSave_Click(object sender, EventArgs e) { if (!IsValidated()) { return; } Cursor = Cursors.WaitCursor; var m = new User(); var log = new SessionLog { Module = Module }; m.Id = Id; m.Username = txtUsernane.Text.Trim(); m.Full_Name = txtFullName.Text; m.Pwd = txtPwd.Text; m.Phone = txtPhone.Text; m.Email = txtEmail.Text; m.Note = txtNote.Text; if (dtpStart.Checked) { m.Start_On = dtpStart.Value; } if (dtpEnd.Checked) { m.End_On = dtpEnd.Value; } if (m.Id == 0) { log.Priority = Type.Priority_Information; log.Type = Type.Log_Insert; } else { log.Priority = Type.Priority_Caution; log.Type = Type.Log_Update; } ////m.Id = UserFacade.Save(m); if (dgvList.RowCount > 0) { rowIndex = dgvList.CurrentRow.Index; } RefreshGrid(m.Id); LockControls(); Cursor = Cursors.Default; log.Message = "Save successfull. Id=" + m.Id + " ,Username=" + txtUsernane.Text; SessionLogFacade.Log(log); }
private void btnSave_Click(object sender, EventArgs e) { if (!IsValidated()) { return; } var usr = new User() { Id = Id, Pwd = txtPwd.Text }; UserFacade.UpdatePwd(usr); DialogResult = System.Windows.Forms.DialogResult.OK; SessionLogFacade.Log(Type.Priority_Caution, "User", Type.Log_ResetPwd, "Password reset successfully. Username=" + txtUsernane.Text); }
private void btnLogin_Click(object sender, EventArgs e) { if (!IsValidated()) { return; } // Check Username var usr = UserFacade.Select(txtUsername.Text.Trim()); if (usr == null) // Username not exist { lblMsg.Text = "Invalid username or password"; txtUsername.Focus(); SessionLogFacade.Log(Type.Priority_Warning, Module, Type.Log_Login, "Username="******" not exist"); return; } // Check password if (!UserFacade.IsPwdCorrect(usr.Id, txtPassword.Text)) { lblMsg.Text = "Invalid username or password"; txtUsername.Focus(); SessionLogFacade.Log(Type.Priority_Warning, Module, Type.Log_Login, "Password not correct"); return; } //todo: validate start on, end on, status App.session.UserId = usr.Id; App.session.Username = usr.Username; SessionFacade.Save(App.session); SessionLogFacade.Log(Type.Priority_Information, Module, Type.Log_Login, "Username="******" authenticates OK"); // Save username App.setting.Set("Username", txtUsername.Text.Trim()); App.setting.Save(); DialogResult = System.Windows.Forms.DialogResult.OK; }
private void btnSaveNew_Click(object sender, EventArgs e) { SessionLogFacade.Log(Type.Priority_Information, Module, Type.Log_SaveAndNew, "Save and new. Id=" + dgvList.Id + ", Username=" + txtUsernane.Text); btnSave_Click(sender, e); btnNew_Click(sender, e); }
private void RefreshGrid() { dgvList.DataSource = SessionLogFacade.GetDataTable(txtSearch.Text); }