コード例 #1
0
ファイル: FrmSingle.cs プロジェクト: trancongvy/SGDDev17CDT
        private void simpleButtonNew_Click(object sender, EventArgs e)
        {
            Config.NewKeyValue("Operation", (sender as SimpleButton).Text);
            this.gcMain.Refresh();
            //this.gvMain.EndDataUpdate();
            string s = gvMain.ActiveFilterString;

            gvMain.ClearColumnsFilter();
            _frmDesigner.formAction = FormAction.New;
            _bindingSource.AddNew();
            _bindingSource.EndEdit();
            if (frmSingleDt == null)
            {
                frmSingleDt = new FrmSingleDt(_frmDesigner);
            }

            frmSingleDt.ShowDialog();
            gvMain.ActiveFilterString = s;
            gvMain.ApplyColumnsFilter();
            this.gvMain.BeginUpdate();
            this.gcMain.DataSource = null;
            this.gcMain.DataSource = _bindingSource.DataSource;
            this.gvMain.EndUpdate();
            this.gvMain.RefreshData();
            DisplayData();
            //this.bindingSource_CurrentChanged
            _data.DataChanged = false;
        }
コード例 #2
0
ファイル: FrmDetail.cs プロジェクト: trancongvy/SGDDev17CDT
 private void simpleButtonCopy_Click(object sender, EventArgs e)
 {
     Config.NewKeyValue("Operation", (sender as SimpleButton).Text);
     _frmDesigner.formAction = FormAction.Copy;
     if (frmSingleDt == null)
     {
         frmSingleDt = new FrmSingleDt(_frmDesigner);
     }
     frmSingleDt.ShowDialog();
 }
コード例 #3
0
ファイル: FrmDetail.cs プロジェクト: trancongvy/SGDDev17CDT
 private void simpleButtonEdit_Click(object sender, EventArgs e)
 {
     Config.NewKeyValue("Operation", (sender as SimpleButton).Text);
     _frmDesigner.formAction = FormAction.Edit;
     if (frmSingleDt == null)
     {
         frmSingleDt = new FrmSingleDt(_frmDesigner);
     }
     frmSingleDt.ShowDialog();
     if (frmSingleDt.DialogResult == DialogResult.Cancel)
     {
         bsMain.DataSource = _data.DsData;
     }
 }
コード例 #4
0
ファイル: FrmSingle.cs プロジェクト: trancongvy/SGDDev17CDT
        private void simpleButtonCopy_Click(object sender, EventArgs e)
        {
            Config.NewKeyValue("Operation", (sender as SimpleButton).Text);
            _frmDesigner.formAction = FormAction.Copy;

            if (frmSingleDt == null)
            {
                frmSingleDt = new FrmSingleDt(_frmDesigner);
            }
            frmSingleDt.ShowDialog();
            this.gvMain.BeginUpdate();
            this.gcMain.DataSource = null;
            this.gcMain.DataSource = _bindingSource.DataSource;
            DisplayData();
            this.gvMain.EndUpdate();
            this.gvMain.RefreshData();
        }
コード例 #5
0
ファイル: FrmSingle.cs プロジェクト: trancongvy/SGDDev17CDT
        private void ChangeCode()
        {
            Config.NewKeyValue("Operation", "F5-Sao chép");
            _frmDesigner.formAction = FormAction.Copy;
            DataRow OldCode = (_bindingSource.Current as DataRowView).Row;

            if (frmSingleDt == null)
            {
                frmSingleDt = new FrmSingleDt(_frmDesigner);
            }

            frmSingleDt.ShowDialog();
            this.gvMain.BeginUpdate();
            if (frmSingleDt.DialogResult != DialogResult.Cancel)
            {
                DataRow NewCode = (_bindingSource.Current as DataRowView).Row;

                if (XtraMessageBox.Show("Có chắc chắn muốn chuyển Mã không?", "Xác nhận", MessageBoxButtons.YesNo) == DialogResult.Yes)
                {
                    (_data as DataSingle).ChangeCode(OldCode, NewCode);

                    Config.NewKeyValue("Operation", "F4 - Xóa");
                    int index = _bindingSource.Find(_data.DrTable["pk"].ToString(), OldCode[_data.DrTable["pk"].ToString()]);
                    _bindingSource.Position = index;
                    _frmDesigner.formAction = FormAction.Delete;
                    _bindingSource.RemoveCurrent();
                }
            }
            if (!_data.UpdateData(DataAction.Delete))
            {
                _data.CancelUpdate();
                DisplayData();
            }

            _data.Reset();

            this.gcMain.DataSource = null;
            this.gcMain.DataSource = _bindingSource.DataSource;
            DisplayData();
            this.gvMain.EndUpdate();
            this.gvMain.RefreshData();
        }