private void materialRaisedButton1_Click(object sender, EventArgs e) { var login = textBox3.Text; var password = textBox4.Text; var cpassword = textBox5.Text; var name = textBox6.Text; var surname = textBox7.Text; var phone_number = textBox8.Text; var address = textBox9.Text; var card_number = textBox10.Text; SenderContext sc = new SenderContext(); Client cl = new Client(); cl.Login = login; cl.Password = password; sc.Clients.Add(cl); sc.SaveChanges(); Sender snd = new Sender(); snd.Cl = cl; snd.Name = name; snd.PhoneNumber = phone_number; snd.Surname = surname; snd.Address = address; snd.CardNumber = card_number; snd.Id = cl.Id; sc.Senders.Add(snd); sc.SaveChanges(); }
private void materialRaisedButton7_Click(object sender, EventArgs e) { MailContext PostOffice = new MailContext(); SenderContext sx = new SenderContext(); //Text = textBox5.Text; //anyone.Snd = sx.Senders.ToList()[user_id - 1]; anyone.SenderId = user_id; label3.Text = user_id.ToString(); PostOffice.Mails.Add(anyone); PostOffice.SaveChanges(); //Random runt = new Random(); //label3.Text = runt.Next().ToString(); materialTabControl1.SelectedIndex = 1; }
private void materialRaisedButton8_Click(object sender, EventArgs e) { string Login = textBox2.Text; string Password = textBox1.Text; SenderContext sc = new SenderContext(); var user = sc.Clients.FirstOrDefault(p => p.Login == Login); if (user != null) { if (user.Password == Password) { Form1 form = new Form1(user.Id); form.Show(); this.Hide(); } } //{ // Form1 f1 = new Form1(this, true); // this.Visible = false; // f1.ShowDialog(); // this.Close(); //} //else if (comboBox1.Text == "Пользователь") //{ // Form1 f1 = new Form1(this, false); // this.Visible = false; // f1.ShowDialog(); // this.Close(); //} //else MessageBox.Show("Неверный пароль или имя пользователя! Попробуйте заново!"); //Form1 form = new Form1(); // form.Show(); // this.Hide(); }