private void Btn_Save_Click(object sender, EventArgs e) { if (!CheckStuInfo()) { return; } if (!StudentMS_logic.IsEditStatus()) { return; } else if (Status.IsAdding_Status) { if (MessageBox.Show("是否保存新学生信息", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) == DialogResult.Yes) { FillObjectInfo(); if (StudentMS_logic.AddStudentInfo(studentExt) == false) { return; } else { MessageBox.Show("保存成功", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); Log.AddLog(Program.Current_root.Account_num, Do.Add, Object_id.Student, studentExt.Student_id); StudentMS_logic.DGV_studentInfo_Load(this.DGV_studentInfo); Data_Load(); } } else { return; } } }
private void DGV_studentInfo_CellClick(object sender, DataGridViewCellEventArgs e) { if (Status.EdittingStatus) { if (Status.IsAdding_Status) { return; } else if (this.DGV_studentInfo.CurrentRow.Index != Status.BeforeIndex && this.DGV_studentInfo.SelectedRows.Count == 1 && Status.IsAdding_Status == false) { if (!CheckStuInfo()) { Data_Load(); Status.BeforeIndex = this.DGV_studentInfo.CurrentRow.Index; return; } if (MessageBox.Show("是否保存修改结果", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) == DialogResult.Yes) { //Data_Load(); //Status.BeforeIndex = this.DGV_studentInfo.CurrentRow.Index; FillObjectInfo(); if (StudentMS_logic.UpdateStudentInfo(studentExt)) { MessageBox.Show("修改成功", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); Log.AddLog(Program.Current_root.Account_num, Do.Alter, Object_id.Student, studentExt.Student_id); } else { MessageBox.Show("修改失败!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error); } StudentMS_logic.DGV_studentInfo_Load(this.DGV_studentInfo); Data_Load(); Status.BeforeIndex = this.DGV_studentInfo.CurrentRow.Index; } else { Data_Load(); Status.BeforeIndex = this.DGV_studentInfo.CurrentRow.Index; } } } else { if (this.DGV_studentInfo.CurrentRow.Index != Status.BeforeIndex && this.DGV_studentInfo.SelectedRows.Count == 1) { Data_Load(); Status.BeforeIndex = this.DGV_studentInfo.CurrentRow.Index; } } }
/// <summary> /// 窗体加载 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void Form_StudentMS_root_Load(object sender, EventArgs e) { ///初始化信息显示设置 SelectItems.ChB_id = true; SelectItems.ChB_name = true; /// StudentMS_logic.CB_studentSex_Load(CB_studentSex); StudentMS_logic.CB_studentNation_Load(CB_studentNation); StudentMS_logic.CB_studentCollege_Load(CB_studentCollege); StudentMS_logic.DGV_studentInfo_Load(DGV_studentInfo); Data_Load(); FillObjectInfo(); Status.BeforeIndex = this.DGV_studentInfo.CurrentRow.Index; }
private void Btn_Delete_Click(object sender, EventArgs e) { if (MessageBox.Show("是否删除该数据,不可恢复?", "警告", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) == DialogResult.Yes) { FillObjectInfo(); if (StudentMS_logic.DeleteStudentInfo(studentExt) == true) { MessageBox.Show("删除成功!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); Log.AddLog(Program.Current_root.Account_num, Do.Delete, Object_id.Student, studentExt.Student_id); StudentMS_logic.DGV_studentInfo_Load(this.DGV_studentInfo); Data_Load(); } else { MessageBox.Show("删除失败!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); } } else { return; } }
private void Check_timer_Tick(object sender, EventArgs e) { if (Status.SelectChangeStatus == true) { StudentMS_logic.DGV_studentInfo_Load(this.DGV_studentInfo); Status.SelectChangeStatus = false; } if (Status.Form_StudentMS_rootEditStatus) { Btn_ExportExcel.Enabled = false; Btn_ExportWord.Enabled = false; Btn_Delete.Enabled = false; this.Btn_EditStatus.Text = "编辑模式"; } else { Btn_ExportExcel.Enabled = true; Btn_ExportWord.Enabled = true; Btn_Delete.Enabled = true; this.Btn_EditStatus.Text = "浏览模式"; } EditCon_Load(); Con_ReadOnly(); }
private void Btn_Cancel_Click(object sender, EventArgs e) { if (!StudentMS_logic.IsEditStatus()) { return; } else if (Status.IsAdding_Status == false) { if (MessageBox.Show("是否放弃修改?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) == DialogResult.Yes) { StudentMS_logic.DGV_studentInfo_Load(this.DGV_studentInfo); Data_Load(); } } else if (Status.IsAdding_Status == true) { if (MessageBox.Show("是否放弃添加", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) == DialogResult.Yes) { StudentMS_logic.DGV_studentInfo_Load(this.DGV_studentInfo); Data_Load(); Status.IsAdding_Status = false; } } }