public void remplirLesChamps(string nuticket) { int intIwant = StringintoInt(nuticket); if (intIwant == 0) { return; } DTtickets = BDD.SelectDT("SELECT * FROM tbl_suiviastea WHERE NTICKET ='" + nuticket + "';", "sogetrel"); // Erreur on avait pris selectedText au lieu de SelectedItem. cbxAffaire.SelectedItem = DTtickets.Rows[0]["AFFAIRE"].ToString(); cbxCateg.SelectedItem = DTtickets.Rows[0]["CATEGORIE"].ToString(); cbxCloture.SelectedItem = DTtickets.Rows[0]["CLOTURE"].ToString(); cbxCriti.SelectedItem = DTtickets.Rows[0]["CRITICITE"].ToString(); cbxFormat.SelectedItem = DTtickets.Rows[0]["FORMATDEMANDE"].ToString(); cbxNiveauR.SelectedItem = DTtickets.Rows[0]["NIVEAUDERESOLUTION"].ToString(); cbxProfil.SelectedItem = DTtickets.Rows[0]["PROFIL"].ToString(); lblTicket.Text = nuticket; txtDescription.Text = DTtickets.Rows[0]["DESCRIPTION"].ToString(); txtEmail.Text = DTtickets.Rows[0]["EMAIL"].ToString(); txtNom.Text = DTtickets.Rows[0]["NOM"].ToString(); txtRefClient.Text = DTtickets.Rows[0]["REFERENCECLIENT"].ToString(); txtTelephone.Text = DTtickets.Rows[0]["TELEPHONE"].ToString(); txtAction.Text = DTtickets.Rows[0]["ACTION"].ToString(); string dateetheurederesolution = DTtickets.Rows[0]["DATEDERESOLUTION"].ToString() + " " + DTtickets.Rows[0]["HEUREDERESOLUTION"].ToString(); if (dateetheurederesolution.Equals(" ") == false) { dtp1.Value = DateTime.ParseExact(dateetheurederesolution, "dd/MM/yyyy HH:mm", CultureInfo.InvariantCulture); lblDate.Visible = true; dtp1.Visible = true; } }
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(); }