private void checkVerificationCode() { DB_contextDataContext db = new DB_contextDataContext(); UserLoginData logindataTable = db.UserLoginDatas.SingleOrDefault(x => x.username == this.LoggedUName); UserAddr userAddresTab = db.UserAddrs.SingleOrDefault(x => x.userID == this.LoggedUName); UserDtail userDetailsTable = db.UserDtails.SingleOrDefault(x => x.userID == this.LoggedUName); BloodData userBloodTable = db.BloodDatas.SingleOrDefault(x => x.userID == this.LoggedUName); if (logindataTable != null && userAddresTab != null && userDetailsTable != null && userBloodTable != null) { if (logindataTable.verfication == code) { logindataTable.confirmVerification = this.txtConfirm.Text; userAddresTab.accountstatus = "activated"; userDetailsTable.accountstatus = "activated"; userBloodTable.accountstatus = "activated"; db.SubmitChanges(); this.userLoginForm.isChecked = true; this.lableStatus.Text = "Account Activating....."; Thread.Sleep(4000); userHomePage userForm = new userHomePage(); userForm.showLoggedUser(LoggedUName); this.Hide(); userForm.Show(); } else { this.lableStatus.Text = "Invalid Code"; this.txtConfirm.Clear(); } } }
private void insertUserDetailsTable() { if (this.userAddressTable != null && this.userBloodTable != null && this.userLoginTable != null) { try { this.userDetailTable = new UserDtail(); this.userDetailTable.addressID = this.userAddressTable.addID; this.userDetailTable.userID = this.txtboxUserName.Text; this.userDetailTable.bloodID = this.userBloodTable.bloodID; this.userDetailTable.bloodGroup = this.userBloodTable.bloodGroup; this.userDetailTable.URoll = this.userLoginTable.userroll; this.userDetailTable.accountstatus = "pending"; if (this.filePath != null) { this.userDetailTable.propicture = this.filePath; } else { this.userDetailTable.propicture = null; } db.UserDtails.InsertOnSubmit(this.userDetailTable); db.SubmitChanges(); }catch (SqlException ex) { MessageBox.Show("UserDetailsTable Is Not Created"); } } }
private bool updateUserData() { UserDtail userData = db.UserDtails.SingleOrDefault(x => x.userID == this.uName); if (userData != null) { //userData.userID = this.txtUserName.Text; if (this.isbtnBrowseClicked) { try { userData.propicture = this.txtBrowseFile.Text; db.SubmitChanges(); } catch (System.Data.SqlClient.SqlException exp) { MessageBox.Show("Invalid File Name"); } } return(true); } else { return(false); } }
private void deleteUserDetails() { UserDtail userDetailTable = db.UserDtails.SingleOrDefault(x => x.userID == this.uName); if (userDetailTable != null) { db.UserDtails.DeleteOnSubmit(userDetailTable); //db.SubmitChanges(); } }
private void setFromDataBase() { DB_contextDataContext db = new DB_contextDataContext(); UserDtail userDetailTable = new UserDtail(); this.userAddressTable = db.UserAddrs.SingleOrDefault(x => x.userID == this.uName); this.userBloodDataTable = db.BloodDatas.SingleOrDefault(x => x.userID == this.uName); userDetailTable = db.UserDtails.SingleOrDefault(x => x.userID == this.uName); if (this.userAddressTable != null && this.userBloodDataTable != null && userDetailTable != null) { this.txtFirstName.Text = this.userAddressTable.firstName; this.txtLastName.Text = this.userAddressTable.lastName; this.txtUserName.Text = this.userAddressTable.userID; this.txtPhone.Text = this.userAddressTable.mobileNo; this.txtEmail.Text = this.userAddressTable.email; this.txtDistrict.Text = this.userAddressTable.district; this.txtSubdistrict.Text = this.userAddressTable.subDistrict; this.txtPostal.Text = this.userAddressTable.postalCode; this.LableBlood.Text = this.userBloodDataTable.bloodGroup; try { this.userPP.Image = Image.FromFile(userDetailTable.propicture); } catch (ArgumentNullException exp) { this.userPP.Image = Image.FromFile(@"F:\Programming\C#\C# Project Updated\BloodBankManagement\BloodBankManagement\images\default.jpg"); } //this.userPP.SizeMode = PictureBoxSizeMode.StretchImage; this.userPP.SizeMode = PictureBoxSizeMode.Zoom; } else { this.lableValidation.Text = "Problem To Load Database"; //MessageBox.Show("Problem To Load Database"); } }