private void button1_Click(object sender, EventArgs e) { if (textBox1.Text == "" || textBox2.Text == "" || textBox3.Text == "" || textBox4.Text == "") { MessageBox.Show("enter your information!", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } if (textBox3.Text != textBox4.Text) { MessageBox.Show("Check your password!", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } EFcontext EFContext = new EFcontext(); foreach (var item in EFContext.Users) { if (item.Login == textBox1.Text && item.Email == textBox2.Text) { return; } } EFContext.Users.Add(new User { Login = textBox1.Text, Email = textBox2.Text, Password = textBox3.Text }); EFContext.SaveChanges(); this.Close(); }
private void button1_Click(object sender, EventArgs e) { EFcontext eFcontext = new EFcontext(); foreach (var item in eFcontext.Users) { if (item.Login == textBox1.Text && item.Password == textBox2.Text) { MainForm mainForm = new MainForm(this, item); if (checkBox1.Checked == true) { File.WriteAllText("\\pass.txt", item.Login + "\r\n" + item.Password); } else if (File.Exists("\\pass.txt")) { File.Delete("\\pass.txt"); } mainForm.Show(); this.Hide(); break; } } }
public ForgotForm(string login) { InitializeComponent(); context = new EFcontext(); textBox3.Enabled = false; textBox4.Enabled = false; textBox1.Text = login; }
public MainForm(StartForm form, User user) { this.form = form; this.user = user; context = new EFcontext(); ExtraFieldList = new List <ExtraField>(); InitializeComponent(); AddVisibleFalse(); showVisibleFalse(); updateSectionComboBox(); updateServiceComboBox(); toolStripComboBox1.SelectedItem = toolStripComboBox1.Items[0]; UpdateTreeView(); CreateServicetextBox1.Visible = false; }
public ForgotForm() { InitializeComponent(); context = new EFcontext(); textBox3.Enabled = false; textBox4.Enabled = false; if (File.Exists("\\design.txt")) { BackgroundImage = Image.FromFile(@"D:\Password Manager\PasswordManager\Password MAnager\images\1.jpg"); foreach (var item in this.Controls) { if (item is TextBox) { (item as TextBox).BackColor = SystemColors.ActiveCaption; } if (item is ComboBox) { (item as ComboBox).BackColor = SystemColors.ActiveCaption; } } } else { BackgroundImage = Image.FromFile(@"D:\Password Manager\PasswordManager\Password MAnager\images\2.jpg"); foreach (var item in this.Controls) { if (item is TextBox) { (item as TextBox).BackColor = Color.LightGray; } if (item is ComboBox) { (item as ComboBox).BackColor = Color.LightGray; } } } }