Exemple #1
0
        internal object UserLogin()
        {
            try
            {
                if (CheckIsUserCredintialsRight())
                {
                    if (!CheckIsUserHasToken())
                    {
                        CeateUserToken();
                    }

                    return(new { Status = 1, this.Token });
                }
                else
                {
                    return(new { Status = 0, Msg = LOGIN_MSG, MsgArabic = LOGIN_MSG_ARABIC });
                }
            }
            catch (Exception ex)
            {
#if DEBUG
                throw ex;
#endif

                return(ExcptionHandler.OnModelMethodeException(ex));
            }
        }
Exemple #2
0
 internal object GetAgencyByID()
 {
     try
     {
         IEnumerable <AgencySelect_Result> result = Context.AgencySelect().Where(a => a.ID == this.AgencyID);
         return(new { Status = 1, Agency = result });
     }
     catch (Exception ex)
     {
         return(ExcptionHandler.OnModelMethodeException(ex));
     }
 }
Exemple #3
0
 internal object GetAllAgencies()
 {
     try
     {
         List <AgencySelect_Result> result = Context.AgencySelect().ToList();
         return(new { Status = 1, Agencies = result });
     }
     catch (Exception ex)
     {
         return(ExcptionHandler.OnModelMethodeException(ex));
     }
 }
Exemple #4
0
 internal object GetAgencySoldTickets(Agency agency)
 {
     try
     {
         IEnumerable <TicketSelect_Result> result = Context.TicketSelect().Where(t => t.AgencyRoutID == agency.AgencyID);
         return(new { Status = 1, Tickects = result });
     }
     catch (Exception ex)
     {
         return(ExcptionHandler.OnModelMethodeException(ex));
     }
 }
Exemple #5
0
 internal object GetUserAgencies()
 {
     try
     {
         var result = Context.AgencySelect().Where(a => a.UserID == this.UserID);
         return(new { Status = 1, Agencies = result });
     }
     catch (Exception ex)
     {
         return(ExcptionHandler.OnModelMethodeException(ex));
     }
 }
Exemple #6
0
 internal object CreateNewCity()
 {
     try
     {
         var result = Context.CityInsert(this.Code, this.Name, this.NameArabic).FirstOrDefault();
         return(new { Status = 1, CityID = result });
     }
     catch (Exception ex)
     {
         return(ExcptionHandler.OnModelMethodeException(ex));
     }
 }
Exemple #7
0
 internal object GetAvailableRoutes()
 {
     try
     {
         List <RouteSelect_Result> result = Context.RouteSelect().ToList();
         return(new { Status = 1, Routes = result });
     }
     catch (Exception ex)
     {
         return(ExcptionHandler.OnModelMethodeException(ex));
     }
 }
 public HttpResponseMessage GetAgencySoldTickets([FromBody] Agency agency)
 {
     try
     {
         var result = Model.GetAgencySoldTickets(agency);
         HttpResponseMessage msg = responceFactory.GetResponseMsg(Request, result);
         return(msg);
     }
     catch (Exception ex)
     {
         return(ExcptionHandler.OnActionException(Request, ex));
     }
 }
 public HttpResponseMessage PostSignUpUserInfo([FromBody] User user)
 {
     try
     {
         object result           = user.UserSignUp();
         HttpResponseMessage msg = responseFactory.GetResponseMsg(Request, result);
         return(msg);
     }
     catch (Exception ex)
     {
         return(ExcptionHandler.OnActionException(Request, ex));
     }
 }
 public HttpResponseMessage Get()
 {
     try
     {
         object result           = Model.GetAllCities();
         HttpResponseMessage msg = respFactory.GetResponseMsg(Request, result);
         return(msg);
     }
     catch (Exception ex)
     {
         return(ExcptionHandler.OnActionException(Request, ex));
     }
 }
 public HttpResponseMessage GetAgencyRoutes([FromBody] Route agencyRoute)
 {
     try
     {
         var result = agencyRoute.GetBusRoutesByFilter();
         HttpResponseMessage msg = responceFactory.GetResponseMsg(Request, result);
         return(msg);
     }
     catch (Exception ex)
     {
         return(ExcptionHandler.OnActionException(Request, ex));
     }
 }
 public HttpResponseMessage PostAgencyRout([FromBody] Route route)
 {
     try
     {
         var result = route.AddAgencyRoute();
         HttpResponseMessage msg = responceFactory.GetResponseMsg(Request, result);
         return(msg);
     }
     catch (Exception ex)
     {
         return(ExcptionHandler.OnActionException(Request, ex));
     }
 }
 public HttpResponseMessage GetAgencyDetails([FromBody] Agency agency)
 {
     try
     {
         var result = agency.GetAgencyByID();
         HttpResponseMessage msg = responceFactory.GetResponseMsg(Request, result);
         return(msg);
     }
     catch (Exception ex)
     {
         return(ExcptionHandler.OnActionException(Request, ex));
     }
 }
 public HttpResponseMessage GetUserAgencies()
 {
     try
     {
         var result = Model.GetUserAgencies();
         HttpResponseMessage msg = responceFactory.GetResponseMsg(Request, result);
         return(msg);
     }
     catch (Exception ex)
     {
         return(ExcptionHandler.OnActionException(Request, ex));
     }
 }
 public HttpResponseMessage PostIssuedTicket([FromBody] Passenger passenger)
 {
     try
     {
         object result           = passenger.IssueTicket();
         HttpResponseMessage msg = respFactory.GetResponseMsg(Request, result);
         return(msg);
     }
     catch (Exception ex)
     {
         return(ExcptionHandler.OnActionException(Request, ex));
     }
 }
        public HttpResponseMessage PostNewCityDetails([FromBody] City city)
        {
            try
            {
                object result           = city.CreateNewCity();
                HttpResponseMessage msg = respFactory.GetResponseMsg(Request, result);
                return(msg);
            }

            catch (Exception ex)
            {
                return(ExcptionHandler.OnActionException(Request, ex));
            }
        }
Exemple #17
0
        internal object UserSignUp()
        {
            try
            {
                UserInsert_Result result = Context.UserInsert(this.FullName,
                                                              this.Email,
                                                              this.Phone,
                                                              this.Password,
                                                              this.TypeID).FirstOrDefault();

                return(new { Status = 1, UserID = result.result, result.Msg, result.MsgArabic });
            }
            catch (Exception ex)
            {
                return(ExcptionHandler.OnModelMethodeException(ex));
            }
        }
Exemple #18
0
        internal object GetBusRoutesByFilter()
        {
            try
            {
                List <AgencyRoutSelect_Result> FilterResult = Context.AgencyRoutSelect().ToList();

                FilterResult = FilterRoutesByFromCityCode(FilterResult);
                FilterResult = FilterRouteByToCityCode(FilterResult);
                FilterResult = FilterRoutesByAgencyID(FilterResult);
                FilterResult = FilterRouteByDate(FilterResult);

                return(new { Status = 1, Routes = FilterResult });
            }
            catch (Exception ex)
            {
                return(ExcptionHandler.OnModelMethodeException(ex));
            }
        }
Exemple #19
0
        internal object AddAgencyRoute()
        {
            try
            {
                System.Data.Objects.ObjectResult <decimal?> result = Context.AgencyRouteInsert(this.AgencyID,
                                                                                               this.RouteID,
                                                                                               this.Date,
                                                                                               this.TravilTime,
                                                                                               this.AvailableTickets,
                                                                                               this.Price,
                                                                                               this.Description);

                return(new { Status = 1, RouteID = result });
            }
            catch (Exception ex)
            {
                return(ExcptionHandler.OnModelMethodeException(ex));
            }
        }
        internal object IssueTicket()
        {
            try
            {
                var result = Context.TicketInsert(this.UserID,
                                                  this.Route.AgencyRouteID,
                                                  this.Route.Price,
                                                  DateTime.Now,
                                                  this.PaymentBy,
                                                  this.PayTransactionNo,
                                                  this.Bank,
                                                  this.AccountNo).FirstOrDefault();

                return(new { status = 1, result.TicketNo });
            }
            catch (Exception ex)
            {
                return(ExcptionHandler.OnModelMethodeException(ex));
            }
        }