//--------------------------------------------------------------- private void m_btnOk_Click(object sender, EventArgs e) { if (m_txtNomTable.Text.Length == 0) { MessageBox.Show(I.T("Please enter a table name|20004")); return; } m_tableFromDataHotel.NomFinal = m_txtNomTable.Text; m_tableFromDataHotel.UseCache = m_chkUseCache.Checked; List <IColumnDeEasyQuery> lst = new List <IColumnDeEasyQuery>(); foreach (ListViewItem item in m_wndListeColonnes.Items) { if (item.Checked) { IColumnDefinition colFromSource = item.Tag as IColumnDefinition; if (colFromSource != null) { IColumnDeEasyQuery newCol = m_tableFromDataHotel.GetColonneFor(colFromSource); if (newCol == null) { newCol = new CColumnEQFromSource(colFromSource); } newCol.ColumnName = item.Text; lst.Add(newCol); } CColonneCalculeeDataHotel colCalc = item.Tag as CColonneCalculeeDataHotel; if (colCalc != null) { colCalc.ColumnName = item.Text; lst.Add(colCalc); } } } m_tableFromDataHotel.SetColonnesOrCalculees(lst); List <CColonneEQCalculee> colsCalc = new List <CColonneEQCalculee>(); foreach (CColonneEQCalculee col in m_ctrlFormulesNommees.GetFormules()) { colsCalc.Add(col); } m_tableFromDataHotel.ColonnesCalculees = colsCalc; CResultAErreur result = m_panelOptions.MajChamps(m_tableFromDataHotel); if (!result) { CFormAlerte.Afficher(result.Erreur); return; } DialogResult = DialogResult.OK; Close(); }
//-------------------------------------------------------------- private void FillItemCalcul(ListViewItem item, CColonneCalculeeDataHotel col) { item.Text = col.ColumnName; item.Tag = col; item.SubItems.Add(I.T("Calculation|20050")); item.Checked = true; item.BackColor = Color.LightGray; }
//------------------------------------------------------------------ private void m_btnAddField_LinkClicked(object sender, EventArgs e) { CColonneCalculeeDataHotel col = new CColonneCalculeeDataHotel(); if (CFormEditeColonneCalculeeDataHotel.EditeColonne(col, m_tableFromDataHotel, m_tableFromDataHotel.Query)) { ListViewItem item = new ListViewItem(); FillItemCalcul(item, col); m_wndListeColonnes.Items.Add(item); } }
private void m_menuProprietes_Click(object sender, EventArgs e) { if (m_wndListeColonnes.SelectedItems.Count == 1) { ListViewItem item = m_wndListeColonnes.SelectedItems[0]; CColonneCalculeeDataHotel col = item.Tag as CColonneCalculeeDataHotel; if (col != null && CFormEditeColonneCalculeeDataHotel.EditeColonne(col, m_tableFromDataHotel, m_tableFromDataHotel.Query)) { FillItemCalcul(item, col); } } }
//--------------------------------------------------------------- private void m_menuChamp_Opening(object sender, CancelEventArgs e) { e.Cancel = true; if (m_wndListeColonnes.SelectedItems.Count == 1) { ListViewItem item = m_wndListeColonnes.SelectedItems[0]; CColonneCalculeeDataHotel col = item != null ? item.Tag as CColonneCalculeeDataHotel : null; if (col != null) { e.Cancel = false; } } }
//------------------------------------------------------ public static bool EditeColonne(CColonneCalculeeDataHotel colonne, CODEQTableFromDataHotel table, CEasyQuery query) { using (CFormEditeColonneCalculeeDataHotel frm = new CFormEditeColonneCalculeeDataHotel()) { frm.m_colonne = colonne; frm.m_table = table; frm.m_query = query; if (colonne.Calcul != null) { frm.m_calculEnCours = CCloner2iSerializable.Clone(colonne.Calcul) as IDataHotelCalcul; } else { frm.m_calculEnCours = null; } if (frm.ShowDialog() == DialogResult.OK) { return(true); } } return(false); }