public static bool ChangePassWord(UserObject NowUser, string OriPasswrd, string NewPasswrd) { if (OriPasswrd.SHA256Encrypt() != CurrentUser.Password) { LW.E("ChangePassword Request Failed, Reason: Original Password Incorrect...."); return(false); } else { NowUser.Password = NewPasswrd.SHA256Encrypt(); if (DataBaseOperation.UpdateData(ref NowUser, new DBQuery() .WhereEqualTo("objectId", CurrentUser.ObjectId) .WhereEqualTo("Password", OriPasswrd.SHA256Encrypt()) .WhereEqualTo("Username", CurrentUser.UserName)) == DBQueryStatus.ONE_RESULT) { LW.I("Change Password Success!"); return(true); } else { LW.I("Change Password Failed!"); return(false); } } }
private void UsrLoginWindow_FormClosed(object sender, FormClosedEventArgs e) { void ApplicationExit() { LW.I("Terminating Application....."); Application.Exit(); } }
private void DoLogin(object sender, EventArgs e) { //Login the user UserNameTxt.Enabled = false; PswdTxt.Enabled = false; NewUserLabel.Visible = false; LoginResult.Text = ""; DoLoginBtn.Enabled = false; CancelBtn.Enabled = false; DoLoginBtn.Text = "登录中..."; Application.DoEvents(); if (UserActivity.Login(UserNameTxt.Text, PswdTxt.Text, out UserObject user)) { LW.I($"Login succeed using username {UserNameTxt.Text}"); if (user.UserGroup.IsAdmin || user.UserGroup.IsBusManager || user.UserGroup.IsClassTeacher) { DoLoginBtn.Enabled = true; CancelBtn.Enabled = true; UserNameTxt.Enabled = true; PswdTxt.Enabled = true; DoLoginBtn.Text = "登录(&L)"; CurrentUser = user; MainForm.Default.Show(); Hide(); } else if (user.UserGroup.IsParent) { MessageBox.Show("暂时不支持家长使用小板凳 Windows 客户端哦!"); } else { MessageBox.Show("用户组配置无效,请联系管理员。"); } } else { LW.E($"Login failed using username {UserNameTxt.Text} and password {PswdTxt.Text}."); LoginResult.Text = "用户名或密码不正确"; LoginResult.Visible = true; DoLoginBtn.Enabled = true; CancelBtn.Enabled = true; UserNameTxt.Enabled = true; PswdTxt.Enabled = true; DoLoginBtn.Text = "登录(&L)"; } }
private void buttonX1_Click(object sender, EventArgs e) { foreach (StudentObject item in studentDataObjectBindingSource) { var _item = item; if (Database.DataBaseOperation.UpdateData(ref _item) == DBQueryStatus.ONE_RESULT) { ExDescription.Text = "成功更新项:" + _item.StudentName; LW.I("BusCheck: Succeed Updated Record: " + item.ObjectId); } else { ExDescription.Text = "出现问题:" + _item.StudentName; LW.E("BusCheck: Failed to Update Record: " + item.ObjectId); } Application.DoEvents(); } }
public static int Main(string[] args) { LW.SetLogLevel(LogLevel.D); LW.InitLog(); LW.I("========= = Start WoodenBench for Schoolbus Windows Client = ========="); if (!XConfig.LoadConfig("XConfig.conf")) { LW.E("Config Loading Failed! Check file..."); return(0); } DataBaseOperation.InitialiseClient(); Application.EnableVisualStyles(); Application.Run(LoginWindow.Default); DatabaseSocketsClient.KillConnection(); return(0); }
private void helpTile_Click(object sender, EventArgs e) { LW.I("Clicked the Help Button, now navigating to the help page"); Process.Start("https://www.lhy0403.top/wb-help/"); }