-
Notifications
You must be signed in to change notification settings - Fork 0
/
ForgotPassword.cs
100 lines (75 loc) · 2.98 KB
/
ForgotPassword.cs
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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using MetroFramework.Forms;
using System.Data.SqlClient;
namespace CommunityServiceManagement
{
public partial class ForgotPassword : MetroForm
{
string name;Login l1;Home h;
private DataAccess Da { get; set; }
private DataSet Ds { get; set; }
public ForgotPassword(Login l1,Home h)
{
InitializeComponent();
this.Da = new DataAccess();
this.h = h;
this.l1 = l1;
}
private void ForgotPassword_Load(object sender, EventArgs e)
{
this.pnlForgotPassword1.Visible = true;
this.pnlForgotPassword2.Visible = false;
}
private void BtnVerifyForgotPassword_Click(object sender, EventArgs e)
{
string sql = @"select name from citizenregistration where nid='" + this.txtboxNidForgotPassword.Text.ToString() + "';";
this.Ds = this.Da.ExecuteQuery(sql);
name = this.Ds.Tables[0].Rows[0]["name"].ToString();
string name1 = this.txtboxNameForgotPassword2.Text.ToString();
if (name==name1)
{
MessageBox.Show("Matched");
string sql1 = @"update login set nid = '" + this.txtboxNidForgotPassword.Text + "',password = '" + this.txtboxPaswordForgotPassword.Text + "',category = 'citizen' where nid='" + this.txtboxNidForgotPassword.Text + "';";
this.Da.ExecuteUpdateQuery(sql1);
MessageBox.Show("Reset Done");
this.txtboxNameForgotPassword2.Text = "";
}
else
{
MessageBox.Show("Not matched");
}
}
private void BtnResetForgotPassword_Click(object sender, EventArgs e)
{
string nid = this.txtboxNidForgotPassword.Text;string password = this.txtboxPaswordForgotPassword.Text;
string cpassword = this.txtboxConfirmPasswordForgotPassword.Text;
if (nid == "" || password == "" || cpassword == "")
{
MessageBox.Show("You Must Fill Up");
}
else if (this.txtboxPaswordForgotPassword.Text.ToString() == this.txtboxConfirmPasswordForgotPassword.Text.ToString())
{
this.pnlForgotPassword2.Visible = true;
this.pnlForgotPassword1.Visible = false;
}
else
{
MessageBox.Show("Password Not Matched");
}
}
private void BtnLoginForgotPassword_Click(object sender, EventArgs e)
{
//Login l1 = new Login(this, h);
this.l1.Visible = true;
this.Visible = false;
}
}
}