Esempio n. 1
0
        // create account button:
        private void button1_Click(object sender, EventArgs e)
        {
            string username     = maskedTextBox1.Text;
            string password     = maskedTextBox2.Text;
            string email        = maskedTextBox3.Text;
            string first_name   = maskedTextBox6.Text;
            string last_name    = maskedTextBox5.Text;
            string phone_number = maskedTextBox4.Text;

            MD.User usr = new MD.User(username, password, first_name, last_name, email, phone_number);
            MD.User.users.Add(usr);

            // add new user to file:
            using (System.IO.StreamWriter file = new System.IO.StreamWriter("users.txt", true))
            {
                string line = "\n" + username + "," + password + "," + first_name + "," + last_name + "," + email + "," + phone_number;
                file.WriteLine(line);
            }

            maskedTextBox1.Clear();
            maskedTextBox2.Clear();
            maskedTextBox3.Clear();
            maskedTextBox6.Clear();
            maskedTextBox5.Clear();
            maskedTextBox4.Clear();
        }
Esempio n. 2
0
        // initialize/load users:
        public Login()
        {
            InitializeComponent();

            // load users:
            string[] lines = File.ReadAllLines("users.txt");
            foreach (string line in lines)
            {
                string[] col = line.Split(new char[] { ',' });
                MD.User  usr = new MD.User(col[0], col[1], col[2], col[3], col[4], col[5]);
                MD.User.users.Add(usr);
            }
        }