private void delete_toolStripMenuItem_Click(object sender, EventArgs e) { if (XtraMessageBox.Show("确认[彻底删除]选中的学生信息吗?删除后数据不可恢复,请谨慎操作", "提示", MessageBoxButtons.YesNo) == DialogResult.No) { return; } VerificationForm form = new VerificationForm(); form.ShowDialog(); if (!form.Result) { return; } //获取选中行 int[] rows = gridView1.GetSelectedRows(); int[] ids = new int[rows.Length]; for (int i = 0; i < rows.Length; i++) { ids[i] = (gridView1.GetRow(rows[i]) as StudentInfo).ID; } int result = StudentInfo.RealyDelete(ids); if (result > 0) { XtraMessageBox.Show("删除成功"); Query(); return; } XtraMessageBox.Show("删除失败"); return; }
/// <summary> /// Adds new pending verification form record /// </summary> /// <param name="form">Verification form</param> /// <returns></returns> public static async Task AddPendingVerificationForm(VerificationForm form) { using (var DbContext = new SQLiteDatabaseContext()) { var query = DbContext.VerificationDB.Where(x => x.GuildId == form.GuildId && x.Verified == form.Verified && x.IsApproved == null ); if (query.Count() < 1) { var submit = new VerificationForm { GuildId = form.GuildId, Verified = form.Verified, Verifier = form.Verifier, IssuedUtc = DateTime.UtcNow }; DbContext.VerificationDB.Add(submit); await DbContext.SaveChangesAsync(); } else { throw new VerificationFormExistsException(); } } }
private void delete_toolStripMenuItem_Click(object sender, EventArgs e) { if (XtraMessageBox.Show("确认删除选中的缴费记录吗?删除后数据不可恢复,请谨慎操作。", "消息", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No) { return; } VerificationForm form = new VerificationForm(); form.ShowDialog(); if (!form.Result) { return; } int[] selectRows = gridView1.GetSelectedRows(); int[] rowsID = new int[selectRows.Length]; for (int i = 0; i < selectRows.Length; i++) { rowsID[i] = (gridView1.GetRow(selectRows[i]) as PayRecordInfo).ID; } int result = SQLiteControl.RealyDelete("PayRecordTable", "ID", rowsID); if (result <= 0) { XtraMessageBox.Show("删除选中的缴费记录失败", "消息", MessageBoxButtons.YesNo, MessageBoxIcon.Error); return; } Query(); }
private void edite_simpleButton_Click(object sender, EventArgs e) { if (XtraMessageBox.Show("确认修改当前用户的信息吗", "消息", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No) { return; } //敏感操作验证 VerificationForm form = new VerificationForm(); form.ShowDialog(); if (!form.Result) { XtraMessageBox.Show("验证失败"); return; } _account.Account = account_textEdit.Text.Trim(); _account.Person = person_textEdit.Text.Trim(); _account.Password = password_textEdit.Text.Trim(); _account.Key = key_textEdit.Text.Trim(); //修改sql数据 if (AccountInfo.Modify(_account) < 0) { XtraMessageBox.Show("修改用户失败"); } else { XtraMessageBox.Show("修改用户信息成功"); } this.Close(); return; }
private void delete_toolStripMenuItem_Click(object sender, EventArgs e) { if (XtraMessageBox.Show("确认删除选中行吗?", "消息", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No) { return; } VerificationForm form = new VerificationForm(); form.ShowDialog(); if (!form.Result) { return; } int[] selectRows = gridView1.GetSelectedRows(); int[] ids = new int[selectRows.Length]; for (int i = 0; i < ids.Length; i++) { ids[i] = (gridView1.GetRow(selectRows[i]) as GroupClassInfo).ID; } if (GroupClassInfo.Delete(ids) <= 0) { XtraMessageBox.Show("部分选中行删除失败!请刷新后重试", "消息", MessageBoxButtons.OK, MessageBoxIcon.Warning); Query(); return; } XtraMessageBox.Show("删除成功!", "消息", MessageBoxButtons.OK); Query(); return; }
void CreateChildForms() { loadScopeForm = new LoadScopeForm(AppTexts, serialPort); directAccessForm = new DirectAccessForm(serialPort, AppTexts); jogForm = new JogForm(serialPort, AppTexts); angleForm = new AngleForm(serialPort, AppTexts); downloadSYMForm = new DownloadSYMForm(serialPort, AppTexts); floatDirectAccess = new FloatDirectAccessForm(serialPort, TextsParams.GetListParamNames(4, 14)); eventLogForm = new EventLogForm(AppTexts, serialPort, systemConfiguration); verificationForm = new VerificationForm(serialPort); }
/// <summary> /// Adds new Verification form record if a pending record does not exist or updates the existing pending record /// </summary> /// <param name="form">Verification Form record</param> /// <returns></returns> public static async Task AddFullVerificationForm(VerificationForm form) { using (var DbContext = new SQLiteDatabaseContext()) { var query = DbContext.VerificationDB.Where(x => x.GuildId == form.GuildId && x.Verified == form.Verified && x.IsApproved == null ); if (query.Count() < 1) { if (form.IssuedUtc == null) { form.IssuedUtc = DateTime.UtcNow; } if (form.ApprovedUtc == null) { form.ApprovedUtc = DateTime.UtcNow; } DbContext.VerificationDB.Add(form); await DbContext.SaveChangesAsync(); } else { var qForm = query.First(); if (form.IsApproved != null) { qForm.IsApproved = form.IsApproved; qForm.Approver = form.Approver; qForm.ApprovedUtc = form.ApprovedUtc ?? DateTime.UtcNow; DbContext.VerificationDB.Update(qForm); await DbContext.SaveChangesAsync(); } } } }
private void delete_toolStripMenuItem_Click(object sender, EventArgs e) { if (XtraMessageBox.Show("确认删除选择的内容吗?删除后无法找回,请谨慎操作。", "消息", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No) { return; } //验证当前登录用户密码 VerificationForm form = new VerificationForm(); form.FormClosed += Form_FormClosed; form.ShowDialog(); form.FormClosed -= Form_FormClosed; if (!form.Result) { XtraMessageBox.Show("验证失败"); return; } int[] selects = gridView1.GetSelectedRows(); int[] ids = new int[selects.Length]; for (int i = 0; i < selects.Length; i++) { ids[i] = (gridView1.GetRow(selects[i]) as AccountInfo).ID; } if (AccountInfo.SimpleDelete(ids)) { XtraMessageBoxArgs args = ControlHelper.XtraMessageBoxArgs("消息", "删除成功", new DialogResult[] { DialogResult.OK }); XtraMessageBox.Show(args); return; } else { XtraMessageBoxArgs args = ControlHelper.XtraMessageBoxArgs("消息", "删除失败", new DialogResult[] { DialogResult.OK }); XtraMessageBox.Show(args); } }
public async Task Verify(IGuildUser user) { var invokingUser = DiscordUserDataHandler.GetGuildUserById(Context.User.Id, Context.Guild.Id); if (invokingUser == null) { await _replyservice.ReplyEmbedAsync(context : Context, message : "You do not have permissions to invoke this command."); return; } var form = new VerificationForm { GuildId = Context.Guild.Id, Verified = user.Id, Verifier = Context.User.Id, IssuedUtc = DateTime.UtcNow }; if (invokingUser.PermissionLevel == DiscordGuildUser.PermissionLevels.Approve) { form.Approver = Context.User.Id; form.IsApproved = true; var query = DiscordRoleDataHandler.GetGuildRoles(Context.Guild.Id); var toBeAddedQuery = query.Where(x => x.Action == DiscordRole.ActionType.Add); var toBeRemovedQuery = query.Where(x => x.Action == DiscordRole.ActionType.Remove); List <IRole> toBeAdded = new List <IRole>(); List <IRole> toBeRemoved = new List <IRole>(); foreach (var role in toBeAddedQuery) { var socketRole = Context.Guild.GetRole(role.RoleId); toBeAdded.Add(socketRole); } foreach (var role in toBeRemovedQuery) { var socketRole = Context.Guild.GetRole(role.RoleId); toBeRemoved.Add(socketRole); } await user.AddRolesAsync(toBeAdded); await user.RemoveRolesAsync(toBeRemoved); await VerificationFormDataHandler.AddFullVerificationForm(form); var message = $"User {user.Username} has been verified "; if (form.Verifier != Context.User.Id) { message += $"by { Context.Guild.GetUser(form.Verifier).Username } "; } message += "and approved."; Log.Information( "User {UserID} verified and approved by {InvokingUserID} in guild {GuildID}", user.Id, Context.User.Id, Context.Guild.Id ); await _replyservice.ReplyEmbedAsync(context : Context, message : message); } else { try { await VerificationFormDataHandler.AddPendingVerificationForm(form); Log.Information( "Verification form for user {UserID} submitted by {InvokingUserID} in guild {GuildID}", user.Id, Context.User.Id, Context.Guild.Id ); await _replyservice.ReplyEmbedAsync(context : Context, message : $"Verification form for user {user.Username} has been submitted by {Context.User.Username}."); } catch (VerificationFormExistsException) { await _replyservice.ReplyEmbedAsync(context : Context, message : $"User {user.Username} already has a pending verification form"); } } }
public ActionResult VerificationForm(VerificationForm verificationForm) { return(View()); }