1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72
|
string passc;
if (tb1.Text != "")
{
if (tb2.Text != "" && tb3.Text != "" && tb2.Text == tb3.Text)
{
if (!File.Exists("users.xml"))
{
XmlTextWriter xw = new XmlTextWriter("users.xml", Encoding.UTF8);
xw.Formatting = Formatting.Indented;
xw.WriteStartDocument(true);
xw.WriteStartElement("users");
xw.WriteStartElement("personne");
xw.WriteElementString("nom", tb1.Text.ToString());
xw.WriteElementString("pass", tb2.Text.ToString());
xw.WriteEndElement();
xw.WriteEndElement();
xw.WriteEndDocument();
xw.Flush();
xw.Close();
}
else
{
DataSet ds = new DataSet();
ds.Clear();
ds.ReadXml("users.xml");
DataRow dr = ds.Tables[0].NewRow();
//if (tb1.Text == "" || tb2.Text == "")
//MessageBox.Show("Erreur in password","Warning",MessageBoxButtons.OK,MessageBoxIcon.Error);
ds.Tables[0].Rows.Add(tb1.Text,tb2.Text)
ds.WriteXml("users.xml");
}
this.Hide();
///////,,,,,ici ton traitement
}
else
{
if (tb2.Text == "" && tb3.Text == "")
MessageBox.Show("Erreur Password is empty", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Stop);
else
MessageBox.Show("Erreur in password", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
}
}
else
{
if (tb2.Text != tb3.Text)
MessageBox.Show("Username is empty && Error in password","Warning",MessageBoxButtons.OK,MessageBoxIcon.Stop);
else
{
if (tb2.Text == "" && tb3.Text == "")
{
MessageBox.Show("Username && Password is empty", "Warning", MessageBoxButtons.OK,MessageBoxIcon.Warning);
}
else
{
MessageBox.Show("Username is empty", "Warning", MessageBoxButtons.OK,MessageBoxIcon.Information);
}
}
} |
Partager