Пример #1
0
 public static string RIDE_REQ_UPDATE(RideRequest riderequest_)
 {
     return string.Format("UPDATE rh_riderequests t SET t.`accepted` = {0}, t.`seenbyhost` = {1}, t.`seenbyrequestor` = {2} WHERE t.`requestid` = {3}",
         Utilities.ConvertToSQLBoolean(riderequest_.Accepted),
         Utilities.ConvertToSQLBoolean(riderequest_.SeenByHost),
         Utilities.ConvertToSQLBoolean(riderequest_.SeenByRequester),
         riderequest_.RequestID);
 }
Пример #2
0
        static void Runn(string[] args)
        {
            DataService ds = new DataService();
            FacebookUser fb = new FacebookUser() { FbId = 666, AboutMe = "werwer", Email = "*****@*****.**", Name = "AHILAN", Phone = "911", PictureUrl = "YYYY" };
            FacebookUser fb2 = new FacebookUser() { FbId = 667, AboutMe = "werwer", Email = "*****@*****.**", Name = "AHILAN2", Phone = "911", PictureUrl = "YYYY" };
            FacebookUser fb3 = new FacebookUser() { FbId = 668, AboutMe = "werwer", Email = "*****@*****.**", Name = "AHILAN3", Phone = "911", PictureUrl = "YYYY" };
            ds.AuthenticateUser(fb);
            ds.AuthenticateUser(fb2);
            ds.AuthenticateUser(fb3);
            List<long> hi = new List<long> { 12, 12, 12, 12 };
            RideHostSession s1 = new RideHostSession() { RideHostID = 666, PostedTime = DateTime.Now, DepartTime = DateTime.Now, EstimatedArrivalTime = DateTime.Now, LocationTo = "Toronto", LocationFrom = "Waterloo", Riders = new long[] { 1, 1, 1 }, RideRequests = hi, Price = 12, AdditionalMessage = "no" };
            RideHostSession s2 = new RideHostSession() { RideHostID = 699, PostedTime = DateTime.Now, DepartTime = DateTime.Now, EstimatedArrivalTime = DateTime.Now, LocationTo = "Markham", LocationFrom = "Waterloo", Riders = new long[] { 1, 1, 1 }, RideRequests = hi, Price = 12, AdditionalMessage = "no" };
            RideHostSession s3 = new RideHostSession() { RideHostID = 698, PostedTime = DateTime.Now, DepartTime = DateTime.Now, EstimatedArrivalTime = DateTime.Now, LocationTo = "Ajax", LocationFrom = "Waterloo", Riders = new long[] { 1, 1, 1 }, RideRequests = hi, Price = 12, AdditionalMessage = "no" };
            RideHostSession s4 = new RideHostSession() { RideHostID = 697, PostedTime = DateTime.Now, DepartTime = DateTime.Now, EstimatedArrivalTime = DateTime.Now, LocationTo = "Weber", LocationFrom = "Waterloo", Riders = new long[] { 1, 1, 1 }, RideRequests = hi, Price = 12, AdditionalMessage = "no" };
            ds.StoreRideSession(s1);
            RideRequest r1 = new RideRequest() {RequestedById = 667, RequestedToId = 666, SessionId = s1.SessionID, AdditionalMessage = "hey", Accepted = false, SeenByHost = false, SeenByRequester = false };
            RideRequest r2 = new RideRequest() { RequestedById = 668, RequestedToId = 666, SessionId = s1.SessionID, AdditionalMessage = "heyyo", Accepted = false, SeenByHost = false, SeenByRequester = false };
            ds.StoreRideRequest(r1);
            ds.StoreRideRequest(r2);

            List<RideRequest> hi2 = ds.GetRequests(fb2, true, 10);
            ds.GetPostedRides(10, Lib.Enums.SortRideBy.Hot, fb);
        }
Пример #3
0
 public Boolean StoreRideRequest(RideRequest inRideRequest_)
 {
     return _rideManager.StoreRideRequest(inRideRequest_);
 }
Пример #4
0
 public Boolean HandleRequest(RideRequest inRideRequest_)
 {
     return _rideManager.UpdateRideRequest(inRideRequest_);
 }
Пример #5
0
 //RIDE REQUESTS
 public static string STORE_RIDE_REQ(RideRequest riderequest_)
 {
     return string.Format("INSERT INTO rh_riderequests VALUES (NULL, {0}, '{1}', '{2}', '{3}', '{4}', '{5}', '{6}')",
                             riderequest_.RequestedById,
                             riderequest_.RequestedToId,
                             riderequest_.SessionId,
                             riderequest_.AdditionalMessage,
                             Utilities.ConvertToSQLBoolean(riderequest_.Accepted),
                             Utilities.ConvertToSQLBoolean(riderequest_.SeenByHost),
                             Utilities.ConvertToSQLBoolean(riderequest_.SeenByRequester)
                         );
 }
Пример #6
0
 public Boolean UpdateRideRequest(RideRequest inRideRequest_)
 {
     return _sqlData.ExecuteNonQuery(Queries.RIDE_REQ_UPDATE(inRideRequest_));
 }
Пример #7
0
 //RIDE REQUESTS
 public Boolean StoreRideRequest(RideRequest inRideRequest_)
 {
     return _sqlData.ExecuteNonQuery(Queries.STORE_RIDE_REQ(inRideRequest_));
 }
Пример #8
0
        private List<RideRequest> ParseRideRequestByQuery(string inQuery_)
        {
            if (_sqlData.OpenConnection() == true)
            {
                MySqlCommand tmpCmd = new MySqlCommand(inQuery_, this._sqlData.SQLConnection);

                List<RideRequest> retRideRequests = new List<RideRequest>();

                using (MySqlDataReader dataReader = tmpCmd.ExecuteReader())
                {
                    while (dataReader.Read())
                    {
                        RideRequest tmp = new RideRequest()
                        {
                            SessionId = dataReader.GetInt64(MySQLConfig.TableConstants.RideRequest.COL_SESSION_ID),
                            RequestID = dataReader.GetInt64(MySQLConfig.TableConstants.RideRequest.COL_REQ_ID),
                            AdditionalMessage = dataReader.GetString(MySQLConfig.TableConstants.RideRequest.COL_ADDITIONAL_MSG),
                            Accepted = (dataReader.GetInt16(MySQLConfig.TableConstants.RideRequest.COL_ACCEPTED) == 1),
                            RequestedById = dataReader.GetInt64(MySQLConfig.TableConstants.RideRequest.COL_REQ_BY_ID),
                            RequestedToId = dataReader.GetInt64(MySQLConfig.TableConstants.RideRequest.COL_REQ_TO_ID)
                        };

                        retRideRequests.Add(tmp);
                    }
                }

                return retRideRequests;
            }
            else
            {
                throw new Exception("SQL Connection error");
            }
        }