private void tabControlRezervacija_SelectedIndexChanged(object sender, EventArgs e) { if (tabControlRezervacija.SelectedTab == tabPageRezervacijaDetaljno) { panelButton.Visible = false; panelPretraga.Visible = false; panelNazivRezervacije.Visible = true; popuniDetaljno(); stateTab = StateTab.Detaljno; panelRacun.Visible = false; } else if (tabControlRezervacija.SelectedTab == tabPageRezervacija) { panelButton.Visible = true; panelPretraga.Visible = true; panelNazivRezervacije.Visible = false; stateTab = StateTab.Rezervacija; btnObrisi.Text = "Obrisi"; btnPrebaciNaRacun.Text = "Prebaci na racun"; panelRacun.Visible = false; } else { panelPretraga.Visible = false; panelButton.Visible = true; panelRacun.Visible = true; } if (dgvPregledRezervacija.SelectedRows.Count > 0) { lblNazivRezervacije.Text = dgvPregledRezervacija.SelectedRows[0].Cells["Naziv rezervacije"].Value.ToString(); } }
/// <summary> /// Draws the ItemTypes editor. /// </summary> private void DrawTab(StateTab tab) { if (null == tab.animationStateSet) { EditorGUILayout.HelpBox("An invalid animation collection was selected.", MessageType.Error); } var animationStates = tab.animationStateSet != null ? tab.animationStateSet.AnimationStates : null; EditorGUILayout.BeginHorizontal(); GUI.SetNextControlName("AnimationStateName"); m_AnimationStateName = EditorGUILayout.TextField("Name", m_AnimationStateName); GUI.enabled = !string.IsNullOrEmpty(m_AnimationStateName) && (tab.treeView.TreeModal as AnimationStateModel).IsUniqueName(m_AnimationStateName); if (GUILayout.Button("Add", GUILayout.Width(100)) || (Event.current.keyCode == KeyCode.Return && GUI.GetNameOfFocusedControl() == "AnimationStateName")) { // Create the new ItemType. var itemType = new Inventory.AnimationState(); itemType.name = m_AnimationStateName; // Add the ItemType to the ItemCollection. Array.Resize(ref animationStates, animationStates != null ? animationStates.Length + 1 : 1); itemType.ID = animationStates.Length - 1; animationStates[animationStates.Length - 1] = itemType; tab.animationStateSet.AnimationStates = animationStates; Debug.Log("Asset path: " + AssetDatabase.GetAssetPath(tab.animationStateSet)); AssetDatabase.ImportAsset(AssetDatabase.GetAssetPath(tab.animationStateSet)); // Select the newly added item. tab.treeView.SetSelection(new List <int>() { itemType.ID }, TreeViewSelectionOptions.FireSelectionChanged); // Reset. EditorUtility.SetDirty(m_AnimationStateCollection); EditorUtility.SetDirty(tab.animationStateSet); m_AnimationStateName = string.Empty; GUI.FocusControl(""); tab.treeView.Reload(); } EditorGUILayout.EndHorizontal(); GUI.enabled = true; GUILayout.Space(5); if (animationStates != null && animationStates.Length > 0) { var guiRect = GUILayoutUtility.GetLastRect(); var height = m_MainManagerWindow.position.height - guiRect.yMax - 21; tab.treeView.searchString = tab.searchField.OnGUI(new Rect(0, guiRect.yMax, m_MainManagerWindow.position.width - m_MainManagerWindow.MenuWidth - 2, 20), tab.treeView.searchString); tab.treeView.OnGUI(new Rect(0, guiRect.yMax + 20, m_MainManagerWindow.position.width - m_MainManagerWindow.MenuWidth - 1, height)); // OnGUI doesn't update the GUILayout rect so add a blank space to account for it. GUILayout.Space(height + 10); } }
/// <summary> /// Default ItemTypeManager constructor. /// </summary> public AnimationStateManager() { m_ItemIdTab = CreateTab("Item Id", out m_ItemIdTreeViewState); m_ItemStateIndexTab = CreateTab("Item State Index", out m_ItemStateIndexTreeViewState); m_AbilityIndexTab = CreateTab("Ability Index", out m_AbilityIndexTreeViewState); m_Tabs = new StateTab[] { m_ItemIdTab, m_ItemStateIndexTab, m_AbilityIndexTab }; Undo.undoRedoPerformed += OnUndoRedo; }
private void btnPrebaciNaRacun_Click(object sender, EventArgs e) { if (stateTab == StateTab.Rezervacija) { TabPage tab = new TabPage(); tab.Name = "Racun"; tab.Text = "Racun"; tabControlRezervacija.Controls.Add(tab); tabControlRezervacija.SelectedTab = tab; tabControlRezervacija.Enabled = false; DataGridView dgv = new DataGridView(); string commandText = @"Select k.KartaID,k.RezervacijaID,k.ProjekcijaID,k.TerminID,t.VrijemePrikazivanja,k.SjedisteID,s.BrojSjedista as [Broj sjedista], k.VrijemeIzdavanja as [Vrijeme izdavanja],c.Cijena from dbo.Karta as k join dbo.Sjediste as s on k.SjedisteID = s.SjedisteID join dbo.Termin as t on k.TerminID = t.TerminID join dbo.Cijena as c on c.CijenaID = t.CijenaID where k.RezervacijaID = @RezervacijaID;"; List <SqlParameter> parameters = new List <SqlParameter>(); { SqlParameter parameter = new SqlParameter("@RezervacijaID", SqlDbType.SmallInt); parameter.Value = Convert.ToInt16(dgvPregledRezervacija.SelectedRows[0].Cells["RezervacijaID"].Value.ToString()); parameters.Add(parameter); } dgv.DataSource = Izvrsi(commandText, parameters); tab.Controls.Add(dgv); if (dgv.Rows.Count > 0) { hideColumn(dgv); } panelPretraga.Visible = false; dgv.Dock = DockStyle.Fill; btnObrisi.Text = "Odustani"; btnPrebaciNaRacun.Text = "Stampaj racun"; stateTab = StateTab.Racun; IzracunajSumuRacuna(dgv); } else if (stateTab == StateTab.Racun) { kreirajRacun(); prebaciRezervacijuNaRacun(); dodajCijenuNaRacun(); obrisiTab(); tabControlRezervacija.Enabled = true; popuniRezervacije(); } }
public RezervacijaForm(int terminId, string nazivFilma, string vrijemeFilma, int zaposleniID, string fullName) { InitializeComponent(); terminID = terminId; txtZaposleni.Text = fullName; this.zaposleniID = zaposleniID; lblNazivFilma.Text = nazivFilma; lblTermin.Text = vrijemeFilma; panelKarta.Visible = false; dgvPregledRezervacija.SelectionMode = DataGridViewSelectionMode.FullRowSelect; dgvDetaljnoRezervacija.SelectionMode = DataGridViewSelectionMode.FullRowSelect; lblStatusPrikaza.Visible = false; popuniRezervacije(); stateTab = StateTab.Rezervacija; }
private StateTab CreateTab(string name, out TreeViewState state) { StateTab tab = new StateTab(); tab.state = state = new TreeViewState(); var model = new AnimationStateModel(); model.BeforeModalChange += OnTreeWillChange; model.AfterModalChange += OnTreeChangeReload; tab.treeView = new FlatTreeView <AnimationStateModel>(tab.state, model); tab.treeView.TreeChange += OnTreeChange; tab.searchField = new SearchField(); tab.searchField.downOrUpArrowKeyPressed += tab.treeView.SetFocusAndEnsureSelectedItem; return(tab); }