public void updateTicket() { // Check if Resolu ou non. string heureResolution; string dateResolution; string delaisResolution; if (cbxCloture.Text.Contains("Oui")) { string dateetheuredecreation = DTtickets.Rows[0]["DATECREATION"].ToString() + " " + DTtickets.Rows[0]["HEUREDECREATION"].ToString(); heureResolution = dtp1.Value.ToString("HH:mm"); dateResolution = dtp1.Value.ToString("dd/MM/yyyy"); DateTime fin = dtp1.Value; DateTime Debut = DateTime.ParseExact(dateetheuredecreation, "dd/MM/yyyy HH:mm", CultureInfo.InvariantCulture); int heures = Convert.ToInt32(fin.Subtract(Debut).TotalMinutes) / 60; delaisResolution = heures.ToString() + ":" + (fin.Subtract(Debut).TotalMinutes - (heures * 60)).ToString(); } else { heureResolution = " "; dateResolution = " "; delaisResolution = " "; } string query = "UPDATE tbl_suiviastea SET FORMATDEMANDE='" + cbxFormat.Text + "',NOM='" + txtNom.Text.Replace("'", "''") + "',TELEPHONE='" + txtTelephone.Text.Replace("'", "''") + "',EMAIL='" + txtEmail.Text.Replace("'", "''") + "',REFERENCECLIENT='" + txtRefClient.Text.Replace("'", "''") + "',PROFIL='" + cbxProfil.Text + "',AFFAIRE='" + cbxAffaire.Text + "',CATEGORIE='" + cbxCateg.Text + "',CRITICITE='" + cbxCriti.Text + "',DESCRIPTION='" + txtDescription.Text.Replace("'", "''") + "',NIVEAUDERESOLUTION='" + cbxNiveauR.Text + "',ACTION='" + txtAction.Text.Replace("'", "''") + "',DATEDERESOLUTION='" + dateResolution + "',HEUREDERESOLUTION='" + heureResolution + "',DELAISDERESOLUTION='" + delaisResolution + "',CLOTURE='" + cbxCloture.Text + "'"; query += " WHERE NTICKET = '" + nuticket + "'"; BDD.InsertOrUpdate(query, "sogetrel"); monsuiviastea.ListViewRafraichir(); this.Dispose(); }
public void InsertintoSQL() { string numeroticket = NumeroProchainTicket(); int week = ((DateTime.Now.DayOfYear / 7) + 1); // Check if Resolu ou non. string heureResolution; string dateResolution; string delaisResolution; if (cbxCloture.Text.Contains("Oui")) { heureResolution = DateTime.Now.ToString("HH:mm"); dateResolution = DateTime.Now.ToString("dd/MM/yyyy"); delaisResolution = "00:10"; } else { heureResolution = " "; dateResolution = " "; delaisResolution = " "; } string query = "INSERT INTO tbl_suiviastea (NTICKET,HOTLINER,DATECREATION,HEUREDECREATION,SEMAINE,MOIS,ANNEE,FORMATDEMANDE,NOM,TELEPHONE,EMAIL,REFERENCECLIENT,PROFIL,AFFAIRE,CATEGORIE,CRITICITE,DESCRIPTION,CLOTURE,NIVEAUDERESOLUTION,ACTION,DATEDERESOLUTION,HEUREDERESOLUTION,DELAISDERESOLUTION)"; query += " VALUES ('" + numeroticket + "','hotliner1', '" + DateTime.Now.ToString("dd/MM/yyyy") + "','" + DateTime.Now.AddMinutes(-10).ToString("HH:mm") + "','" + week.ToString() + "',"; query += "'" + DateTime.Now.Month.ToString() + "','" + DateTime.Now.Year.ToString() + "','" + cbxFormat.Text + "','" + txtNom.Text.Replace("'", "''") + "','" + txtTelephone.Text.Replace("'", "''") + "','" + txtEmail.Text.Replace("'", "''") + "','" + txtRefClient.Text.Replace("'", "''") + "','" + cbxProfil.Text + "','" + cbxAffaire.Text; query += "','" + cbxCateg.Text + "','" + cbxCriti.Text + "','" + txtDescription.Text.Replace("'", "''") + "','" + cbxCloture.Text + "','" + cbxNiveauR.Text; query += "','" + txtAction.Text.Replace("'", "''"); query += "','" + dtp1.Value.Date.ToString("dd/MM/yyyy"); query += "','" + dtp1.Value.ToString("HH:mm"); query += "','" + delaisResolution + "')"; BDD.InsertOrUpdate(query, "sogetrel"); monsuiviastea.ListViewRafraichir(); }