public Member GetUser(string UserId, string Password) { Member AuthenticatedUser; AuthenticatedUser = new Member(); Boolean Success = false; SqlConnection StudentConnection; StudentConnection = new SqlConnection(); StudentConnection.ConnectionString = "Data Source= (localDB)\\v11.0;Initial Catalog=GolfClubBaist;Integrated Security = True"; SqlCommand StudentCommand; StudentCommand = new SqlCommand(); StudentCommand.CommandType = CommandType.StoredProcedure; StudentCommand.Connection = StudentConnection; StudentCommand.CommandText = "GetUser"; SqlParameter programcode; programcode = new SqlParameter(); programcode.ParameterName = "@UserId"; programcode.SqlDbType = SqlDbType.VarChar; programcode.Value = UserId; programcode.Direction = ParameterDirection.Input; StudentCommand.Parameters.Add(programcode); StudentConnection.Open(); StudentCommand.ExecuteNonQuery(); SqlDataReader BAIS3150Reader; BAIS3150Reader = StudentCommand.ExecuteReader(); while (BAIS3150Reader.Read()) { AuthenticatedUser.Password = BAIS3150Reader["Password"].ToString(); } StudentConnection.Close(); if (AuthenticatedUser.Password == Password) { Members CurrentMember; CurrentMember = new Members(); AuthenticatedUser = CurrentMember.FindMember(UserId); AuthenticatedUser.IsValid = true; } else { AuthenticatedUser.IsValid = false; } return(AuthenticatedUser); }
// Getting tee time for update and cancel public List <string> teetimesUpdate(string date) { //List<Reserveteetimes> Availableteetime = new List<Reserveteetimes>(); Reserveteetimes bookedtimes = new Reserveteetimes(); SqlConnection StudentConnection; StudentConnection = new SqlConnection(); StudentConnection.ConnectionString = "Data Source= (localDB)\\v11.0;Initial Catalog=GolfClubBAIST;Integrated Security = True"; SqlCommand StudentCommand; StudentCommand = new SqlCommand(); StudentCommand.CommandType = CommandType.StoredProcedure; StudentCommand.Connection = StudentConnection; StudentCommand.CommandText = "GetTeeTime"; SqlParameter programcode; programcode = new SqlParameter(); programcode.ParameterName = "@Date"; programcode.SqlDbType = SqlDbType.VarChar; programcode.Value = Convert.ToDateTime(date); programcode.Direction = ParameterDirection.Input; StudentCommand.Parameters.Add(programcode); StudentConnection.Open(); SqlDataReader BAIS3150Reader; BAIS3150Reader = StudentCommand.ExecuteReader(); string Tee; while (BAIS3150Reader.Read()) { //Reserveteetimes Availableteetime; //Availableteetime = new Reserveteetimes(); Tee = (string)BAIS3150Reader["Time"]; bookedtimes.Availableteetime.Add(Tee); } StudentConnection.Close(); return(bookedtimes.Availableteetime); }
public Member MemberInformation(string MemberNo) { Member CurrentMember; CurrentMember = new Member(); SqlConnection StudentConnection; StudentConnection = new SqlConnection(); StudentConnection.ConnectionString = "Data Source= (localDB)\\v11.0;Initial Catalog=GolfClubBAIST;Integrated Security = True"; SqlCommand StudentCommand; StudentCommand = new SqlCommand(); StudentCommand.CommandType = CommandType.StoredProcedure; StudentCommand.Connection = StudentConnection; StudentCommand.CommandText = "FindMemberName"; SqlParameter studentid; studentid = new SqlParameter(); studentid.ParameterName = "@MemberNo"; studentid.SqlDbType = SqlDbType.VarChar; studentid.Value = MemberNo; studentid.Direction = ParameterDirection.Input; StudentCommand.Parameters.Add(studentid); StudentConnection.Open(); SqlDataReader BAIS3150Reader; BAIS3150Reader = StudentCommand.ExecuteReader(); while (BAIS3150Reader.Read()) { CurrentMember.MemberName = (string)BAIS3150Reader["MemberName"]; CurrentMember.Phone = (string)BAIS3150Reader["Phone"]; CurrentMember.Role = (string)BAIS3150Reader["Role"]; } StudentConnection.Close(); return(CurrentMember); }
public Member FindMember(string UserID) { Member CurrentMember; CurrentMember = new Member(); SqlConnection StudentConnection; StudentConnection = new SqlConnection(); StudentConnection.ConnectionString = "Data Source= (localDB)\\v11.0;Initial Catalog=GolfClubBAIST;Integrated Security = True"; SqlCommand StudentCommand; StudentCommand = new SqlCommand(); StudentCommand.CommandType = CommandType.StoredProcedure; StudentCommand.Connection = StudentConnection; StudentCommand.CommandText = "FindMember"; SqlParameter membernumber; membernumber = new SqlParameter(); membernumber.ParameterName = "@UserID"; membernumber.SqlDbType = SqlDbType.VarChar; membernumber.Value = UserID; membernumber.Direction = ParameterDirection.Input; StudentCommand.Parameters.Add(membernumber); StudentConnection.Open(); SqlDataReader BAIS3150Reader; BAIS3150Reader = StudentCommand.ExecuteReader(); while (BAIS3150Reader.Read()) { CurrentMember.MemberNumber = (string)BAIS3150Reader["MemberNumber"]; CurrentMember.MemberName = (string)BAIS3150Reader["MemberName"]; CurrentMember.Phone = (string)BAIS3150Reader["Phone"]; CurrentMember.Role = (string)BAIS3150Reader["Role"]; } return(CurrentMember); }
// Getting all information of the time reserved by the golf member public Reserveteetimes Getteetime(Reserveteetimes Reserve) { Reserveteetimes Teetimeinfo; Teetimeinfo = new Reserveteetimes(); SqlConnection StudentConnection; StudentConnection = new SqlConnection(); StudentConnection.ConnectionString = "Data Source= (localDB)\\v11.0;Initial Catalog=GolfClubBAIST;Integrated Security = True"; SqlCommand StudentCommand; StudentCommand = new SqlCommand(); StudentCommand.CommandType = CommandType.StoredProcedure; StudentCommand.Connection = StudentConnection; StudentCommand.CommandText = "GetTeeTimeInfo"; SqlParameter studentid; studentid = new SqlParameter(); studentid.ParameterName = "@MemberNumber"; studentid.SqlDbType = SqlDbType.VarChar; studentid.Value = Reserve.MemberNo; studentid.Direction = ParameterDirection.Input; StudentCommand.Parameters.Add(studentid); SqlParameter date; date = new SqlParameter(); date.ParameterName = "@Date"; date.SqlDbType = SqlDbType.VarChar; date.Value = Reserve.date; date.Direction = ParameterDirection.Input; StudentCommand.Parameters.Add(date); SqlParameter time; time = new SqlParameter(); time.ParameterName = "@Time"; time.SqlDbType = SqlDbType.VarChar; time.Value = Reserve.time1; time.Direction = ParameterDirection.Input; StudentCommand.Parameters.Add(time); StudentConnection.Open(); SqlDataReader BAIS3150Reader; BAIS3150Reader = StudentCommand.ExecuteReader(); while (BAIS3150Reader.Read()) { Teetimeinfo.MemberNo = (string)BAIS3150Reader["MemberNumber"]; Teetimeinfo.NoofCarts = (int)BAIS3150Reader["NoofCarts"]; Teetimeinfo.Player1 = (string)BAIS3150Reader["Player1"]; Teetimeinfo.Player2 = (string)BAIS3150Reader["Player2"]; Teetimeinfo.Player3 = (string)BAIS3150Reader["Player3"]; Teetimeinfo.time1 = (string)BAIS3150Reader["Time"]; Teetimeinfo.date = Convert.ToDateTime(BAIS3150Reader["Date"]).ToString("yyyy/MM/dd"); } StudentConnection.Close(); return(Teetimeinfo); }