Пример #1
0
        private void simpleButtonOk_Click(object sender, EventArgs e)
        {
            _GestoreProfili.SetCodiceSconto(_CodiceSconto);

            DialogResult = System.Windows.Forms.DialogResult.OK;
        }
Пример #2
0
        private void simpleButtonOk_Click(object sender, EventArgs e)
        {
            AggiornaTotale();
            if (this.spinEditNumero.BackColor == Color.LightSalmon || this.spinEditNumeroS.BackColor == Color.LightSalmon)
            {
                XtraMessageBox.Show("Valori incongruenti, siete pregati di controllare.", "Errore", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            m_GestoreProfili.ElencoProfili.Clear();

            int totaleSingolo = 0;

            foreach (TreeListNode treeListNode in this.treeListSingolo.Nodes)
            {
                int valore = SafeInt(treeListNode.GetValue(this.treeListSingolo.Columns[ColonnaQta]));
                totaleSingolo += valore;
                if (valore != 0)
                {
                    ProfiloCliente newProfiloCliente = new ProfiloCliente(valore, treeListNode.Tag as Titolo, false);

                    m_GestoreProfili.ElencoProfili.Add(newProfiloCliente);
                }
                if (treeListNode.HasChildren)
                {
                    totaleSingolo += CheckChildrens(treeListNode, this.treeListSingolo, false);
                }
            }

            int totaleScuola = 0;

            if (this.checkEditScuola.Checked)
            {
                foreach (TreeListNode treeListNode in this.treeListScuola.Nodes)
                {
                    int valore = SafeInt(treeListNode.GetValue(this.treeListScuola.Columns[ColonnaQta]));
                    totaleScuola += valore;
                    if (valore != 0)
                    {
                        ProfiloCliente newProfiloCliente = new ProfiloCliente(valore, treeListNode.Tag as Titolo, true);

                        m_GestoreProfili.ElencoProfili.Add(newProfiloCliente);
                    }
                    if (treeListNode.HasChildren)
                    {
                        totaleScuola += CheckChildrens(treeListNode, this.treeListScuola, true);
                    }
                }

                int totale = (int)this.spinEditNumeroS.Value;
                totale = totale - totaleScuola;
                if (totale > 0)
                {
                    ProfiloCliente newProfiloCliente = new ProfiloCliente(totale, null, true);
                    m_GestoreProfili.ElencoProfili.Add(newProfiloCliente);
                    totaleScuola += totale;
                }
            }

            int totaleInteri = (int)this.spinEditNumero.Value;

            totaleInteri = totaleInteri - totaleScuola - totaleSingolo;
            if (totaleInteri > 0)
            {
                ProfiloCliente newProfiloCliente = new ProfiloCliente(totaleInteri, null, false);
                m_GestoreProfili.ElencoProfili.Add(newProfiloCliente);
            }

            m_GestoreProfili.SetCodiceSconto(m_GestoreProfili.GetCodiceSconto());

            DialogResult = DialogResult.OK;
        }