Ejemplo n.º 1
0
        public bool removeRequest(DeliveryRequestID RID)
        {
            if (RID != null)
            {
                var request = db.DeliveryRequests.Find(RID.id);
                request.StatusID = 5; // removed
                db.SaveChanges();
            }

            return(RID != null);
        }
        public bool payDeliveryRequest(DeliveryRequestID Ord_ID)
        {
            // Debug.WriteLine(" Ord_ID => " + Ord_ID.id);
            if (Ord_ID != null)
            {
                var req = db.DeliveryRequests.Find(Ord_ID.id);
                req.Paid = 2;
                db.SaveChanges();
                Session["PaymentFlag"] = null;
            }

            return(Ord_ID != null);
        }
        /////////////////////////////////////////////////////////////////////////////////////



        /// <summary>
        /// Maps Functions of DeliveryRequest "Ramadan's Functions" //////////////////////////////////////////////////////////////////////
        /// </summary>
        ///

        public ActionResult getCurrentLocation(DeliveryRequestID RID)
        {
            if (RID != null)
            {
                var result = new CurrentLocation {
                    c_location = ""
                };
                result.c_location = db.DeliveryRequests.FirstOrDefault(d => d.ID == RID.id).CurrentLocation;


                Debug.WriteLine(DateTime.Now.ToString("h:mm:ss tt") + " =>" + RID.id + " => " + result.c_location + " =");

                return(Json(new { employee = result }, JsonRequestBehavior.AllowGet));
            }



            return(Json(new { employee = new CurrentLocation {
                                  c_location = "Location Not Found!"
                              } }, JsonRequestBehavior.AllowGet));
        }
        public ActionResult getjourneyInfo(DeliveryRequestID RID)
        {
            if (RID != null)
            {
                var result = new journey {
                    source = "", destination = "", current_loc = ""
                };
                var request = db.DeliveryRequests.FirstOrDefault(d => d.ID == RID.id);
                result.source      = request.Source;
                result.destination = request.Destination;
                result.current_loc = request.CurrentLocation;
                Debug.WriteLine(DateTime.Now.ToString("h:mm:ss tt") + " =>" + RID.id + " => " + result.source + " = " + result.destination);

                return(Json(new { journy = result }, JsonRequestBehavior.AllowGet));
            }



            return(Json(new { employee = new CurrentLocation {
                                  c_location = "Location Not Found!"
                              } }, JsonRequestBehavior.AllowGet));
        }