示例#1
0
 public CreerFacture(Client clientCible)
 {
     InitializeComponent();
     if(clientCible.Equals(Client.EmptyClient()))
         Close();
     m_clientCible = clientCible;
 }
示例#2
0
        public static void SupprimerClient(Client c)
        {
            _bddCommand.CommandText = "DELETE FROM Clients WHERE [ID] =" + c.ID;
            _bddCommand.Parameters.Clear();

            _bddCommand.ExecuteNonQuery();
            UpdateBDD();
        }
 public CreateClient(List<Client> clients, Client clientM) : this(clients, false)
 {
    Text = @"Modification d'un client !";
    button_createClient.Text = @"Modifier le client !";
    textBox_nom.Text = clientM.Nom;
    textBox_localité.Text = clientM.Localité;
    textBox_commune.Text = clientM.Commune;
    textbox_tvaNum.Text = clientM.TvaNum;
    textBox_infoSupp.Text = clientM.InfoSuppl;
    checkBox_isEntreprise.Checked = clientM.EstEntreprise;
    Actualiser(this, new KeyEventArgs(Keys.A));
    m_clientModifier = clientM;
    ShowDialog();
 }
示例#4
0
 public static void ModifierClient(Client clientOrigine, Client clientModifier)
 {
     _bddCommand.CommandText = "UPDATE [Clients] SET [Nom] = @Nom, [Adresse] = @Adresse, [Commune] = @Commune, [TVA] = @TVA, [Info] = @Info, [Entreprise] = @Entreprise WHERE [ID] = @id";
     _bddCommand.Parameters.Clear();
     _bddCommand.Parameters.AddWithValue("@Nom", clientModifier.Nom);
     _bddCommand.Parameters.AddWithValue("@Adresse", clientModifier.Localité);
     _bddCommand.Parameters.AddWithValue("@Commune", clientModifier.Commune);
     _bddCommand.Parameters.AddWithValue("@TVA", clientModifier.TvaNum);
     _bddCommand.Parameters.AddWithValue("@Info", clientModifier.InfoSuppl);
     _bddCommand.Parameters.AddWithValue("@Entreprise", clientModifier.EstEntreprise);
     _bddCommand.Parameters.AddWithValue("@id", clientOrigine.ID);
     _bddCommand.ExecuteNonQuery();
     UpdateBDD();
 }
        private void button_CreateClient_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(textBox_nom.Text))
            {
                new ClientListException("Erreur lors de la création/modification du clients, le nom est vide !");
                return;
            }
            Client c = new Client(0, textBox_nom.Text, textBox_localité.Text, textBox_commune.Text, textbox_tvaNum.Text, checkBox_isEntreprise.Checked, textBox_infoSupp.Text);
            if (m_clientModifier != null)
            {
                m_clients.Remove(m_clientModifier);
                FormMain.SupprimerClientSelectTreeView();
                BaseDDonneeManager.ModifierClient(m_clientModifier, c);
            }
            else
            {
                BaseDDonneeManager.AjouterNouveauClient(c);
            }
            m_clients.Add(c);
            FormMain.AjouterClientTreeView(c);

            if (c.EstEntreprise)
            {
                FormMain.ChangerCouleurNode(c, FormMain.EntrepriseBackColor);
            }
            if (m_clientModifier != null)
            {
                MessageBox.Show(@"Modification du client terminé !");
            }
            else
            {
                MessageBox.Show(@"Création du client terminé !");

                if (
                MessageBox.Show(@"Créer un dossier avec TVA, PDF, Courrier ... pour " + c.Nom + @" ?",
                    @"Enregistrement d'un client", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question,
                    MessageBoxDefaultButton.Button1) == DialogResult.Yes)
                {
                    List<Client> clist = new List<Client>();
                    clist.Add(c);
                    FormMain.ForcerCreationDossier(clist);
                }
            }
            
            Close();
        }
示例#6
0
 public void AjouterNode(Client c)
 {
     TreeNode t = new TreeNode(c.Nom);
     if (c.EstEntreprise)
         t.BackColor = EntrepriseBackColor;
     t.Tag = c;
     c.NodeCorrespondant = t;
     treeView_listClient.Nodes.Add(t);
 }
示例#7
0
        private void toolStripTextBox_rechercher_KeyUp(object sender, KeyEventArgs e)
        {
            if (string.IsNullOrWhiteSpace(toolStripTextBox_rechercher.Text))
            {
                treeView_listClient.Nodes.Clear();
                foreach (var client in m_clients)
                {
                    AjouterNode(client);
                }
                return;
            }


            RemplirInformation(Client.EmptyClient());
            Client[] clientFind = new Client[m_clients.Count];
            int i = 0;

            if (toolStripTextBox_rechercher.Text.ToUpper().Equals("[E]") ||
                toolStripTextBox_rechercher.Text.ToUpper().Equals("[ENTREPRISE]"))
            {
                foreach (Client c in m_clients)
                {
                    if (c.EstEntreprise)
                    {
                        clientFind[i] = c;
                        i++;
                    }

                }
            }
            else
            {
                foreach (var client in m_clients)
                {
                    string[] nom = client.Nom.Split(' ');
                    foreach (var mot in nom)
                    {
                        if (mot.ToUpper().StartsWith(toolStripTextBox_rechercher.Text.ToUpper()))
                        {
                            clientFind[i] = client;
                            i++;
                        }
                    }
                }
            }

            treeView_listClient.Nodes.Clear();
            foreach (var client in clientFind)
            {
                if (client != null)
                    AjouterNode(client);
            }
            DisableDossierDropDown();
        }
示例#8
0
        private void RemplirInformation(Client c)
        {
            textBox_nom.Text = c.Nom;
            textBox_localité.Text = c.Localité;
            textBox_commune.Text = c.Commune;
            textbox_tvaNum.Text = c.TvaNum;
            textBox_infoSuppl.Text = c.InfoSuppl;

            richTextBox_allInfo.Clear();
            richTextBox_allInfo.Text = string.Format("{0}\n{1}\n{2}\n\n{3}", c.Nom, c.Localité, c.Commune, c.TvaNum);
            richTextBox_allInfo.Select(0, richTextBox_allInfo.Lines[0].Length);
            richTextBox_allInfo.SelectionFont = new Font(Settings.Default.MainFont, FontStyle.Bold);

            toolStripDropDownButton_dossier.Enabled = !c.Equals(Client.EmptyClient());

            toolStripDropDownButton_dossier.DropDownItems.Clear();

            TClient.Text = c.Nom;
            toolStripDropDownButton_dossier.DropDownItems.Add(TClient);
            toolStripDropDownButton_dossier.DropDownItems.Add(new ToolStripSeparator());
            toolStripDropDownButton_dossier.DropDownItems.Add(TTVA);
            toolStripDropDownButton_dossier.DropDownItems.Add(TPDF);
            toolStripDropDownButton_dossier.DropDownItems.Add(TCourrier);
            toolStripDropDownButton_dossier.DropDownItems.Add(new ToolStripSeparator());
            if (c.EstEntreprise)
            {
                toolStripDropDownButton_dossier.DropDownItems.Add(TBilan);
                toolStripDropDownButton_dossier.DropDownItems.Add(TISOC);
            }
            else
            {
                toolStripDropDownButton_dossier.DropDownItems.Add(TIPP);
            }
        }
示例#9
0
 public static void ChangerCouleurNode(Client c, Color couleur)
 {
     c.NodeCorrespondant.BackColor = couleur;
 }
示例#10
0
 public static void AjouterClientTreeView(Client c)
 {
     TreeNode node = new TreeNode(c.Nom) { Tag = c };
     c.NodeCorrespondant = node;
     _treeviewInstance.Nodes.Add(node);
 }
示例#11
0
        public static void AjouterNouveauClient(Client c)
        {
            _bddCommand.CommandText = "INSERT into Clients (Nom, Adresse, Commune, TVA, Info, Entreprise) Values(@Nom, @Adresse, @Commune, @TVA, @Info, @Entreprise)";
            _bddCommand.Parameters.Clear();

            _bddCommand.Parameters.AddWithValue("@Nom",
                string.IsNullOrWhiteSpace(c.Nom) ? "Pas de nom" : c.Nom);

            _bddCommand.Parameters.AddWithValue("@Adresse",
                string.IsNullOrWhiteSpace(c.Localité) ? "Pas d'adresse" : c.Localité);

            _bddCommand.Parameters.AddWithValue("@Commune",
                string.IsNullOrWhiteSpace(c.Commune) ? "Pas de commune" : c.Commune);

            _bddCommand.Parameters.AddWithValue("@TVA",
                string.IsNullOrWhiteSpace(c.TvaNum) ? "BE 0" : c.TvaNum);

            _bddCommand.Parameters.AddWithValue("@Info",
                string.IsNullOrWhiteSpace(c.InfoSuppl) ? "" : c.InfoSuppl);

            _bddCommand.Parameters.AddWithValue("@Entreprise", c.EstEntreprise);

            _bddCommand.ExecuteNonQuery();
            UpdateBDD();
        }