public static bool IsEqual(EmpModel user1, EmpModel user2) { if (user1 == null || user2 == null) { return(false); } if (user1.Username != user2.Username) { error = "Username does not exist!"; return(false); } else if (user1.Password != user2.Password) { error = "Username and Password does not match!"; return(false); } return(true); }
private void RegEmpbtn_Click_1(object sender, EventArgs e) { string ps = passwordTboxR.Text; #region Condition if ( string.IsNullOrWhiteSpace(fullnameTbox.Text) && string.IsNullOrWhiteSpace(emailTbox.Text) && string.IsNullOrWhiteSpace(usernameTboxR.Text) && string.IsNullOrWhiteSpace(passwordTboxR.Text) && string.IsNullOrWhiteSpace(confirmpasswordTboxR.Text) && string.IsNullOrWhiteSpace(genderCbox.Text) && string.IsNullOrWhiteSpace(phoneTbox.Text) && string.IsNullOrWhiteSpace(addressTbox.Text) ) { MessageBox.Show("Please Fill All The Fields"); //return; } #endregion else if (!Validationfunctions.isemail(emailTbox.Text)) { MessageBox.Show("Enter the email in correct pattern...!"); } else if (isuserexist(usernameTboxR.Text)) { MessageBox.Show("Username already taken..!"); } else if (usernameTboxR.Text.Length < 8) { MessageBox.Show("Username must contain minimum 8 charaters....!"); } else if (ps.Length < 5) { MessageBox.Show("Password must contain minimum 5 charaters....!"); } else if (passwordTboxR.Text != confirmpasswordTboxR.Text) { MessageBox.Show("Password Doesnt Match!"); } else { EmpModel emp = new EmpModel() { Fullname = fullnameTbox.Text, Email = emailTbox.Text, Username = usernameTboxR.Text, Password = passwordTboxR.Text, Gender = genderCbox.Text, PhoneNo = phoneTbox.Text, Address = addressTbox.Text, }; var setter = client.Set("employee/" + usernameTboxR.Text + "/", emp); MessageBox.Show("Thank You, " + fullnameTbox.Text + "\nYour Registration Is Successfull,\nYou Can Login Now...!"); EmpRegPanel.BringToFront(); fullnameTbox.Text = ""; emailTbox.Text = ""; usernameTboxR.Text = ""; passwordTboxR.Text = ""; confirmpasswordTboxR.Text = ""; genderCbox.SelectedIndex = -1; phoneTbox.Text = ""; addressTbox.Text = ""; } }