protected void gvClient_RowCommand(object sender, GridViewCommandEventArgs e) { #region declaration crlClient client = null; string strIndication = ""; #endregion #region implementation if (e.CommandName.Equals("select")) { this.afficheClient(e.CommandArgument.ToString()); } else if (e.CommandName.Equals("deleteV")) { client = serviceClient.selectClient(e.CommandArgument.ToString()); if (client != null) { if (serviceClient.deleteClient(client)) { this.initialiseGridClient(); strIndication = "Client " + client.PrenomClient + " " + client.NomClient + " supprimer!"; this.divIndicationText(strIndication, "Black"); } else { strIndication = "Impossible de supprimer le client " + client.PrenomClient + " " + client.NomClient; this.divIndicationText(strIndication, "Red"); } } } #endregion }
protected void btnModifier_Click(object sender, EventArgs e) { #region declaration crlClient client = null; string strIndication = ""; #endregion #region implementation if (hfNumClient.Value != "") { client = serviceClient.selectClient(hfNumClient.Value); if (client != null) { this.insertToObjetClient(client); if (serviceClient.updateClient(client)) { this.afficheClient(client.NumClient); this.initialiseGridClient(); strIndication = "Modification du client " + client.PrenomClient + " " + client.NomClient + " <br/>"; strIndication += "bien enregistrer!"; this.divIndicationText(strIndication, "Black"); } else { strIndication = "Une erreur ce produit durant la modification!"; this.divIndicationText(strIndication, "Red"); } } } #endregion }
bool IntfDalClient.deleteClient(crlClient Client) { #region declaration bool isDelete = false; int nombreDelete = 0; #endregion #region implementation if (Client != null) { if (Client.NumClient != "") { this.strCommande = "DELETE FROM `client` WHERE (`numClient` = '" + Client.NumClient + "')"; this.serviceConnectBase.openConnection(); nombreDelete = this.serviceConnectBase.requete(this.strCommande); if (nombreDelete == 1) { isDelete = true; } this.serviceConnectBase.closeConnection(); } } #endregion return(isDelete); }
private void insertToObjetClient(crlClient client) { #region implementation if (client != null) { client.NomClient = TextNomClient.Text; client.PrenomClient = TextPrenom.Text; client.CinClient = TextCIN.Text; client.AdresseClient = TextAdresse.Text; client.TelephoneClient = TextTelephone.Text; client.MobileClient = TextMobile.Text; if (cbBonDeCommande.Checked) { client.IsBonCommande = 1; } else { client.IsBonCommande = 0; } if (cbCheque.Checked) { client.IsCheque = 1; } else { client.IsCheque = 0; } } #endregion }
string IntfDalClient.insertClient(crlClient Client, string sigleAgence) { #region declaration IntfDalClient serviceClient = new ImplDalClient(); int nombreInsertion = 0; string numClient = ""; #endregion #region implementation if (Client != null) { Client.NumClient = serviceClient.getNumClient(sigleAgence); this.strCommande = "INSERT INTO `client` (`numClient`,`nomClient`"; this.strCommande += ",`prenomClient`,`adresseClient`,`cinClient`,`telephoneClient`,`mobileClient`"; this.strCommande += ",`isCheque`,`isBonCommande`)"; this.strCommande += " VALUES ('" + Client.NumClient + "','" + Client.NomClient + "'"; this.strCommande += ",'" + Client.PrenomClient + "','" + Client.AdresseClient + "'"; this.strCommande += ",'" + Client.CinClient + "','" + Client.TelephoneClient + "','" + Client.MobileClient + "'"; this.strCommande += ",'" + Client.IsCheque + "','" + Client.IsBonCommande + "')"; this.serviceConnectBase.openConnection(); nombreInsertion = this.serviceConnectBase.requete(this.strCommande); if (nombreInsertion == 1) { numClient = Client.NumClient; } this.serviceConnectBase.closeConnection(); } #endregion return(numClient); }
bool IntfDalClient.updateClient(crlClient Client) { #region declaration bool isUpdate = false; int nombreUpdate = 0; #endregion #region implementation if (Client != null) { if (Client.NumClient != "") { this.strCommande = "UPDATE `client` SET `nomClient`='" + Client.NomClient + "', `prenomClient`='" + Client.PrenomClient + "', "; this.strCommande += "`adresseClient`='" + Client.AdresseClient + "', `cinClient`='" + Client.CinClient + "', `telephoneClient`='" + Client.TelephoneClient + "', "; this.strCommande += " `mobileClient`='" + Client.MobileClient + "', `isCheque`='" + Client.IsCheque + "', `isBonCommande`='" + Client.IsBonCommande + "'"; this.strCommande += " WHERE (`numClient`='" + Client.NumClient + "')"; this.serviceConnectBase.openConnection(); nombreUpdate = this.serviceConnectBase.requete(this.strCommande); if (nombreUpdate == 1) { isUpdate = true; } this.serviceConnectBase.closeConnection(); } } #endregion return(isUpdate); }
private void afficheClient(string numClient) { #region declaration crlClient client = null; string confirmText = ""; #endregion #region implementation if (numClient != "") { client = serviceClient.selectClient(numClient); if (client != null) { TextNomClient.Text = client.NomClient; TextPrenom.Text = client.PrenomClient; TextCIN.Text = client.CinClient; TextAdresse.Text = client.AdresseClient; TextTelephone.Text = client.TelephoneClient; TextMobile.Text = client.MobileClient; if (client.IsBonCommande > 0) { cbBonDeCommande.Checked = true; } else { cbBonDeCommande.Checked = false; } if (client.IsCheque > 0) { cbCheque.Checked = true; } else { cbCheque.Checked = false; } this.initialiseCB(); hfNumClient.Value = client.NumClient; confirmText = "Voulez vous vraiment modifier le client \n" + client.PrenomClient + " " + client.NomClient + "?"; ConfirmButtonExtender_btnModifier.ConfirmText = confirmText; btnValide.Enabled = false; btnModifier.Enabled = true; } } #endregion }
crlClient IntfDalClient.selectClient(string numClient) { #region declaration crlClient Client = null; #endregion #region implementation if (numClient != "") { this.strCommande = "SELECT * FROM `client` WHERE (`numClient` = '" + numClient + "')"; this.serviceConnectBase.openConnection(); reader = this.serviceConnectBase.select(this.strCommande); if (reader != null) { if (reader.HasRows) { Client = new crlClient(); reader.Read(); Client.NumClient = reader["numClient"].ToString(); Client.NomClient = reader["nomClient"].ToString(); Client.PrenomClient = reader["prenomClient"].ToString(); Client.CinClient = reader["cinClient"].ToString(); Client.AdresseClient = reader["adresseClient"].ToString(); Client.TelephoneClient = reader["telephoneClient"].ToString(); Client.MobileClient = reader["mobileClient"].ToString(); try { Client.IsCheque = int.Parse(reader["isCheque"].ToString()); } catch (Exception) { } try { Client.IsBonCommande = int.Parse(reader["isBonCommande"].ToString()); } catch (Exception) { } } reader.Dispose(); } this.serviceConnectBase.closeConnection(); } #endregion return(Client); }
int IntfDalClient.isClientInt(crlClient Client) { #region declaration int isClient = 0; #endregion #region implementation if (Client != null) { if (Client.CinClient != "") { this.strCommande = "SELECT * FROM `client` WHERE (`cinClient`='" + Client.CinClient + "' AND"; this.strCommande += " `nomClient`='" + Client.NomClient + "' AND `prenomClient`='" + Client.PrenomClient + "' AND"; this.strCommande += " `numClient` <> '" + Client.NumClient + "')"; } else { this.strCommande = "SELECT * FROM `client` WHERE ("; this.strCommande += " `nomClient`='" + Client.NomClient + "' AND `prenomClient`='" + Client.PrenomClient + "' AND"; this.strCommande += " `numClient` <> '" + Client.NumClient + "')"; } this.serviceConnectBase.openConnection(); reader = this.serviceConnectBase.select(this.strCommande); if (reader != null) { if (reader.HasRows) { if (reader.Read()) { isClient = 1; } } reader.Dispose(); } this.serviceConnectBase.closeConnection(); } #endregion return(isClient); }
public crlCommissionDevis() { this.IdCommissionDevis = ""; this.Destination = ""; this.FraisEnvoi = 0; this.PieceJustificatif = ""; this.Poids = 0; this.Nombre = 0; this.NumDesignation = ""; this.NumTrajet = ""; this.TypeCommission = ""; this.NumProforma = ""; this.NumExpediteur = ""; this.NumRecepteur = ""; this.trajet = null; this.typeCommssionObjet = null; this.designationCommission = null; this.expediteur = null; this.recepteur = null; }
protected void btnValide_Click(object sender, EventArgs e) { #region declaration crlClient client = null; string strIndication = ""; #endregion #region implementation client = new crlClient(); this.insertToObjetClient(client); client.NumClient = serviceClient.isClient(client); if (client.NumClient == "") { client.NumClient = serviceClient.insertClient(client, agent.agence.SigleAgence); if (client.NumClient != "") { this.afficheClient(client.NumClient); this.initialiseGridClient(); strIndication = "Client " + client.PrenomClient + " " + client.NomClient + "<br/> "; strIndication += "bien enregistrer!"; this.divIndicationText(strIndication, "Black"); } else { strIndication = "Une erreur ce produit durant l'enregistrement!"; this.divIndicationText(strIndication, "Red"); } } else { this.afficheClient(client.NumClient); } #endregion }
DataTable IntfDalBonDeCommande.getDataTableBonDeCommandeNonPaieDateDF(string strRqst) { #region declaration DataTable dataTable = new DataTable(); crlOrganisme organisme = null; crlSociete societe = null; crlClient client = null; IntfDalGeneral serviceGeneral = new ImplDalGeneral(); IntfDalSociete serviceSociete = new ImplDalSociete(); IntfDalOrganisme serviceOrganisme = new ImplDalOrganisme(); IntfDalClient serviceClient = new ImplDalClient(); #endregion #region implementation #region initialisation du dataTable dataTable = new DataTable(); dataTable.Columns.Add("numBonDeCommande", typeof(string)); dataTable.Columns.Add("datePaiement", typeof(DateTime)); dataTable.Columns.Add("montant", typeof(string)); dataTable.Columns.Add("client", typeof(string)); dataTable.Columns.Add("adresse", typeof(string)); dataTable.Columns.Add("contact", typeof(string)); dataTable.Columns.Add("respSociete", typeof(string)); dataTable.Columns.Add("respContact", typeof(string)); DataRow dr; #endregion this.serviceConnectBase.openConnection(); this.reader = this.serviceConnectBase.select(strRqst); if (this.reader != null) { if (this.reader.HasRows) { while (this.reader.Read()) { dr = dataTable.NewRow(); dr["numBonDeCommande"] = reader["numBonDeCommande"].ToString(); dr["datePaiement"] = Convert.ToDateTime(this.reader["datePaiementBC"].ToString()); dr["montant"] = serviceGeneral.separateurDesMilles(this.reader["montantBC"].ToString()) + "Ar"; if (reader["numClient"].ToString() != "") { client = serviceClient.selectClient(reader["numClient"].ToString()); } if (reader["numOrganisme"].ToString() != "") { organisme = serviceOrganisme.selectOrganisme(reader["numOrganisme"].ToString()); } if (reader["numSociete"].ToString() != "") { societe = serviceSociete.selectSociete(reader["numSociete"].ToString()); } if (client != null) { dr["client"] = client.PrenomClient + " " + client.NomClient; dr["adresse"] = client.AdresseClient; dr["contact"] = client.TelephoneClient + " / " + client.MobileClient; dr["respSociete"] = "-"; dr["respContact"] = "-"; } else if (societe != null) { dr["client"] = societe.NomSociete; dr["adresse"] = societe.AdresseSociete; dr["contact"] = societe.TelephoneFixeSociete + " / " + societe.TelephoneMobileSociete; if (societe.individuResponsable != null) { dr["respSociete"] = societe.individuResponsable.PrenomIndividu + " " + societe.individuResponsable.NomIndividu; dr["respContact"] = societe.individuResponsable.TelephoneFixeIndividu + " / " + societe.individuResponsable.TelephoneMobileIndividu; } } else if (organisme != null) { dr["client"] = organisme.NomOrganisme; dr["adresse"] = organisme.AdresseOrganisme; dr["contact"] = organisme.TelephoneFixeOrganisme + " / " + organisme.TelephoneMobileOrganisme; if (organisme.individuResponsable != null) { dr["respSociete"] = organisme.individuResponsable.PrenomIndividu + " " + organisme.individuResponsable.NomIndividu; dr["respContact"] = organisme.individuResponsable.TelephoneFixeIndividu + " / " + organisme.individuResponsable.TelephoneMobileIndividu; } } client = null; societe = null; organisme = null; dataTable.Rows.Add(dr); } } this.reader.Dispose(); } this.serviceConnectBase.closeConnection(); #endregion return(dataTable); }