private void Add_Button_Click(object sender, EventArgs e) { //czysci porjekty przy zamknieciu okienka //spr null tag //albo chowaj przy nie obslugiwanych //rozszerza się na role tak czy tak var curtab = tabControl.SelectedTab; //char tabtag = Convert.ToChar(curtab.Tag); TabTagData tabtabtag = curtab.Tag as TabTagData; //null check char tabtag = tabtabtag.Mode; int? optID = tabtabtag.optionalID; switch (tabtag) { case 'u': UserForm newUserForm = new UserForm(); newUserForm.ShowDialog(); break; case 'r': RoleForm newRoleForm = new RoleForm(); newRoleForm.ShowDialog(); break; case 'p': ProjectForm newProjectForm = new ProjectForm(); newProjectForm.ShowDialog(); break; case 's': SprintForm newSprintForm = new SprintForm(optID); newSprintForm.ShowDialog(); break; case 'f': PhaseForm newPhaseForm = new PhaseForm(); newPhaseForm.ShowDialog(); break; case 't': TaskForm newTaskForm = new TaskForm(optID); newTaskForm.ShowDialog(); break; } //curtab.Controls.Remove; //coś tutaj spr //dataTable.TableDataMode = tabtag; //czy potrzeba? //pozostalosc ostatniego //nie działa //dataTable.RefreshTable(); }
private void Edit_Button_Click(object sender, EventArgs e) { //gdy rekordu brak nie rób nic var curtab = tabControl.SelectedTab; TabTagData tabtabtag = curtab.Tag as TabTagData; char tabtag = tabtabtag.Mode; int? optID = tabtabtag.optionalID; switch (tabtag) { case 'u': UserForm newUserForm = new UserForm(); newUserForm.ShowDialog(); break; case 'r': RoleForm newRoleForm = new RoleForm(); newRoleForm.ShowDialog(); break; case 'p': ProjectForm newProjectForm = new ProjectForm(dataTable.someMiscTempVarThatShoudntBeHereInTheFirstPlaceToBeginWith); newProjectForm.ShowDialog(); break; case 's': SprintForm newSprintForm = new SprintForm(optID); newSprintForm.ShowDialog(); break; case 'f': PhaseForm newPhaseForm = new PhaseForm(); newPhaseForm.ShowDialog(); break; case 't': TaskForm newTaskForm = new TaskForm(optID); newTaskForm.ShowDialog(); break; } dataTable.TableDataMode = tabtag; //nie działa //dataTable.RefreshTable(); }
private void fazyToolStripMenuItem_Click(object sender, EventArgs e) { TabPage test = new TabPage("Fazy"); TabTagData data = new TabTagData(); data.Mode = 'f'; test.Tag = data; dataTable = new TableUserControl(); dataTable.TableDataMode = 'f'; test.Controls.Add(dataTable); tabControl.TabPages.Add(test); tabControl.SelectedTab = test; }
private void użytkownicyToolStripMenuItem_Click(object sender, EventArgs e) { TabPage test = new TabPage("Użytkownicy"); TabTagData data = new TabTagData(); data.Mode = 'u'; test.Tag = data; dataTable = new TableUserControl(); dataTable.TableDataMode = 'u'; dataTable.Dock = DockStyle.Fill; test.Controls.Add(dataTable); tabControl.TabPages.Add(test); tabControl.SelectedTab = test; }
private void dataTableView_CellMouseDoubleClick(object sender, DataGridViewCellMouseEventArgs e) { int testid = Convert.ToInt16(dataTableView[0, e.RowIndex].Value); switch (TableDataMode) { case 'p': { anotherMiscTempVarThatShoudntBeHereInTheFirstPlaceToBeginWith = testid; TabPage test = new TabPage("Sprinty projektu " + testid); TabTagData data = new TabTagData(); data.Mode = 's'; data.optionalID = testid; test.Tag = data; //test.Tag = 's'; TableUserControl dataTable = new TableUserControl(); dataTable.TableDataMode = 's'; dataTable.someMiscTempVarThatShoudntBeHereInTheFirstPlaceToBeginWith = testid; test.Controls.Add(dataTable); TabPage test2 = new TabPage("Zadania projektu " + testid); TabTagData data2 = new TabTagData(); data2.Mode = 't'; data2.optionalID = testid; test2.Tag = data2; //test2.Tag = 't'; TableUserControl dataTable2 = new TableUserControl(); dataTable2.TableDataMode = 't'; dataTable2.someMiscTempVarThatShoudntBeHereInTheFirstPlaceToBeginWith = testid; test2.Controls.Add(dataTable2); TabPage test3 = new TabPage("Użytkownicy projektu " + testid); TabTagData data3 = new TabTagData(); data3.Mode = 'u'; data3.optionalID = testid; test3.Tag = data3; //test3.Tag = 'u'; TableUserControl dataTable3 = new TableUserControl(); dataTable3.TableDataMode = 'u'; dataTable3.someMiscTempVarThatShoudntBeHereInTheFirstPlaceToBeginWith = testid; test3.Controls.Add(dataTable3); MainForm mainFormtest = (MainForm)this.Parent.Parent.Parent.Parent.Parent; //heh mainFormtest.TabControlPages2 = test; mainFormtest.TabControlPages2 = test2; mainFormtest.TabControlPages2 = test3; break; } case 's': { var aaa = (TabTagData)this.Parent.Tag; //var wambo = aaa.optionalID; int? projectID = aaa.optionalID; // (TabPage)this.Parent; TabPage test = new TabPage("Zadania sprintu " + testid + " projektu" + projectID); TabTagData data = new TabTagData(); data.Mode = 't'; data.optionalID = testid; data.optionalID2 = projectID; test.Tag = data; TableUserControl dataTable = new TableUserControl(); dataTable.TableDataMode = 't'; dataTable.someMiscTempVarThatShoudntBeHereInTheFirstPlaceToBeginWith = testid; dataTable.anotherMiscTempVarThatShoudntBeHereInTheFirstPlaceToBeginWith = projectID; test.Controls.Add(dataTable); MainForm mainFormtest = (MainForm)this.Parent.Parent.Parent.Parent.Parent; //heh mainFormtest.TabControlPages2 = test; /* * * TabPage test2 = new TabPage("Zadania projektu " + testid); * TabTagData data2 = new TabTagData(); * data2.Mode = 't'; * data2.optionalID = testid; * test2.Tag = data2; * //test2.Tag = 't'; * TableUserControl dataTable2 = new TableUserControl(); * dataTable2.TableDataMode = 't'; * dataTable2.someMiscTempVarThatShoudntBeHereInTheFirstPlaceToBeginWith = testid; * test2.Controls.Add(dataTable2);*/ break; } case 't': { break; } case 'u': { break; } case 'f': { break; } case 'r': { break; } } }