Esempio n. 1
0
        void item_Click(object sender, RoutedEventArgs e)
        {
            selected_client = ((Client)((MenuItem)sender).Tag);
            SelectedClientLabel.Content = selected_client.ToString();
            NameTextBox.Text = ((MenuItem)sender).Header.ToString();

        }
Esempio n. 2
0
 private bool CompareForAutoComplete(string input, Client client)//We compare input with
 {//With our clients name and lastname, and if it matches return true;
     if (client.Name.ToLower().StartsWith(input.ToLower()) || client.LastName.ToLower().StartsWith(input.ToLower()))
     {
         return true;
     }
     else
     {
         return false;
     }
 }
Esempio n. 3
0
 private bool CompareForAutoComplete(string input, Client client)
 {
     if (client.Name.ToLower().StartsWith(input.ToLower()) || client.LastName.ToLower().StartsWith(input.ToLower()))
     {
         return true;
     }
     else
     {
         return false;
     }
 }
Esempio n. 4
0
        public static void affecterClient(DataGridView dgv, DAL.Client client)
        {
            client.id    = 0;
            client.nom   = "";
            client.rue   = "";
            client.ville = "";
            client.cp    = 0;
            client.tel   = 0;

            if (dgv.SelectedRows.Count > 0)
            {
                client.id    = int.Parse(dgv.SelectedRows[0].Cells[0].Value.ToString());
                client.nom   = dgv.SelectedRows[0].Cells[1].Value.ToString();
                client.rue   = dgv.SelectedRows[0].Cells[2].Value.ToString();
                client.ville = dgv.SelectedRows[0].Cells[3].Value.ToString();
                client.cp    = int.Parse(dgv.SelectedRows[0].Cells[4].Value.ToString());
                client.tel   = int.Parse(dgv.SelectedRows[0].Cells[5].Value.ToString());
            }
        }
Esempio n. 5
0
        public int AjouterClient(DAL.Client dal)
        {
            int             res;
            OleDbConnection cn = new OleDbConnection();

            cn = Global.seConnecter(Global.cs);
            object[,] tabPMNames =
            {
                { "@NumClient", dal.NumClient },
                { "@NomClient", dal.NomClient },
                { "@Rue",       dal.Rue       },
                { "@Ville",     dal.Ville     },
                { "@CP",        dal.CP        },
                { "@Tel",       dal.Tel       }
            };
            res = Global.ExecuteroleDbActionNomsParams(@"insert into Client (NumClient,NomClient,Rue,Ville,CP,Tel) values (@NumClient,@NomClient,@Rue,@Ville,@CP,@Tel)", cn, tabPMNames);
            Global.seDeconnecter(cn);
            return(res);
        }
Esempio n. 6
0
        public static int addClient(DAL.Client c)
        {
            int             res;
            OleDbConnection cn = new OleDbConnection();

            cn             = Global.seConnecter(Global.cs);
            Object[,] attr =
            {
                { "@nom",   c.nom   },
                { "@rue",   c.rue   },
                { "@ville", c.ville },
                { "@cp",    c.cp    },
                { "@tel",   c.tel   }
            };
            res = Global.ExecuterOleDBActionNomsParams(@"insert into client (nom, rue, ville, cp, tel) values" +
                                                       " (@nom,@rue,@ville,@cp,@tel)", cn, attr);
            Global.seDeconnecter(cn);


            return(0);
        }
Esempio n. 7
0
        public void getClientbyId(DAL.Client dl, string id)
        {
            id = "'" + id + "'";

            OleDbConnection cn = new OleDbConnection();
            OleDbDataReader lect;

            cn   = BAL.Global.seConnecter(BAL.Global.cs);
            lect = BAL.Global.ExecuterOleDBSelect(@"select * from Client where NumClient=" + id, cn);
            while (lect.Read())
            {
                dl.NumClient = Int32.Parse(lect.GetValue(0).ToString());
                dl.NomClient = lect.GetValue(1).ToString();
                dl.Rue       = lect.GetValue(2).ToString();
                dl.Ville     = lect.GetValue(3).ToString();
                dl.CP        = Int32.Parse(lect.GetValue(4).ToString());
                dl.Tel       = Int32.Parse(lect.GetValue(5).ToString());
            }

            BAL.Global.seDeconnecter(cn);
            lect.Close();
        }
 /// <summary>
 /// Create a new Client object.
 /// </summary>
 /// <param name="id">Initial value of the Id property.</param>
 /// <param name="nom">Initial value of the Nom property.</param>
 /// <param name="prenom">Initial value of the Prenom property.</param>
 /// <param name="adresse">Initial value of the Adresse property.</param>
 /// <param name="ville">Initial value of the Ville property.</param>
 /// <param name="codePostal">Initial value of the CodePostal property.</param>
 /// <param name="telephone">Initial value of the Telephone property.</param>
 /// <param name="mail">Initial value of the Mail property.</param>
 /// <param name="password">Initial value of the Password property.</param>
 /// <param name="roleId">Initial value of the RoleId property.</param>
 /// <param name="dateNaissance">Initial value of the DateNaissance property.</param>
 public static Client CreateClient(global::System.Int32 id, global::System.String nom, global::System.String prenom, global::System.String adresse, global::System.String ville, global::System.String codePostal, global::System.String telephone, global::System.String mail, global::System.String password, global::System.Int32 roleId, global::System.DateTime dateNaissance)
 {
     Client client = new Client();
     client.Id = id;
     client.Nom = nom;
     client.Prenom = prenom;
     client.Adresse = adresse;
     client.Ville = ville;
     client.CodePostal = codePostal;
     client.Telephone = telephone;
     client.Mail = mail;
     client.Password = password;
     client.RoleId = roleId;
     client.DateNaissance = dateNaissance;
     return client;
 }
Esempio n. 9
0
 public static void DeleteClient(SqlConnection connection, Client client)
 {
     using (SqlCommand command = new SqlCommand("DeleteClient", connection))
     {
         command.CommandType = CommandType.StoredProcedure;
         command.Parameters.AddWithValue("@targetId", client.Id);
         command.ExecuteNonQuery();
     }
 }
Esempio n. 10
0
 public static void AddClientToGroup(SqlConnection connection, Group group, Client client)
 {
     using (SqlCommand command = new SqlCommand("AddClientToGroup", connection))
     {
         command.CommandType = CommandType.StoredProcedure;
         command.Parameters.AddWithValue("@groupid", group.Id);
         command.Parameters.AddWithValue("@clientid", client.Id);
         command.ExecuteNonQuery();
     }
 }
Esempio n. 11
0
 public static void CreateNewClient(SqlConnection connection, Client client)
 {
     using (SqlCommand command = new SqlCommand("CreateClient", connection))
     {
         command.CommandType = CommandType.StoredProcedure;
         command.Parameters.AddWithValue("@name", client.Name);
         command.Parameters.AddWithValue("@lastname", client.LastName);
         command.ExecuteNonQuery();
     }
 }
Esempio n. 12
0
 private void ClientList_SelectionChanged(object sender, SelectionChangedEventArgs e)
 {
     if (((ListView)sender).SelectedItem != null)
     {
         selected_client = ((Client)((ListView)sender).SelectedItem);
         SelectedClientLabel.Content = selected_client.ToString();
     }
 }
Esempio n. 13
0
 /// <summary>
 /// Deprecated Method for adding a new object to the Clients EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToClients(Client client)
 {
     base.AddObject("Clients", client);
 }
Esempio n. 14
0
 /// <summary>
 /// Create a new Client object.
 /// </summary>
 /// <param name="id">Initial value of the Id property.</param>
 public static Client CreateClient(global::System.Int32 id)
 {
     Client client = new Client();
     client.Id = id;
     return client;
 }
 /// <summary>
 /// Создание нового объекта Client.
 /// </summary>
 /// <param name="id">Исходное значение свойства Id.</param>
 /// <param name="firstName">Исходное значение свойства FirstName.</param>
 /// <param name="lastName">Исходное значение свойства LastName.</param>
 /// <param name="gender">Исходное значение свойства Gender.</param>
 /// <param name="passportNumber">Исходное значение свойства PassportNumber.</param>
 public static Client CreateClient(global::System.Int32 id, global::System.String firstName, global::System.String lastName, global::System.String gender, global::System.String passportNumber)
 {
     Client client = new Client();
     client.Id = id;
     client.FirstName = firstName;
     client.LastName = lastName;
     client.Gender = gender;
     client.PassportNumber = passportNumber;
     return client;
 }
Esempio n. 16
0
 private void AddButton_Click(object sender, RoutedEventArgs e)
 {
     Client client = new Client(NameTextBox.Text, LastNameTextBox.Text);
     DataAccess.CreateNewClient(connection, client);
     this.Close();
 }