private void сохранитьКакToolStripMenuItem_Click(object sender, EventArgs e) { JsonDataBase.Save(); saveFileDialog1.Filter = "XLS files (*.xls, *.xlt)|*.xls;*.xlt|XLSX files (*.xlsx, *.xlsm, *.xltx, *.xltm)|*.xlsx;*.xlsm;*.xltx;*.xltm|ODS files (*.ods, *.ots)|*.ods;*.ots|CSV files (*.csv, *.tsv)|*.csv;*.tsv|HTML files (*.html, *.htm)|*.html;*.htm"; saveFileDialog1.FilterIndex = 2; if (saveFileDialog1.ShowDialog() == DialogResult.OK) { var item = (DataGridView)Tables.SelectedTab.Controls[0]; JsonDataBase.SaveTemplate(ref item, saveFileDialog1.FileName); } }
private void создатьToolStripMenuItem_Click(object sender, EventArgs e) { TabPage temp = new TabPage($"New Table {Tables.TabPages.Count + 1}"); Tables.TabPages.Add(temp); DataGridView dvg = new DataGridView() { Dock = DockStyle.Fill }; temp.Controls.Add(dvg); JsonDataBase.LoadTemplate(ref dvg); }
private void сохранитьToolStripMenuItem_Click(object sender, EventArgs e) { for (int i = 0; i < 4; i++) { var item = (DataGridView)Tables.TabPages[i].Controls[0]; JsonDataBase.SaveTemplate(ref item, $@"..\Template{i + 1}.xlsx"); } for (int i = 4; i < Tables.TabPages.Count; i++) { var item = (DataGridView)Tables.TabPages[i].Controls[0]; JsonDataBase.SaveTemplate(ref item, Tables.TabPages[i].Text); } JsonDataBase.Save(); }
private void Open_Click(object sender, EventArgs e) { openFileDialog1.Filter = "XLS files (*.xls, *.xlt)|*.xls;*.xlt|XLSX files (*.xlsx, *.xlsm, *.xltx, *.xltm)|*.xlsx;*.xlsm;*.xltx;*.xltm|ODS files (*.ods, *.ots)|*.ods;*.ots|CSV files (*.csv, *.tsv)|*.csv;*.tsv|HTML files (*.html, *.htm)|*.html;*.htm"; openFileDialog1.FilterIndex = 2; if (openFileDialog1.ShowDialog() == DialogResult.OK) { TabPage temp = new TabPage(openFileDialog1.FileName); Tables.TabPages.Add(temp); DataGridView dvg = new DataGridView() { Dock = DockStyle.Fill }; temp.Controls.Add(dvg); JsonDataBase.LoadTemplate(ref dvg, openFileDialog1.FileName); } }
private void ВыходToolStripMenuItem_Click(object sender, EventArgs e) { JsonDataBase.Save(); for (int i = 0; i < Tables.TabPages.Count; i++) { saveFileDialog1.Filter = "XLS files (*.xls, *.xlt)|*.xls;*.xlt|XLSX files (*.xlsx, *.xlsm, *.xltx, *.xltm)|*.xlsx;*.xlsm;*.xltx;*.xltm|ODS files (*.ods, *.ots)|*.ods;*.ots|CSV files (*.csv, *.tsv)|*.csv;*.tsv|HTML files (*.html, *.htm)|*.html;*.htm"; saveFileDialog1.FilterIndex = 2; if (saveFileDialog1.ShowDialog() == DialogResult.OK) { var item = (DataGridView)Tables.TabPages[i].Controls[0]; JsonDataBase.SaveTemplate(ref item, saveFileDialog1.FileName); } } Environment.Exit(0); }
private void button1_Click(object sender, EventArgs e) { if (filter.args != SortingFilters.None) { if (isCourseSorting.Checked && Course.Enabled) { filter.crs.AddRange(Course.SelectedItems.Cast <string>()); } if (isGroupSorting.Checked && Groupe.Enabled) { filter.grp.AddRange(Groupe.SelectedItems.Cast <string>()); } if (isDayOfWeekSotrting.Checked && DayWeek.Enabled) { filter.day.AddRange(DayWeek.SelectedItems.Cast <string>()); } if (isTimeSorting.Checked && Time.Enabled) { filter.time = ((DateTime)Start.SelectedItem, (DateTime)End.SelectedItem); } if (isSubjectSorting.Checked && Subject.Enabled) { filter.sbj.AddRange(Subject.SelectedItems.Cast <Subject>()); } if (isTeacherSorting.Checked && Teacher.Enabled) { filter.tch.AddRange(Teacher.SelectedItems.Cast <string>()); } for (int i = 0; i < 4; i++) { var item = (DataGridView)main.Tables.TabPages[i].Controls[0]; SortingArgs clone = (SortingArgs)filter.Clone(); JsonDataBase.Sort(clone, ref item); } DialogResult = DialogResult.OK; } else { button2_Click(sender, e); } }
public Dipper() { InitializeComponent(); for (int i = 1; i <= 4; i++) { TabPage temp = new TabPage($"Курс {i}.xlsx"); Tables.TabPages.Add(temp); DataGridView dvg = new DataGridView() { Dock = DockStyle.Fill, AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill }; dvg.AllowDrop = true; dvg.DragDrop += new DragEventHandler(this.dataGridView1_DragDrop); dvg.DragEnter += new DragEventHandler(this.dataGridView1_DragEnter); temp.Controls.Add(dvg); JsonDataBase.LoadTemplate(ref dvg, $@"..\Template{i}.xlsx"); } //JsonDataBase.LoadTemplate(ref dataGridView1); Pull.DataSource = JsonDataBase.PullOfSublect.ToList(); }