示例#1
0
        private void toolQRPlain_Click(object sender, EventArgs e)
        {
            try
            {
                MalystManager.ISearchtable iSearch = this.ActiveMdiChild as MalystManager.ISearchtable;
                if (iSearch == null)
                {
                    iSearch = this._MMActiveForm as MalystManager.ISearchtable;
                }
                if (iSearch == null)
                {
                    MessageBox.Show("Vui lòng chọn một cửa sổ muốn lập báo cáo nhanh");
                    return;
                }
                SaveFileDialog saveDlg = new SaveFileDialog();
                saveDlg.Filter = "Plain Unicode Text|*.txt";
                saveDlg.SupportMultiDottedExtensions = true;
                saveDlg.FileName = this.ActiveMdiChild.Text + DateTime.Now.ToFileTime();
                if (saveDlg.ShowDialog() == DialogResult.OK)
                {
                    DataGridView g = iSearch.IGrid;
                    string[,] r = Utility.Miscellaneous.GetGridContent(g);

                    StreamWriter sw = new StreamWriter(saveDlg.OpenFile());
                    sw.Write(Utility.Miscellaneous.GetTabText(r));
                    sw.Flush();
                    sw.Close();
                    sw.Dispose();
                    System.Diagnostics.Process.Start(saveDlg.FileName);
                }
            }
            catch (Exception) { }
        }
示例#2
0
        private void toolQRExcel_Click(object sender, EventArgs e)
        {
            MalystManager.ISearchtable iSearch = this.ActiveMdiChild as MalystManager.ISearchtable;
            if (iSearch == null)
            {
                iSearch = this._MMActiveForm as MalystManager.ISearchtable;
            }
            if (iSearch == null)
            {
                MessageBox.Show("Vui lòng chọn một cửa sổ muốn lập báo cáo nhanh");
                return;
            }
            SaveFileDialog saveDlg = new SaveFileDialog();

            saveDlg.Filter = "Microsoft Excel XML document|*.excel.xml";
            saveDlg.SupportMultiDottedExtensions = true;
            try
            {
                saveDlg.FileName = this.ActiveMdiChild.Text + DateTime.Now.ToFileTime();
            }
            catch (Exception) { }
            if (saveDlg.ShowDialog() == DialogResult.OK)
            {
                DataGridView g = iSearch.IGrid;
                Utility.OfficeExcelXml.Write(saveDlg.OpenFile(),
                                             Utility.Miscellaneous.GetGridContent(g), this.ActiveMdiChild.Text != string.Empty ? this.ActiveMdiChild.Text: DateTime.Now.ToString("ddMMyyyy"));
                System.Diagnostics.Process.Start(saveDlg.FileName);
            }
        }
示例#3
0
        private void searchBox_KeyUp(object sender, KeyEventArgs e)
        {
            bool searchAll = false;

            if (e.KeyData == (Keys.Shift | Keys.Enter))
            {
                searchAll = true;
            }
            if (e.KeyCode == Keys.Enter || searchAll)
            {
                MalystManager.ISearchtable target = this.ActiveMdiChild as MalystManager.ISearchtable;
                if (target == null)
                {
                    target = this._MMActiveForm as MalystManager.ISearchtable;
                }
                string search = searchBox.Text.Trim();
                if (target != null && searchBox.Text != "")
                {
                    DataGridView g = target.IGrid;
                    g.ClearSelection();
                    for (int r = 0; r < g.RowCount; r++)
                    {
                        for (int c = 0; c < g.ColumnCount; c++)
                        {
                            try
                            {
                                if (g[c, r].Value.ToString().Contains(search))
                                {
                                    g[c, r].Selected = true;
                                    if (!searchAll)
                                    {
                                        g.FirstDisplayedCell = g[c, r];
                                        return;
                                    }
                                }
                            }
                            catch (NullReferenceException) { }
                        }
                    }
                    if (g.SelectedCells.Count == 0)
                    {
                        MessageBox.Show
                            ("Không tìm thấy! Chú ý là có phân biệt chữ hoa và chữ thường.\nNhấn Esc để thoát hộp thoại này.");
                    }
                    else
                    {
                        g.FirstDisplayedScrollingRowIndex = g.SelectedCells[0].RowIndex;
                    }
                }
                e.SuppressKeyPress = false;
            }
        }
示例#4
0
        private void reportSplitButton_Click(object sender, EventArgs e)
        {
            MalystManager.ISearchtable iSearch = this.ActiveMdiChild as MalystManager.ISearchtable;
            if (iSearch == null)
            {
                iSearch = this._MMActiveForm as MalystManager.ISearchtable;
            }
            if (iSearch == null)
            {
                MessageBox.Show("Vui lòng chọn một cửa sổ muốn lập báo cáo nhanh");
                return;
            }
            StringBuilder r = new StringBuilder();
            DataGridView  g = iSearch.IGrid;

            MalystManager.FormText ft = new MalystManager.FormText();
            ft.MdiParent        = this;
            ft.richTextBox.Text = Utility.Miscellaneous.GetTabText(Utility.Miscellaneous.GetGridContent(g));
            ft.Show();
        }
示例#5
0
 private void printablePagetoolStripButton_Click(object sender, EventArgs e)
 {
     try
     {
         MalystManager.ISearchtable iSearch = this.ActiveMdiChild as MalystManager.ISearchtable;
         if (iSearch == null)
         {
             iSearch = this._MMActiveForm as MalystManager.ISearchtable;
         }
         if (iSearch == null)
         {
             MessageBox.Show("Vui lòng chọn một cửa sổ muốn lập báo cáo nhanh");
             return;
         }
         DataGridView g = iSearch.IGrid;
         string[,] r = Utility.Miscellaneous.GetGridContent(g);
         Utility.PrintJob preview = new GiangManh.Utility.PrintJob();
         preview.Text(
             textPrintTitle.Text + Environment.NewLine + Environment.NewLine +
             Utility.Miscellaneous.GetTabPad(r, Utility.Miscellaneous.GetGridWidth(g), 5),
             this.ActiveMdiChild.Text);
     }
     catch (Exception) { }
 }