示例#1
0
        /// <summary>
        /// Método para obtener  un Cliente
        /// </summary>
        /// <param name="id">Identificado del Cliente </param>
        /// <returns>Cliente</returns>
        public static Client Get(Guid id)
        {
            OperationsLogs.WriteLogsDebug("ClienteBrl", "Insertar", string.Format("{0} Info: {1}",
                                                                                  DateTime.Now.ToString(),
                                                                                  "Empezando a ejecutar el método lógica de negocio para obtener un Cliente"));
            Client Cliente = null;

            try
            {
                Cliente = ClientDal.Obtener(id);
            }
            catch (SqlException ex)
            {
                OperationsLogs.WriteLogsRelease("ClienteBrl", "obtener", string.Format("{0} Error: {1}",
                                                                                       DateTime.Now.ToString(), ex.Message));
                throw ex;
            }
            catch (Exception ex)
            {
                OperationsLogs.WriteLogsRelease("ClienteBrl", "obtener", string.Format("{0} Error: {1}",
                                                                                       DateTime.Now.ToString(), ex.Message));
                throw ex;
            }

            OperationsLogs.WriteLogsDebug("ClienteBrl", "obtener", string.Format("{0} Info: {1}",
                                                                                 DateTime.Now.ToString(),
                                                                                 "Termino de ejecutar  el método lógica de negocio para obtener Cliente"));

            return(Cliente);
        }
示例#2
0
        public List <ClientDal> GetAll()
        {
            List <ClientDal> lb = new List <ClientDal>();

            using (SqlConnection con = new SqlConnection())
            {
                con.ConnectionString = connectionString;
                using (SqlCommand command = con.CreateCommand())
                {
                    command.CommandText = "Select * from Client";
                    con.Open();
                    using (SqlDataReader dataReader = command.ExecuteReader())
                    {
                        while (dataReader.Read())
                        {
                            ClientDal b = new ClientDal();
                            b.clientLogin         = (string)dataReader["clientLogin"];
                            b.clientId            = (int)dataReader["clientId"];
                            b.clientNom           = (string)dataReader["clientNom"];
                            b.clientDateNaissance = (DateTime)dataReader["clientDateNaissance"];
                            b.clientPrenom        = (string)dataReader["clientPrenom"];
                            lb.Add(b);
                        }
                    }
                }
            }
            return(lb);
        }
示例#3
0
        public List <ClientDal> GetAll()
        {
            List <ClientDal> la = new List <ClientDal>();

            using (SqlConnection con = new SqlConnection())
            {
                con.ConnectionString = connectionString;
                using (SqlCommand command = con.CreateCommand())
                {
                    command.CommandText = "select clientId,clientNom,clientPrenom,clientLogin,clientDateNaissance from Client";
                    con.Open();
                    using (SqlDataReader read = command.ExecuteReader())
                    {
                        while (read.Read())
                        {
                            ClientDal a = new ClientDal();
                            a.clientId     = (int)read["clientId"];
                            a.clientNom    = (string)read["clientNom"];
                            a.clientPrenom = (string)read["clientPrenom"];
                            a.clientLogin  = (string)read["clientLogin"];
                            //a.clientPwd = (string)read["biereImage"];
                            a.clienDateNaissance = (DateTime)read["clientDateNaissance"];
                            la.Add(a);
                        }
                    }
                }
            }
            return(la);
        }
示例#4
0
        /// <summary>
        /// Método lógica de negocio para crear un Cliente en la lógica de negocio
        /// </summary>
        /// <param name="Cliente"></param>
        public static void Update(Client cliente)
        {
            OperationsLogs.WriteLogsDebug("ClienteBrl", "Actualizar", string.Format("{0} Info: {1}",
                                                                                    DateTime.Now.ToString(),
                                                                                    "Empezando a ejecutar el método lógica de negocio para Actualizar un Cliente"));

            try
            {
                ClientDal.Actualizar(cliente);
            }
            catch (SqlException ex)
            {
                OperationsLogs.WriteLogsRelease("ClienteBrl", "Actualizar", string.Format("{0} Error: {1}",
                                                                                          DateTime.Now.ToString(), ex.Message));
                throw ex;
            }
            catch (Exception ex)
            {
                OperationsLogs.WriteLogsRelease("ClienteBrl", "Actualizar", string.Format("{0} Error: {1}",
                                                                                          DateTime.Now.ToString(), ex.Message));
                throw ex;
            }

            OperationsLogs.WriteLogsDebug("ClienteBrl", "Actualizar", string.Format("{0} Info: {1}",
                                                                                    DateTime.Now.ToString(),
                                                                                    "Termino de ejecutar  el método lógica de negocio para Actualizar Cliente"));
        }
示例#5
0
        public ClientDal GetOne(int id)
        {
            ClientDal a = new ClientDal();

            using (SqlConnection con = new SqlConnection())
            {
                con.ConnectionString = connectionString;
                using (SqlCommand command = con.CreateCommand())
                {
                    command.CommandText = "select clientId,clientNom,clientPrenom,clientLogin,clientDateNaissance from Client where clientId=@id";
                    command.Parameters.AddWithValue("id", id);
                    con.Open();
                    using (SqlDataReader read = command.ExecuteReader())
                    {
                        while (read.Read())
                        {
                            a.clientId     = (int)read["clientId"];
                            a.clientNom    = (string)read["clientNom"];
                            a.clientPrenom = (string)read["clientPrenom"];
                            a.clientLogin  = (string)read["clientLogin"];
                            //a.clientPwd = (string)read["biereImage"];
                            a.clienDateNaissance = (DateTime)read["clientDateNaissance"];
                        }
                    }
                }
            }
            return(a);
        }
示例#6
0
        public ClientDal GetOne(int id)
        {
            ClientDal b = new ClientDal();

            using (SqlConnection con = new SqlConnection())
            {
                con.ConnectionString = connectionString;
                using (SqlCommand command = con.CreateCommand())
                {
                    command.CommandText = "Select * from Client where clientId=@id";
                    command.Parameters.AddWithValue("id", id);
                    con.Open();
                    using (SqlDataReader dataReader = command.ExecuteReader())
                    {
                        while (dataReader.Read())
                        {
                            b.clientLogin         = (string)dataReader["clientLogin"];
                            b.clientId            = (int)dataReader["clientId"];
                            b.clientNom           = (string)dataReader["clientNom"];
                            b.clientDateNaissance = (DateTime)dataReader["clientDateNaissance"];
                            b.clientPrenom        = (string)dataReader["clientPrenom"];
                            // b.clientPwd = (string)dataReader["clientpwd"];
                            //lb.Add(b);
                        }
                    }
                }
            }
            return(b);
        }
示例#7
0
 public int Create(ClientDal parametre)
 {
     using (SqlConnection con = new SqlConnection())
     {
         con.ConnectionString = connectionString;
         using (SqlCommand command = con.CreateCommand())
         {
             command.CommandText = "AddClientBis";
             SqlParameter pid = new SqlParameter();
             pid.ParameterName   = "ID";
             pid.Value           = 0;
             pid.Direction       = System.Data.ParameterDirection.Output;
             command.CommandType = System.Data.CommandType.StoredProcedure;
             command.Parameters.AddWithValue(nameof(parametre.clientDateNaissance), parametre.clientDateNaissance);
             command.Parameters.AddWithValue(nameof(parametre.clientLogin), parametre.clientLogin);
             command.Parameters.AddWithValue(nameof(parametre.clientNom), parametre.clientNom);
             command.Parameters.AddWithValue(nameof(parametre.clientPrenom), parametre.clientPrenom);
             command.Parameters.AddWithValue(nameof(parametre.clientPwd).ToLower(), parametre.clientPwd);
             command.Parameters.Add(pid);
             con.Open();
             command.ExecuteNonQuery();
             int id = (int)command.Parameters["ID"].Value;
             return(id);
         }
     }
 }
示例#8
0
        public static ClientWPF GetClientWPF(this ClientDal dal)
        {
            ClientWPF wpf = new ClientWPF();

            wpf.clientDateNaissance = dal.clientDateNaissance;
            wpf.clientId            = dal.clientId;
            wpf.clientLogin         = dal.clientLogin;
            wpf.clientNom           = dal.clientNom;
            wpf.clientPrenom        = dal.clientPrenom;
            return(wpf);
        }
示例#9
0
        public static ClientDal GetClientDal(this ClientAPI clientAPI)
        {
            ClientDal clientDal = new ClientDal();

            clientDal.clienDateNaissance = clientAPI.clienDateNaissance;
            clientDal.clientId           = clientAPI.clientId;
            clientDal.clientLogin        = clientAPI.clientLogin;
            clientDal.clientNom          = clientAPI.clientNom;
            clientDal.clientPrenom       = clientAPI.clientPrenom;
            clientDal.clientPwd          = clientAPI.clientPwd;
            return(clientDal);
        }
示例#10
0
        public static ClientDal GetClientDal(this ClientWPF wpf)
        {
            ClientDal dal = new ClientDal();

            dal.clientDateNaissance = wpf.clientDateNaissance;
            dal.clientId            = wpf.clientId;
            dal.clientLogin         = wpf.clientLogin;
            dal.clientNom           = wpf.clientNom;
            dal.clientPrenom        = wpf.clientPrenom;
            dal.clientPwd           = wpf.clientPwd;
            return(dal);
        }
示例#11
0
        public List <Client> Tousclient()
        {
            List <Client> l = null;

            try {
                l = ClientDal.Tousclient();
            }
            catch (Exception e) {
                throw new Exception(e.Message);
            }


            return(l);
        }
示例#12
0
        public int Modifier(string id, string nom, string pre, string sexe, string adresse, string tel, string cin, string email)
        {
            int resultat = 0;

            try
            {
                Client cl = new Client(id, nom, pre, sexe, adresse, tel, cin, email);
                resultat = ClientDal.Modifier(cl);
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
            return(resultat);
        }
示例#13
0
        public int EnregistrerrClient(string id, string nom, string pre, string sexe, string adresse, string tel, string cin, string email)
        {
            int    resultat = 0;
            Client c1       = null;

            try
            {
                c1       = new Client(id, nom, pre, sexe, adresse, tel, cin, email);
                resultat = ClientDal.insererclient(c1);
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
            return(resultat);
        }
示例#14
0
 public void Update(ClientDal parametre)
 {
     using (SqlConnection con = new SqlConnection())
     {
         con.ConnectionString = connectionString;
         using (SqlCommand command = con.CreateCommand())
         {
             command.CommandText = "EditClient";
             command.CommandType = System.Data.CommandType.StoredProcedure;
             command.Parameters.AddWithValue(nameof(parametre.clientLogin), parametre.clientLogin);
             command.Parameters.AddWithValue(nameof(parametre.clientId), parametre.clientId);
             command.Parameters.AddWithValue(nameof(parametre.clientPwd), parametre.clientPwd);
             con.Open();
             command.ExecuteNonQuery();
         }
     }
 }
示例#15
0
        public ActionResult Ajouter(Client client)
        {
            using (var dal = new ClientDal())
            {
                if (dal.Existe(client.Nom, client.Prenom))
                {
                    ViewBag.MessageErreur = "Ce client existe déjà";
                    ModelState.AddModelError("Client", "Ce client existe déjà");
                }
                if (!ModelState.IsValid)
                {
                    return(View(client));
                }

                dal.Add(client.Nom, client.Prenom, client.Email);

                return(RedirectToAction("Index"));
            }
        }
    protected void Page_Load(object sender, EventArgs e)
    {
        string    id  = Request.QueryString["selectclientid"];
        ClientDal dal = new ClientDal();
        DataSet   ds  = dal.SelectById(id);
        DataTable dt  = ds.Tables[0];

        Class.Text    = dt.Rows[0][1].ToString();
        Serial.Text   = dt.Rows[0][2].ToString();
        Client.Text   = dt.Rows[0][3].ToString();
        Tel.Text      = dt.Rows[0][4].ToString();
        Tel2.Text     = dt.Rows[0][5].ToString();
        Country.Text  = dt.Rows[0][6].ToString();
        Province.Text = dt.Rows[0][7].ToString();
        City.Text     = dt.Rows[0][8].ToString();
        Addr.Text     = dt.Rows[0][9].ToString();
        Email.Text    = dt.Rows[0][10].ToString();
        UserName.Text = dt.Rows[0][11].ToString();
        Passwd.Text   = dt.Rows[0][12].ToString();
    }
示例#17
0
 public void Create(ClientDal parametre)
 {
     using (SqlConnection con = new SqlConnection())
     {
         con.ConnectionString = connectionString;
         using (SqlCommand command = con.CreateCommand())
         {
             command.CommandText = "AddClient";
             command.CommandType = System.Data.CommandType.StoredProcedure;
             // DateTime test = parametre.clienDateNaissance;
             command.Parameters.AddWithValue("clientDateNaissance", parametre.clienDateNaissance);
             command.Parameters.AddWithValue(nameof(parametre.clientLogin), parametre.clientLogin);
             command.Parameters.AddWithValue(nameof(parametre.clientNom), parametre.clientNom);
             command.Parameters.AddWithValue(nameof(parametre.clientPrenom), parametre.clientPrenom);
             command.Parameters.AddWithValue(nameof(parametre.clientPwd).ToLower(), parametre.clientPwd);
             con.Open();
             command.ExecuteNonQuery();
         }
     }
 }
示例#18
0
        public LoginState CheckLogin(string phone, string pwd)//登录判断
        {
            ClientDal dal    = new ClientDal();
            Client    client = dal.SelectClientInfo(phone);

            if (client == null)
            {
                return(LoginState.NoName);
            }
            else
            {
                if (client.Pwd != pwd)
                {
                    return(LoginState.PwdErr);
                }
                else
                {
                    return(LoginState.OK);
                }
            }
        }
示例#19
0
        public bool Rechercherclient(string code)
        {
            bool trouver = false;

            Ef = new Client();
            Ef = ClientDal.rechercherclient(code);

            try
            {
                if (Ef.getnumclient() != null)
                {
                    trouver = true;
                }
                else
                {
                    trouver = false;
                }
            }
            catch
            {
                trouver = false;
            }
            return(trouver);
        }
示例#20
0
 public static IList <Client> getClients()
 {
     return(ClientDal.getClients());
 }
示例#21
0
 public static Client getClient(int cdClient)
 {
     return(ClientDal.getClient(cdClient));
 }
示例#22
0
 public static String getPays(int cdClient)
 {
     return(ClientDal.getPays(cdClient));
 }
示例#23
0
 public static String getVille(int cdClient)
 {
     return(ClientDal.getVille(cdClient));
 }
示例#24
0
 public static String getCodepostal(int cdClient)
 {
     return(ClientDal.getCodepostal(cdClient));
 }
示例#25
0
 public static String getAdressePostale(int cdClient)
 {
     return(ClientDal.getAdressePostale(cdClient));
 }
示例#26
0
 public static String getRaisonSocial(int cdClient)
 {
     return(ClientDal.getRaisonSocial(cdClient));
 }
示例#27
0
 public static int getcdClientmax()
 {
     return(ClientDal.getCdClientmax());
 }
示例#28
0
 public static void suppClient(int cdClient)
 {
     ClientDal.DeleteClient(cdClient);
 }
示例#29
0
 public static void modifClient(int cdClient, String raisonSocial, String adressePostale, String codePostal, String ville, String pays)
 {
     ClientDal.UpdateClient(cdClient, raisonSocial, adressePostale, codePostal, ville, pays);
 }
示例#30
0
 public static void ajoutClient(String raisonSocial, String adressePostale, String codePostal, String ville, String pays)
 {
     ClientDal.InsertClient(raisonSocial, adressePostale, codePostal, ville, pays);
 }