示例#1
0
        private void simpleButtonPreview_Click(object sender, EventArgs e)
        {
            Config.NewKeyValue("Operation", (sender as SimpleButton).Text);
            if (gvMain.SelectedRowsCount == 0)
            {
                return;
            }
            //if (_data.DrTable["Report"].ToString() == string.Empty)
            //    gcMain.ShowPrintPreview();
            //else
            // {
            int[] oldIndex = gvMain.GetSelectedRows();
            int[] newIndex = oldIndex;
            if (gvMain.SortedColumns.Count > 0 || gvMain.GroupCount > 0)
            {
                for (int i = 0; i < oldIndex.Length; i++)
                {
                    newIndex[i] = _data.DsData.Tables[0].Rows.IndexOf(gvMain.GetDataRow(oldIndex[i]));
                }
            }

            BeforePrint bp = new BeforePrint(_data, newIndex);

            bp.ShowDialog();
            // }
        }
示例#2
0
 private void simpleButtonPreview_Click(object sender, EventArgs e)
 {
     Config.NewKeyValue("Operation", (sender as SimpleButton).Text);
     if (_data.DrTable["Report"].ToString() == string.Empty)
     {
         gcDetail.ShowPrintPreview();
     }
     else
     {
         BeforePrint bp = new BeforePrint(_data, new int[] { 0 });
         bp.ShowDialog();
     }
 }
        void bindingNavigator1_ItemClicked(object sender, ToolStripItemClickedEventArgs e)
        {
            switch (e.ClickedItem.Name)
            {
            case "toolStripButton1":
                if (_data.DataChanged)
                {
                    if (MessageBox.Show("Dữ liệu chưa được lưu, bạn có muốn lưu không?", "", MessageBoxButtons.YesNo) == DialogResult.Yes)
                    {
                        Config.NewKeyValue("Operation", "F12-Lưu");
                        UpdateData();
                        RemoveTabReport();
                    }
                    else
                    {
                        CancelUpdate();
                        break;
                    }
                }
                _frmDesigner.formAction = FormAction.New;

                _bindingSource.AddNew();
                _bindingSource.EndEdit();
                _frmDesigner.RefreshGridLookupEdit();
                _x = true;
                SetCurrentData();
                _frmDesigner.RefreshFormulaDetail();
                _frmDesigner.InsertedToDetail          = false;
                _frmDesigner.TabDetail.SelectedTabPage = _frmDesigner.TabDetail.TabPages[0];
                break;

            case "toolStripButton2":
                Config.NewKeyValue("Operation", "F12-Lưu");
                UpdateData();
                RemoveTabReport();
                break;

            case "toolStripButton3":
                //  Config.NewKeyValue("Operation", 'F7-Print");

                if (_data.DrTable["Report"].ToString() == string.Empty)
                {
                    return;
                }
                else
                {
                    int[]       newIndex = { _bindingSource.Position };
                    BeforePrint bp       = new BeforePrint(_data, newIndex);
                    bp.ShowDialog();
                }
                break;

            case "toolStripButton4":
                Config.NewKeyValue("Operation", "F12-Lưu");
                UpdateData();
                RemoveTabReport();
                if (!_x)
                {
                    //if (_data.DrTable["Report"].ToString() == string.Empty)
                    //    return;
                    //else
                    //{
                    //   // int[] newIndex ={ _bindingSource.Position };
                    //   // BeforePrint bp = new BeforePrint(_data, newIndex);
                    //  //  bp.ShowDialog();
                    //}
                    Config.NewKeyValue("Operation", "New");
                    _frmDesigner.formAction = FormAction.New;
                    _bindingSource.AddNew();
                    _bindingSource.EndEdit();
                    _frmDesigner.RefreshGridLookupEdit();
                    _x = true;
                    SetCurrentData();
                    _frmDesigner.RefreshFormulaDetail();
                    _frmDesigner.InsertedToDetail          = false;
                    _frmDesigner.TabDetail.SelectedTabPage = _frmDesigner.TabDetail.TabPages[0];
                }
                break;

            case "toolStripButton5":
                if (_bindingSource.Position < 0)
                {
                    return;
                }
                fComment fC = new fComment(_data, _bindingSource.Position);
                fC.ShowDialog();
                break;
            }
        }
        private void FrmMasterDetailDt_KeyDown(object sender, KeyEventArgs e)
        {
            switch (e.KeyCode)
            {
            case Keys.F2:
                if (_data.DataChanged)
                {
                    if (MessageBox.Show("Dữ liệu chưa được lưu, bạn có muốn lưu không?", "", MessageBoxButtons.YesNo) == DialogResult.Yes)
                    {
                        Config.NewKeyValue("Operation", "F12-Lưu");
                        UpdateData();
                        RemoveTabReport();
                    }
                    else
                    {
                        CancelUpdate();
                        break;
                    }
                }
                Config.NewKeyValue("Operation", "New");

                _frmDesigner.formAction = FormAction.New;

                _bindingSource.AddNew();
                _bindingSource.EndEdit();
                _frmDesigner.RefreshGridLookupEdit();
                _x = true;
                SetCurrentData();
                _frmDesigner.RefreshFormulaDetail();
                _frmDesigner.InsertedToDetail          = false;
                _frmDesigner.TabDetail.SelectedTabPage = _frmDesigner.TabDetail.TabPages[0];
                break;

            case Keys.F12:
                Config.NewKeyValue("Operation", "F11-Lưu");
                UpdateData();
                RemoveTabReport();
                break;

            case Keys.F7:
                if (_data.DrTable["Report"].ToString() == string.Empty)
                {
                    return;
                }
                else
                {
                    int[]       newIndex = { _bindingSource.Position };
                    BeforePrint bp       = new BeforePrint(_data, newIndex);
                    bp.ShowDialog();
                }
                break;

            case Keys.Escape:
                CancelUpdate();
                break;

            case Keys.F11:
                Config.NewKeyValue("Operation", "F12-Lưu");
                UpdateData();
                RemoveTabReport();
                if (!_x)
                {
                    //if (_data.DrTable["Report"].ToString() == string.Empty)
                    //    return;
                    // else
                    // {
                    //int[] newIndex ={ _bindingSource.Position };
                    ///   BeforePrint bp = new BeforePrint(_data, newIndex);
                    //   bp.ShowDialog();
                    // }
                    Config.NewKeyValue("Operation", "New");

                    _frmDesigner.formAction = FormAction.New;

                    _bindingSource.AddNew();
                    _bindingSource.EndEdit();
                    _x = true;
                    SetCurrentData();
                    _frmDesigner.RefreshFormulaDetail();
                    _frmDesigner.InsertedToDetail          = false;
                    _frmDesigner.TabDetail.SelectedTabPage = _frmDesigner.TabDetail.TabPages[0];
                }
                break;
            }
        }