private void btnlogin_Click(object sender, EventArgs e) { if (txtuser.Text != "" && txtpass.Text != "") { var usercheck = db.Randoms.Where(c => c.ID == 1).FirstOrDefault(); var passcheck = db.Randoms.Where(c => c.ID == 2).FirstOrDefault(); if (usercheck != null) { if (txtuser.Text == ClsTripleDES.LicDecrypt(usercheck.Text) && txtpass.Text == ClsTripleDES.LicDecrypt(passcheck.Text)) { this.Hide(); FormDashboard dsh = new FormDashboard(); dsh.Show(); } else { MessageBox.Show("Invalid Credientials!", "License Management", MessageBoxButtons.OK, MessageBoxIcon.Error); } } } else { MessageBox.Show("Enter your Credientials!", "License Management", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void btnValidate_Click(object sender, EventArgs e) { var MasPas = db.Randoms.Where(c => c.ID == 3).FirstOrDefault(); string fdec = ClsTripleDES.LicDecrypt(MasPas.Text.ToString()); string Dec = ClsTripleDES.DataDecrypt(fdec); if (txtpass.Text == Dec) { btnValidate.DialogResult = DialogResult.OK; labelresult.Text = "Validated!"; labelresult.ForeColor = Color.Green; labelresult.Visible = true; } else { btnValidate.DialogResult = DialogResult.Cancel; labelresult.Text = "Not Validated!"; labelresult.ForeColor = Color.Red; labelresult.Visible = true; } }