public List <DailyTeeTimeSheet> GetDailyTeeTimeSheet(List <DailyTeeTimeSheet> InitialDailyTeeTimeSheet, string Date) { SqlConnection SampleConnection = new SqlConnection(); SampleConnection.ConnectionString = connectionString; SampleConnection.Open(); SqlCommand SampleCommand = new SqlCommand(); SampleCommand.Connection = SampleConnection; SampleCommand.CommandType = CommandType.StoredProcedure; SampleCommand.CommandText = "GetDailyTeeSheet"; SqlParameter SampleCommandParameter = new SqlParameter { ParameterName = "@Date", SqlDbType = SqlDbType.VarChar, Direction = ParameterDirection.Input, SqlValue = Date }; SampleCommand.Parameters.Add(SampleCommandParameter); SqlDataReader SampleDataReader; SampleDataReader = SampleCommand.ExecuteReader(); if (SampleDataReader.HasRows) { while (SampleDataReader.Read()) { DailyTeeTimeSheet BookedTeeTime = new DailyTeeTimeSheet(); BookedTeeTime.Date = SampleDataReader["Date"].ToString(); BookedTeeTime.Teetime = SampleDataReader["Teetime"].ToString(); BookedTeeTime.Phone = SampleDataReader["Phone"].ToString(); BookedTeeTime.NumberOfCarts = int.Parse(SampleDataReader["NumberOfCarts"].ToString()); BookedTeeTime.Time = decimal.Parse(SampleDataReader["Time"].ToString()); BookedTeeTime.MemberName = SampleDataReader["MemberName"].ToString(); for (int i = 0; i < InitialDailyTeeTimeSheet.Count; i++) { if (BookedTeeTime.Teetime == InitialDailyTeeTimeSheet[i].Teetime) { InitialDailyTeeTimeSheet[i].Date = BookedTeeTime.Date; InitialDailyTeeTimeSheet[i].Phone = BookedTeeTime.Phone; InitialDailyTeeTimeSheet[i].NumberOfCarts = BookedTeeTime.NumberOfCarts; InitialDailyTeeTimeSheet[i].Time = BookedTeeTime.Time; InitialDailyTeeTimeSheet[i].MemberName = InitialDailyTeeTimeSheet[i].MemberName + BookedTeeTime.MemberName + ','; InitialDailyTeeTimeSheet[i].NumberOfPlayer++; } } } } SampleDataReader.Close(); SampleConnection.Close(); return(InitialDailyTeeTimeSheet); }
public List <TeeTime> GetAvailableTeeTimeList(List <TeeTime> AvailableTeeTimeList, string Date) { SqlConnection SampleConnection = new SqlConnection(); SampleConnection.ConnectionString = connectionString; SampleConnection.Open(); SqlCommand SampleCommand = new SqlCommand(); SampleCommand.Connection = SampleConnection; SampleCommand.CommandType = CommandType.StoredProcedure; SampleCommand.CommandText = "GetTeeTime"; SqlParameter SampleCommandParameter = new SqlParameter { ParameterName = "@Date", SqlDbType = SqlDbType.VarChar, Direction = ParameterDirection.Input, SqlValue = Date }; SampleCommand.Parameters.Add(SampleCommandParameter); SqlDataReader SampleDataReader; SampleDataReader = SampleCommand.ExecuteReader(); if (SampleDataReader.HasRows) { while (SampleDataReader.Read()) { TeeTime BookedTeeTime = new TeeTime(); BookedTeeTime.Date = SampleDataReader["Date"].ToString(); BookedTeeTime.Teetime = SampleDataReader["Teetime"].ToString(); for (int i = 0; i < AvailableTeeTimeList.Count; i++) { if (AvailableTeeTimeList[i].Teetime == BookedTeeTime.Teetime) { AvailableTeeTimeList.Remove(AvailableTeeTimeList[i]); } } } } SampleDataReader.Close(); SampleConnection.Close(); return(AvailableTeeTimeList); }
public bool IsShareholdHadRequest(string MemberNumber, string StartDate) { bool result = false; SqlConnection SampleConnection = new SqlConnection(); SampleConnection.ConnectionString = connectionString; SampleConnection.Open(); SqlCommand SampleCommand = new SqlCommand(); SampleCommand.Connection = SampleConnection; SampleCommand.CommandType = CommandType.StoredProcedure; SampleCommand.CommandText = "IsShareholdHadRequest"; SqlParameter SampleCommandParameter = new SqlParameter { ParameterName = "@MemberNumber", SqlDbType = SqlDbType.VarChar, Direction = ParameterDirection.Input, SqlValue = MemberNumber }; SampleCommand.Parameters.Add(SampleCommandParameter); SqlParameter SampleCommandParameter2 = new SqlParameter { ParameterName = "@StartDate", SqlDbType = SqlDbType.VarChar, Direction = ParameterDirection.Input, SqlValue = StartDate }; SampleCommand.Parameters.Add(SampleCommandParameter2); SqlDataReader SampleDataReader; SampleDataReader = SampleCommand.ExecuteReader(); if (SampleDataReader.HasRows) { result = true; } SampleDataReader.Close(); SampleConnection.Close(); return(result); }
public string GetBookerMembershipCode(string MemberNumber) { string MembershipCode = "00"; SqlConnection SampleConnection = new SqlConnection(); SampleConnection.ConnectionString = connectionString; SampleConnection.Open(); SqlCommand SampleCommand = new SqlCommand(); SampleCommand.Connection = SampleConnection; SampleCommand.CommandType = CommandType.StoredProcedure; SampleCommand.CommandText = "IsMemberExexist"; SqlParameter SampleCommandParameter = new SqlParameter { ParameterName = "@MemberNumber", SqlDbType = SqlDbType.VarChar, Direction = ParameterDirection.Input, SqlValue = MemberNumber }; SampleCommand.Parameters.Add(SampleCommandParameter); SqlDataReader SampleDataReader; SampleDataReader = SampleCommand.ExecuteReader(); if (SampleDataReader.HasRows) { while (SampleDataReader.Read()) { MembershipCode = SampleDataReader["MembershipCode"].ToString(); } } SampleDataReader.Close(); SampleConnection.Close(); return(MembershipCode); }
public DailyTeeTimeSheet GetBookedTeeTime(string MemberNumber, string Date, string TeeTime) { SqlConnection SampleConnection = new SqlConnection(); SampleConnection.ConnectionString = connectionString; SampleConnection.Open(); SqlCommand GetTeeTime = new SqlCommand(); GetTeeTime.Connection = SampleConnection; GetTeeTime.CommandType = CommandType.StoredProcedure; GetTeeTime.CommandText = "GetBookedTeeTime"; GetTeeTime.Parameters.AddWithValue("@Date", Date); GetTeeTime.Parameters.AddWithValue("@TeeTime", TeeTime); GetTeeTime.Parameters.AddWithValue("@MemberNumber", MemberNumber); SqlDataReader SampleDataReader; SampleDataReader = GetTeeTime.ExecuteReader(); DailyTeeTimeSheet BookedTeeTime = new DailyTeeTimeSheet(); List <string> BookedMembers = new List <string>(); if (SampleDataReader.HasRows) { while (SampleDataReader.Read()) { BookedTeeTime.Date = SampleDataReader["Date"].ToString(); BookedTeeTime.Teetime = SampleDataReader["Teetime"].ToString(); BookedTeeTime.Member1Number = SampleDataReader["MemberNumber"].ToString(); BookedTeeTime.Phone = SampleDataReader["Phone"].ToString(); BookedTeeTime.NumberOfCarts = int.Parse(SampleDataReader["NumberOfCarts"].ToString()); } SampleDataReader.Close(); SqlCommand GetTeeTimeWithMembers = new SqlCommand(); GetTeeTimeWithMembers.Connection = SampleConnection; GetTeeTimeWithMembers.CommandType = CommandType.StoredProcedure; GetTeeTimeWithMembers.CommandText = "GetTeeTimeWithMembers"; GetTeeTimeWithMembers.Parameters.AddWithValue("@Date", Date); GetTeeTimeWithMembers.Parameters.AddWithValue("@TeeTime", TeeTime); SqlDataReader SampleDataReader2; SampleDataReader2 = GetTeeTimeWithMembers.ExecuteReader(); if (SampleDataReader2.HasRows) { while (SampleDataReader2.Read()) { BookedMembers.Add(SampleDataReader2["MemberNumber"].ToString()); } } int memberCount = BookedMembers.Count(); while (memberCount < 4) { BookedMembers.Add(null); memberCount++; } BookedMembers.Remove(BookedTeeTime.Member1Number); BookedTeeTime.Member2Number = BookedMembers[0]; BookedTeeTime.Member3Number = BookedMembers[1]; BookedTeeTime.Member4Number = BookedMembers[2]; SampleDataReader2.Close(); SampleConnection.Close(); } else { SampleDataReader.Close(); SampleConnection.Close(); } return(BookedTeeTime); }