public bool EditVoter(VoterProperties vp) { DBClass dbc = new DBClass(); bool isEditSuccess = dbc.EditVoterProperties(vp); return(isEditSuccess); }
public bool EditVoterProperties(VoterProperties vbc) { using (SqlConnection con = new SqlConnection(conStr)) { SqlCommand command = new SqlCommand("spEditVoter", con); command.CommandType = CommandType.StoredProcedure; command.Parameters.AddWithValue("Id", vbc.VoterId); command.Parameters.AddWithValue("@FullName", vbc.FullName); command.Parameters.AddWithValue("@PhoneNumber", vbc.PhoneNumber.ToString()); command.Parameters.AddWithValue("@Email", vbc.Email.ToString()); command.Parameters.AddWithValue("Gender", vbc.Gender); command.Parameters.AddWithValue("@DateOfBirth", vbc.DateOfBirth); command.Parameters.AddWithValue("@Password", vbc.Password); command.Parameters.AddWithValue("@UserName", vbc.FullName); con.Open(); int k = command.ExecuteNonQuery(); con.Close(); } return(true); }
public void Register(VoterProperties vp) { DBClass dbc = new DBClass(); vp.FullName = vp.FullName.ToUpper(); vp.Email = vp.Email.ToLower(); vp.Gender = vp.Gender.ToUpper(); vp.DateOfBirth = vp.DateOfBirth; //encrypt password vp.Password = vp.Password; //send that data to dbclass dbc.AddData(vp); }