private void Edit_Profile_Load(object sender, EventArgs e) { loginUserdata l = new loginUserdata(); DataTable dt = l.userdata(userid); if (dt.Rows.Count > 0) { txtFname.Text = dt.Rows[0]["First_Name"].ToString(); txtSurname.Text = dt.Rows[0]["Surname"].ToString(); txtAddress.Text = dt.Rows[0]["Address"].ToString(); txtPhone.Text = dt.Rows[0]["Phone"].ToString(); Datetimepicker_dob.Value = Convert.ToDateTime(dt.Rows[0]["Dob"]); if (dt.Rows[0]["Gender"].ToString() == "Male") { radioMale.Checked = true; } else if (dt.Rows[0]["Gender"].ToString() == "Female") { radioFemale.Checked = true; } else if (dt.Rows[0]["Gender"].ToString() == "Others") { radioOthers.Checked = true; } } }
private void btn_confirm_Click(object sender, EventArgs e) { loginUserdata l = new loginUserdata(); DataTable dt = l.userdata(userid); if (dt.Rows[0]["Password"].ToString() == txtCurrentpw.Text) { if (txtNewpw.Text == txtConfirmpw.Text) { DialogResult result1 = MessageBox.Show("Are you sure you want to Change password?", "The Question", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1); if (result1 == DialogResult.Yes) { try { string qry = "Update tbl_User set Password ='******' where ID =" + userid; DatabaseCon dbcon = new DatabaseCon(); dbcon.Query = qry; dbcon.ExecuteQuery(); MessageBox.Show("Password changed sucessfully.", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information); this.Close(); Profile p = new Profile(userid); p.Show(); } catch (Exception ex) { MessageBox.Show(ex.ToString()); } } else { //nothing } } else { MessageBox.Show("Password and Confirm Password doesn't match."); } } else { MessageBox.Show("Incorrect Current Password."); } }
private void btnLogin_Click(object sender, EventArgs e) { string Email = txtEmail.Text; string Password = txtPassword.Text; loginUserdata l = new loginUserdata(); DataTable dt = l.login(Email, Password); if (dt.Rows.Count > 0) { int user_id = int.Parse(dt.Rows[0][0].ToString()); Home h = new Home(user_id); this.Hide(); h.Show(); } else { MessageBox.Show("Invalid Email or Password. Try again."); } }
private void Profile_Load(object sender, EventArgs e) { loginUserdata l = new loginUserdata(); DataTable dt = l.userdata(userid); Name = dt.Rows[0]["First_Name"].ToString(); Label lbl_head = new Label(); lbl_head.AutoSize = true; lbl_head.Font = new System.Drawing.Font("Monotype Corsiva", 36F, ((System.Drawing.FontStyle) ((System.Drawing.FontStyle.Bold | System.Drawing.FontStyle.Italic))), System.Drawing.GraphicsUnit.Point, ((byte)(0))); lbl_head.Location = new System.Drawing.Point(197, 21); lbl_head.Name = "label10"; lbl_head.Size = new System.Drawing.Size(414, 72); lbl_head.TabIndex = 98; lbl_head.Text = "Hello, " + Name; this.Controls.Add(lbl_head); int y = 108; for (int i = 1; i < 8; i++) { Label lbl_i = new Label(); lbl_i.AutoSize = true; lbl_i.Font = new System.Drawing.Font("Segoe Print", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); lbl_i.Location = new System.Drawing.Point(350, y); lbl_i.Size = new System.Drawing.Size(76, 35); lbl_i.TabIndex = 101; if (i == 1) { lbl_i.Text = dt.Rows[0]["First_Name"].ToString(); } else if (i == 2) { lbl_i.Text = dt.Rows[0]["Surname"].ToString(); } else if (i == 3) { lbl_i.Text = dt.Rows[0]["Gender"].ToString(); } else if (i == 4) { lbl_i.Text = dt.Rows[0]["Dob"].ToString(); } else if (i == 5) { lbl_i.Text = dt.Rows[0]["Address"].ToString(); } else if (i == 6) { lbl_i.Text = dt.Rows[0]["Email"].ToString(); } else if (i == 7) { lbl_i.Text = dt.Rows[0]["Phone"].ToString(); } this.Controls.Add(lbl_i); y = y + 45; } this.ActiveControl = btn_back; }