bool IntfDalObservationAgent.updateObservationAgent(crlObservationAgent observation) { #region declaration bool isUpdate = false; int nbUpdate = 0; #endregion #region implementation if (observation != null) { this.strCommande = "UPDATE `observationagent` SET `matriculeAgent`='" + observation.MatriculeAgent + "',"; 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 IntfDalObservationAgent.insertObservationAgent(crlObservationAgent observation, string sigleAgence) { #region declaration string numObservation = ""; IntfDalObservationAgent serviceObservationAgent = new ImplDalObservationAgent(); int nbInsert = 0; #endregion #region implementation if (observation != null && sigleAgence != "") { observation.NumObservation = serviceObservationAgent.getNumObservation(sigleAgence); this.strCommande = "INSERT INTO `observationagent` (`numObservation`,`matriculeAgent`,`textObesvation`,"; this.strCommande += "`dateObservation`,`isListeNoire`) VALUES ('" + observation.NumObservation + "',"; this.strCommande += "'" + observation.MatriculeAgent + "','" + 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 insertToObjObservationAgent(crlObservationAgent observation) { if (observation != null) { observation.MatriculeAgent = LabelMatriculeAgent.Text; observation.TextObesvation = TextObservation.Text; observation.IsListeNoire = int.Parse(rbAvertissement.SelectedValue); } }
protected void btnModifier_Click(object sender, EventArgs e) { #region declaration crlObservationAgent observationAgent = null; crlAgent agentObj = null; string strIndicationText = ""; #endregion #region implementation if (hfObservationAgent.Value != "") { observationAgent = serviceObservationAgent.selectObservationAgent(hfObservationAgent.Value); if (observationAgent != null) { if (LabelMatriculeAgent.Text != "") { this.insertToObjObservationAgent(observationAgent); if (serviceObservationAgent.updateObservationAgent(observationAgent)) { this.initialiseGridObservation(); this.initialiseGridAgentListeNoire(); this.initialiseFormulaireObs(); agentObj = serviceAgent.selectAgent(observationAgent.MatriculeAgent); strIndicationText = "Observation bien modifier!"; if (agentObj != null) { strIndicationText += " Agent: " + agentObj.prenomAgent + " " + agentObj.nomAgent; } this.divIndicationText(strIndicationText, "Black"); } else { strIndicationText = "Une erreur ce produit durant la modification!"; this.divIndicationText(strIndicationText, "Red"); } } else { // } } else { // } } else { // } #endregion }
crlObservationAgent IntfDalObservationAgent.selectObservationAgent(string numObservation) { #region declaration crlObservationAgent observationChauffeur = null; #endregion #region implementation if (numObservation != "") { this.strCommande = "SELECT * FROM `observationagent` 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 crlObservationAgent(); try { observationChauffeur.DateObservation = Convert.ToDateTime(this.reader["dateObservation"].ToString()); } catch (Exception) { } observationChauffeur.MatriculeAgent = this.reader["matriculeAgent"].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); }
protected void btnValider_Click(object sender, EventArgs e) { #region declaration crlObservationAgent observation = null; crlAgent agentObj = null; string strIndicationText = ""; #endregion #region implementation observation = new crlObservationAgent(); this.insertToObjObservationAgent(observation); if (LabelMatriculeAgent.Text != "") { observation.NumObservation = serviceObservationAgent.insertObservationAgent(observation, this.agent.agence.SigleAgence); if (observation.NumObservation != "") { this.initialiseGridObservation(); this.initialiseGridAgentListeNoire(); this.initialiseFormulaireObs(); agentObj = serviceAgent.selectAgent(observation.MatriculeAgent); strIndicationText = "Observation bien enregistrer!"; if (agentObj != null) { strIndicationText += " Agent: " + agentObj.prenomAgent + " " + agentObj.nomAgent; } this.divIndicationText(strIndicationText, "Black"); } else { strIndicationText = "Une erreur ce produit durant l'enregistrement!"; this.divIndicationText(strIndicationText, "Red"); } } else { // } #endregion }
private void afficheObservation(string numObservation) { #region declaration crlObservationAgent observationAgent = null; crlAgent agent = null; string strConfirm = ""; #endregion #region implementation if (numObservation != "") { observationAgent = serviceObservationAgent.selectObservationAgent(numObservation); if (observationAgent != null) { this.afficheAgent(observationAgent.MatriculeAgent); TextObservation.Text = observationAgent.TextObesvation; rbAvertissement.SelectedValue = observationAgent.IsListeNoire.ToString(); hfObservationAgent.Value = observationAgent.NumObservation; agent = serviceAgent.selectAgent(observationAgent.MatriculeAgent); btnModifier.Enabled = true; btnValider.Enabled = false; strConfirm = "Voulez vous vraiment modifier l'observation?\n"; if (agent != null) { strConfirm += "Chauffeur: " + agent.prenomAgent + " " + agent.nomAgent + "\n"; strConfirm += "Date: " + observationAgent.DateObservation.ToString("dd MMMM yyyy"); } ConfirmButtonExtender_btnModifier.ConfirmText = strConfirm; } } #endregion }