public void Delete() { DataRowView currentRow = (DataRowView)bs_Lop.Current; if (AbleDeleteClass()) { Frm_ActionInfo frm_delete = new Frm_ActionInfo( new Object[] { this.splc_Container, this.brm_Option }, new CallBackAction(Share.Action.Delete, SetUpCurrentData(currentRow.Row.ItemArray))); frm_delete.Choosen += (result) => { if (result == DialogResult.Yes) { try { this._callAction.FillData(Share.Action.RecoveryDelete, SetUpCurrentData(currentRow.Row.ItemArray)); bs_Lop.RemoveCurrent(); SaveClassToDb(); } catch (Exception ex) { MessageBox.Show("Can not delete row because: " + ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } } }; frm_delete.Parent = this; frm_delete.BringToFront(); frm_delete.Show(); } }
private void tsmi_Reset_Click(object sender, EventArgs e) { if (_callBackSubform.BackAction == Share.Action.None) { MessageBox.Show("Không có dữ liệu để phục hồi. Vui lòng kiểm tra lại!", "Phục hồi", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } else { Frm_ActionInfo frm_Recovery = new Frm_ActionInfo( new Object[] { this.splc_Container, this.brm_Option }, this._callBackSubform); frm_Recovery.Choosen += (result) => { if (result == DialogResult.Yes) { RecoveryDataByActionSub(this._callBackSubform); } }; frm_Recovery.Parent = this; frm_Recovery.BringToFront(); frm_Recovery.Show(); } }
private void btn_Write_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { try { if (btn_Write.Tag == null) { return; } if (this.btn_Write.Tag.Equals("ADD")) { bool addSucess = Add(); if (addSucess) { this.dgv_Students.DataSource = bs_SinhVien; SaveClassToDb(); Frm_ActionInfo info = new Frm_ActionInfo( new Object[] { this.splc_Container, this.brm_Option }, new CallBackAction(Share.Action.AddSuccess, this._callAction.Table) ); info.Parent = this; info.BringToFront(); info.Show(); } } else if (this.btn_Write.Tag.Equals("EDIT")) { bool editSuccess = Edit(); if (editSuccess) { SaveClassToDb(); DataTable dt = SetUpCurrentData(((DataRowView)bs_Lop.Current).Row.ItemArray); Frm_ActionInfo frm_edit = new Frm_ActionInfo( new Object[] { this.splc_Container, this.brm_Option }, new CallBackAction(Share.Action.EditSuccess, SetUpCurrentData(new object[] { txt_CodeClass.Text, txt_NameClass.Text, cmb_Khoa.SelectedValue })) ); frm_edit.Parent = this; frm_edit.BringToFront(); frm_edit.Show(); pnl_grv.Enabled = true; bs_Lop.DataSource = ds_TN_CSDLPT; grv_Lop.Refresh(); dgv_Students.Refresh(); } } else { return; } } catch (Exception ex) { if (ex.Message.Contains("MALOP")) { MessageBox.Show("Mã lớp không được trùng", "", MessageBoxButtons.OK); } else { MessageBox.Show("Lỗi ghi Lớp" + ex.Message, "", MessageBoxButtons.OK); } } }
private void btn_Write_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { try { if (btn_Write.Tag == null) { return; } if (this.btn_Write.Tag.Equals("ADD")) { bool addSucess = Add(); if (addSucess) { Frm_ActionInfo info = new Frm_ActionInfo( new Object[] { this.splc_Container, this.brm_Option }, new CallBackAction(Share.Action.AddSuccess, this._callAction.Table) ); info.Parent = this; info.BringToFront(); info.Show(); txt_QuestionCode.Text = GetIndexCodeForQuestion().ToString(); } } else if (this.btn_Write.Tag.Equals("EDIT")) { bool editSuccess = Edit(); if (editSuccess) { DataTable dt = SetUpCurrentData(((DataRowView)bs_BoDe.Current).Row.ItemArray); Frm_ActionInfo frm_edit = new Frm_ActionInfo( new Object[] { this.splc_Container, this.brm_Option }, new CallBackAction(Share.Action.EditSuccess, dt) ); frm_edit.Parent = this; frm_edit.BringToFront(); frm_edit.Show(); } } else { return; } } catch (Exception ex) { if (ex.Message.Contains("CAUHOI")) { MessageBox.Show("Mã CH không được trùng", "", MessageBoxButtons.OK); } else { MessageBox.Show("Lỗi ghi Bộ đề" + ex.Message, "", MessageBoxButtons.OK); } } }
private void btn_Write_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { try { if (btn_Write.Tag == null) { return; } if (this.btn_Write.Tag.Equals("ADD")) { bool addSucess = Add(); if (addSucess) { this.dgv_Teachers.DataSource = bs_GiaoVien; WriteToDB(); Frm_ActionInfo info = new Frm_ActionInfo( new Object[] { this.splc_Container, this.brm_Option }, new CallBackAction(Share.Action.AddSuccess, this._callAction.Table) ); info.Parent = this; info.BringToFront(); info.Show(); //this.dgv_Teachers.DataSource = this.bs_GiaoVien; //this.grv_Khoa.Enabled = false; } } else if (this.btn_Write.Tag.Equals("EDIT")) { bool editSuccess = Edit(); if (editSuccess) { WriteToDB(); DataTable dt = SetUpCurrentData(((DataRowView)bs_Khoa.Current).Row.ItemArray); Frm_ActionInfo frm_edit = new Frm_ActionInfo( new Object[] { this.splc_Container, this.brm_Option }, new CallBackAction(Share.Action.EditSuccess, SetUpCurrentData(new object[] { txt_CodeDepartment.Text, txt_NameDepartment.Text, txt_CodeBrand.Text })) ); frm_edit.Parent = this; frm_edit.BringToFront(); frm_edit.Show(); pnl_grv.Enabled = true; bs_Khoa.DataSource = ds_TN_CSDLPT; grv_Khoa.Refresh(); dgv_Teachers.Refresh(); } } else { return; } } catch (Exception ex) { if (ex.Message.Contains("MAKH")) { MessageBox.Show("Mã Khoa không được trùng", "", MessageBoxButtons.OK); } else { MessageBox.Show("Lỗi ghi Khoa" + ex.Message, "", MessageBoxButtons.OK); } } }
private void btn_Write_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { try { if (btn_Write.Tag == null) { return; } if (this.btn_Write.Tag.Equals("ADD")) { bool addSucess = Add(); if (addSucess) { WriteToDB(); Frm_ActionInfo info = new Frm_ActionInfo( new Object[] { this.splc_Container, this.brm_Option }, new CallBackAction(Share.Action.AddSuccess, this._callAction.Table) ); info.Parent = this; info.BringToFront(); info.Show(); } } else if (this.btn_Write.Tag.Equals("EDIT")) { bool editSuccess = Edit(); if (editSuccess) { WriteToDB(); DataTable dt = SetUpCurrentData(((DataRowView)bs_MonHoc.Current).Row.ItemArray); Frm_ActionInfo frm_edit = new Frm_ActionInfo( new Object[] { this.splc_Container, this.brm_Option }, new CallBackAction(Share.Action.EditSuccess, SetUpCurrentData(new object[] { txt_CodeCourse.Text, txt_NameCourse.Text })) ); frm_edit.Parent = this; frm_edit.BringToFront(); frm_edit.Show(); } } else { return; } } catch (Exception ex) { if (ex.Message.Contains("MAMH")) { MessageBox.Show("Mã môn học không được trùng", "", MessageBoxButtons.OK); } else { MessageBox.Show("Lỗi ghi Môn học. " + ex.Message, "", MessageBoxButtons.OK); } } }