bool IntfDalObservationChauffeur.updateObservationChauffeur(crlObservationChauffeur observation) { #region declaration bool isUpdate = false; int nbUpdate = 0; #endregion #region implementation if (observation != null) { this.strCommande = "UPDATE `observationchauffeur` SET `idChauffeur`='" + observation.IdChauffeur + "',"; this.strCommande += "`textObesvation`='" + observation.TextObesvation + "',"; this.strCommande += "`dateObservation`='" + observation.DateObservation.ToString("yyyy-MM-dd") + "',"; this.strCommande += "`isListeNoire`='" + observation.IsListeNoire.ToString("0") + "'"; this.strCommande += " WHERE `numObservation`='" + observation.NumObservation + "'"; this.serviceConnectBase.openConnection(); nbUpdate = this.serviceConnectBase.requete(this.strCommande); if (nbUpdate == 1) { isUpdate = true; } this.serviceConnectBase.closeConnection(); } #endregion return(isUpdate); }
string IntfDalObservationChauffeur.insertObservationChauffeur(crlObservationChauffeur observation, string sigleAgence) { #region declaration string numObservation = ""; IntfDalObservationChauffeur serviceObservationChauffeur = new ImplDalObservationChauffeur(); int nbInsert = 0; #endregion #region implementation if (observation != null && sigleAgence != "") { observation.NumObservation = serviceObservationChauffeur.getNumObservation(sigleAgence); this.strCommande = "INSERT INTO `observationchauffeur` (`numObservation`,`idChauffeur`,`textObesvation`,"; this.strCommande += "`dateObservation`,`isListeNoire`) VALUES ('" + observation.NumObservation + "',"; this.strCommande += "'" + observation.IdChauffeur + "','" + observation.TextObesvation + "',"; this.strCommande += "'" + observation.DateObservation.ToString("yyyy-MM-dd") + "','" + observation.IsListeNoire + "')"; this.serviceConnectBase.openConnection(); nbInsert = this.serviceConnectBase.requete(this.strCommande); if (nbInsert == 1) { numObservation = observation.NumObservation; } this.serviceConnectBase.closeConnection(); } #endregion return(numObservation); }
private void insertToObjObservationChauffeur(crlObservationChauffeur observationChauffeur) { if (observationChauffeur != null) { observationChauffeur.IdChauffeur = hfIdChauffeur.Value; observationChauffeur.TextObesvation = TextObservation.Text; observationChauffeur.IsListeNoire = int.Parse(rbAvertissement.SelectedValue); } }
protected void btnModifier_Click(object sender, EventArgs e) { #region declaration crlObservationChauffeur observationChauffeur = null; crlChauffeur chauffeur = null; string strIndicationText = ""; #endregion #region implementation if (hfObservationChauffeur.Value != "") { observationChauffeur = serviceObservationChauffeur.selectObservationChauffeur(hfObservationChauffeur.Value); if (observationChauffeur != null) { if (hfIdChauffeur.Value != "") { this.insertToObjObservationChauffeur(observationChauffeur); if (serviceObservationChauffeur.updateObservationChauffeur(observationChauffeur)) { this.initialiseGridObservation(); this.initialiseGridListeNoireChauffeur(); this.initialiseFormulaireObs(); chauffeur = serviceChauffeur.selectChauffeur(observationChauffeur.IdChauffeur); strIndicationText = "Observation bien modifier!"; if (chauffeur != null) { strIndicationText += " Chauffeur: " + chauffeur.prenomChauffeur + " " + chauffeur.nomChauffeur; } this.divIndicationText(strIndicationText, "Black"); } else { strIndicationText = "Une erreur ce produit durant la modification!"; this.divIndicationText(strIndicationText, "Red"); } } else { // } } else { // } } else { // } #endregion }
crlObservationChauffeur IntfDalObservationChauffeur.selectObservationChauffeur(string numObservation) { #region declaration crlObservationChauffeur observationChauffeur = null; #endregion #region implementation if (numObservation != "") { this.strCommande = "SELECT * FROM `observationchauffeur` WHERE `numObservation`='" + numObservation + "'"; this.serviceConnectBase.openConnection(); this.reader = this.serviceConnectBase.select(this.strCommande); if (this.reader != null) { if (this.reader.HasRows) { if (this.reader.Read()) { observationChauffeur = new crlObservationChauffeur(); try { observationChauffeur.DateObservation = Convert.ToDateTime(this.reader["dateObservation"].ToString()); } catch (Exception) { } observationChauffeur.IdChauffeur = this.reader["idChauffeur"].ToString(); try { observationChauffeur.IsListeNoire = int.Parse(this.reader["isListeNoire"].ToString()); } catch (Exception) { } observationChauffeur.NumObservation = this.reader["numObservation"].ToString(); observationChauffeur.TextObesvation = this.reader["textObesvation"].ToString(); } } this.reader.Dispose(); } this.serviceConnectBase.closeConnection(); } #endregion return(observationChauffeur); }
private void afficheObservation(string numObservation) { #region declaration crlObservationChauffeur observationChauffeur = null; crlChauffeur chauffeur = null; string strConfirm = ""; #endregion #region implementation if (numObservation != "") { observationChauffeur = serviceObservationChauffeur.selectObservationChauffeur(numObservation); if (observationChauffeur != null) { this.afficheChauffeur(observationChauffeur.IdChauffeur); TextObservation.Text = observationChauffeur.TextObesvation; rbAvertissement.SelectedValue = observationChauffeur.IsListeNoire.ToString(); hfObservationChauffeur.Value = observationChauffeur.NumObservation; chauffeur = serviceChauffeur.selectChauffeur(observationChauffeur.IdChauffeur); btnModifier.Enabled = true; btnValider.Enabled = false; strConfirm = "Voulez vous vraiment modifier l'observation?\n"; if (chauffeur != null) { strConfirm += "Chauffeur: " + chauffeur.prenomChauffeur + " " + chauffeur.nomChauffeur + "\n"; strConfirm += "Date: " + observationChauffeur.DateObservation.ToString("dd MMMM yyyy"); } ConfirmButtonExtender_btnModifier.ConfirmText = strConfirm; } } #endregion }