/// <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); }
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); }
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); }
/// <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")); }
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); }
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); }
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); } } }
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); }
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); }
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); }
public List <Client> Tousclient() { List <Client> l = null; try { l = ClientDal.Tousclient(); } catch (Exception e) { throw new Exception(e.Message); } return(l); }
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); }
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); }
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(); } } }
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(); }
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(); } } }
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); } } }
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); }
public static IList <Client> getClients() { return(ClientDal.getClients()); }
public static Client getClient(int cdClient) { return(ClientDal.getClient(cdClient)); }
public static String getPays(int cdClient) { return(ClientDal.getPays(cdClient)); }
public static String getVille(int cdClient) { return(ClientDal.getVille(cdClient)); }
public static String getCodepostal(int cdClient) { return(ClientDal.getCodepostal(cdClient)); }
public static String getAdressePostale(int cdClient) { return(ClientDal.getAdressePostale(cdClient)); }
public static String getRaisonSocial(int cdClient) { return(ClientDal.getRaisonSocial(cdClient)); }
public static int getcdClientmax() { return(ClientDal.getCdClientmax()); }
public static void suppClient(int cdClient) { ClientDal.DeleteClient(cdClient); }
public static void modifClient(int cdClient, String raisonSocial, String adressePostale, String codePostal, String ville, String pays) { ClientDal.UpdateClient(cdClient, raisonSocial, adressePostale, codePostal, ville, pays); }
public static void ajoutClient(String raisonSocial, String adressePostale, String codePostal, String ville, String pays) { ClientDal.InsertClient(raisonSocial, adressePostale, codePostal, ville, pays); }