public static string NumeroProchainTicket() { DataTable DTDernierTicket = BDD.SelectDT("SELECT NTICKET FROM tbl_suiviastea ORDER BY NTICKET DESC LIMIT 1", "sogetrel"); if (DTDernierTicket.Rows.Count > 0) { string dernierticket = DTDernierTicket.Rows[0][0].ToString(); if (dernierticket.Substring(3, 8).Contains(DateTime.Now.ToString("yyyyMMdd"))) { int Numero = int.Parse(dernierticket.Substring(11, 2)); // error if the string is too short must place an extra zer on the thingy Numero++; string NumeroToString = Numero.ToString("D2"); // fixed with ToString("00") OR "D2" return("CNM" + DateTime.Now.ToString("yyyyMMdd") + NumeroToString); } else { return("CNM" + DateTime.Now.ToString("yyyyMMdd") + "00"); } } else { return("CNM" + DateTime.Now.ToString("yyyyMMdd") + "00"); } }
public void ListViewRafraichir() { DataTable table = null; string query = "SELECT * FROM `tbl_suiviastea` ORDER BY NTICKET DESC"; table = BDD.SelectDT(query, "sogetrel"); maListView.Items.Clear(); foreach (DataRow dr in table.Rows) { ListViewItem lvi = new ListViewItem(); lvi.Text = dr["NTICKET"].ToString(); string[] Mesdonnes = { dr["EMAIL_PRISE_EN_COMPTE"].ToString(), dr["EMAIL_TRANSFER"].ToString(), dr["EMAIL_CLOTURE"].ToString(), dr["HOTLINER"].ToString(), dr["DATECREATION"].ToString() + " " + dr["HEUREDECREATION"].ToString(), dr["FORMATDEMANDE"].ToString(), dr["NOM"].ToString(), dr["TELEPHONE"].ToString() }; lvi.SubItems.AddRange(Mesdonnes); maListView.Items.Add(lvi); } }
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; } }