public void SetUp()
 {
     _controller = ReservationController();
 }
        private async void SubmitPaymentDetails(CreateReservationMobileRequest reservationMobileRequest)
        {
            submitPaymentandCreateReservationRequest.reservationMobileRequest = reservationMobileRequest;

            int         selectedCardId = 0;
            CreditCards selectedCard   = null;

            foreach (var item in cardDetails)
            {
                if (item.isCardSelect == "iconCircleSelected.png")
                {
                    selectedCardId = item.cardId;
                }
            }


            if (selectedCardId > 0)
            {
                foreach (CreditCards cc in creditCards.listCard)
                {
                    if (cc.CreditCardId == selectedCardId)
                    {
                        selectedCard = cc;
                    }
                }
            }

            if (selectedCard != null)
            {
                billingInformation.FirstName     = Constants.customerDetails.FirstName;
                billingInformation.LastName      = Constants.customerDetails.LastName;
                billingInformation.Email         = Constants.customerDetails.Email;
                billingInformation.Address       = Constants.customerDetails.Address1;
                billingInformation.City          = Constants.customerDetails.City;
                billingInformation.State         = Constants.customerDetails.StateName;
                billingInformation.ZipCode       = Constants.customerDetails.ZipCode;
                billingInformation.Country       = Constants.customerDetails.CountryName;
                billingInformation.phone         = Constants.customerDetails.hPhone;
                billingInformation.CustomerId    = customerId;
                billingInformation.PaymentType   = "Advance Payment";
                billingInformation.PaymentAmount = Convert.ToDouble(summaryMobileResponsecs.rate.ReservationSummary.EstimatedTotal);

                billingInformation.NameOnCard              = selectedCard.NameOnCard;
                billingInformation.CreditCardNumber        = selectedCard.CreditCardNo;
                billingInformation.CreditCardNumberDisplay = selectedCard.CreditCardNoForDisplay;
                billingInformation.SecurityCode            = selectedCard.CreditCardCVSNo;
                billingInformation.ExpiryMonth             = selectedCard.Month;
                billingInformation.ExpiryYear              = selectedCard.Year;
                billingInformation.CreditCardType          = selectedCard.CreditCardType;
                billingInformation.CreditCardId            = (int)selectedCard.CreditCardId;

                billingInformation.LocationId = (int)ReservationMobileRequest.reversationData.StartLocationId;

                billingInformation.FullName    = Constants.customerDetails.FirstName;
                billingInformation.PaymentInfo = new PaymentReferenceInfo();
                //billingInformation.PaymentInfo.ResevationId = ReservationMobileResponse.ReserveId;
                //billingInformation.PaymentInfo.AgreementId = ReservationMobileResponse.ReserveId;
                billingInformation.PaymentInfo.PaymentType    = "Advance Payment";
                billingInformation.PaymentInfo.PaymentDate    = DateTime.Now;
                billingInformation.PaymentInfo.PaymentDateStr = DateTime.Now.ToString();
                billingInformation.PaymentInfo.PaymentMode    = PaymentMode.Payment;
                billingInformation.PaymentInfo.PaymentBy      = Constants.customerDetails.FirstName;
                ReservationController reservationController = new ReservationController();
                submitPaymentandCreateReservationRequest.billingInformation = billingInformation;

                if (App.Current.Properties.ContainsKey("LastCreditCardId"))
                {
                    App.Current.Properties["LastCreditCardId"] = (int)selectedCard.CreditCardId;
                }
                else
                {
                    App.Current.Properties.Add("LastCreditCardId", (int)selectedCard.CreditCardId);
                }
                bool busy = false;
                if (!busy)
                {
                    try
                    {
                        busy = true;
                        await PopupNavigation.Instance.PushAsync(new LoadingPopup("."));

                        await Task.Run(async() =>
                        {
                            try
                            {
                                PaymentResponse = reservationController.SubmitPaymentAndCreateReservation(submitPaymentandCreateReservationRequest, token);
                            }
                            catch (Exception ex)
                            {
                                await PopupNavigation.Instance.PushAsync(new ErrorWithClosePagePopup(ex.Message));
                            }
                        });
                    }
                    catch (Exception ex)
                    {
                        await PopupNavigation.Instance.PushAsync(new ErrorWithClosePagePopup(ex.Message));
                    }
                    finally
                    {
                        busy = false;
                        if (PopupNavigation.Instance.PopupStack.Count == 1)
                        {
                            await PopupNavigation.Instance.PopAllAsync();
                        }
                        if (PopupNavigation.Instance.PopupStack.Count > 1)
                        {
                            if (PopupNavigation.Instance.PopupStack[PopupNavigation.Instance.PopupStack.Count - 1].GetType() != typeof(ErrorWithClosePagePopup))
                            {
                                await PopupNavigation.Instance.PopAllAsync();
                            }
                        }

                        if (PaymentResponse != null)
                        {
                            if (PaymentResponse.Status)
                            {
                                if (PaymentResponse.Data != null)
                                {
                                    if (PaymentResponse.Data.reservationRespose != null)
                                    {
                                        if (PaymentResponse.Data.reservationRespose.ReserveId > 0)
                                        {
                                            await PopupNavigation.Instance.PushAsync(new SuccessPopUp("Congrats! Your payment was successful! You will receive an email once your insurance card has been issued. Please DO NOT attempt to pick up the vehicle until then.", 1));
                                        }
                                        else if (PaymentResponse.RefundStatus)
                                        {
                                            await PopupNavigation.Instance.PushAsync(new Error_popup("Sorry, Your booking failed. Your payment will refund shortly. "));
                                        }
                                        else
                                        {
                                            await PopupNavigation.Instance.PushAsync(new Error_popup("Sorry, Your booking failed. Please contact us for your refund. "));
                                        }
                                    }
                                    else if (PaymentResponse.RefundStatus)
                                    {
                                        await PopupNavigation.Instance.PushAsync(new Error_popup("Sorry, Your booking failed. Your payment will refund shortly. "));
                                    }
                                    else
                                    {
                                        await PopupNavigation.Instance.PushAsync(new Error_popup("Sorry, Your booking failed. Please contact us for your refund. "));
                                    }
                                }
                                else if (PaymentResponse.RefundStatus)
                                {
                                    await PopupNavigation.Instance.PushAsync(new Error_popup("Sorry, Your booking failed. Your payment will refund shortly. "));
                                }
                                else
                                {
                                    await PopupNavigation.Instance.PushAsync(new Error_popup("Sorry, Your booking failed. Please contact us for your refund. "));
                                }
                            }
                            else
                            {
                                await PopupNavigation.Instance.PushAsync(new Error_popup("SORRY, YOUR PAYMENT PROCESS FAILED, Please try again with another card details."));
                            }
                        }
                        else
                        {
                            await PopupNavigation.Instance.PushAsync(new Error_popup("SORRY, YOUR PAYMENT PROCESS FAILED, Please try again with another card details."));
                        }
                    }
                }
            }
            else
            {
                await PopupNavigation.Instance.PushAsync(new Error_popup("Please select a valid card details"));
            }
        }
Example #3
0
        #pragma warning disable 1998
        public async override global::System.Threading.Tasks.Task ExecuteAsync()
        {
#line 2 "C:\Users\bakir\source\repos\Grupa1-Sjedi.ba\Implementacija\SjediBa\SjediBa\Views\Reservation\Reservation.cshtml"

            ViewData["Title"] = "Događaji";

#line default
#line hidden
            BeginContext(72, 6, true);
            WriteLiteral("\r\n<h1>");
            EndContext();
            BeginContext(79, 17, false);
#line 6 "C:\Users\bakir\source\repos\Grupa1-Sjedi.ba\Implementacija\SjediBa\SjediBa\Views\Reservation\Reservation.cshtml"
            Write(ViewData["Title"]);

#line default
#line hidden
            EndContext();
            BeginContext(96, 9, true);
            WriteLiteral("</h1>\r\n\r\n");
            EndContext();
#line 8 "C:\Users\bakir\source\repos\Grupa1-Sjedi.ba\Implementacija\SjediBa\SjediBa\Views\Reservation\Reservation.cshtml"

            List <EventModel> events = ReservationController.GetEvents();


#line default
#line hidden
            BeginContext(184, 269, true);
            WriteLiteral(@"
<div class=""clearfix"">
    <table class=""float-left w-100"">
        <tr>
            <th>ID</th>
            <th>Naziv</th>
            <th>Lokacija</th>
            <th>Datum</th>
            <th>Vrijeme</th>
            <th>Organizator</th>
        </tr>
");
            EndContext();
#line 23 "C:\Users\bakir\source\repos\Grupa1-Sjedi.ba\Implementacija\SjediBa\SjediBa\Views\Reservation\Reservation.cshtml"
            foreach (var e in events)
            {
#line default
#line hidden
                BeginContext(500, 38, true);
                WriteLiteral("            <tr>\r\n                <td>");
                EndContext();
                BeginContext(539, 14, false);
#line 26 "C:\Users\bakir\source\repos\Grupa1-Sjedi.ba\Implementacija\SjediBa\SjediBa\Views\Reservation\Reservation.cshtml"
                Write(e.EventModelId);

#line default
#line hidden
                EndContext();
                BeginContext(553, 27, true);
                WriteLiteral("</td>\r\n                <td>");
                EndContext();
                BeginContext(581, 6, false);
#line 27 "C:\Users\bakir\source\repos\Grupa1-Sjedi.ba\Implementacija\SjediBa\SjediBa\Views\Reservation\Reservation.cshtml"
                Write(e.Name);

#line default
#line hidden
                EndContext();
                BeginContext(587, 27, true);
                WriteLiteral("</td>\r\n                <td>");
                EndContext();
                BeginContext(615, 17, false);
#line 28 "C:\Users\bakir\source\repos\Grupa1-Sjedi.ba\Implementacija\SjediBa\SjediBa\Views\Reservation\Reservation.cshtml"
                Write(e.SpaceModel.Name);

#line default
#line hidden
                EndContext();
                BeginContext(632, 27, true);
                WriteLiteral("</td>\r\n                <td>");
                EndContext();
                BeginContext(660, 35, false);
#line 29 "C:\Users\bakir\source\repos\Grupa1-Sjedi.ba\Implementacija\SjediBa\SjediBa\Views\Reservation\Reservation.cshtml"
                Write(e.StartDate.ToString("dd. MM. yy."));

#line default
#line hidden
                EndContext();
                BeginContext(695, 27, true);
                WriteLiteral("</td>\r\n                <td>");
                EndContext();
                BeginContext(723, 31, false);
#line 30 "C:\Users\bakir\source\repos\Grupa1-Sjedi.ba\Implementacija\SjediBa\SjediBa\Views\Reservation\Reservation.cshtml"
                Write(e.StartDate.ToShortTimeString());

#line default
#line hidden
                EndContext();
                BeginContext(754, 27, true);
                WriteLiteral("</td>\r\n                <td>");
                EndContext();
                BeginContext(782, 21, false);
#line 31 "C:\Users\bakir\source\repos\Grupa1-Sjedi.ba\Implementacija\SjediBa\SjediBa\Views\Reservation\Reservation.cshtml"
                Write(e.OrganizerModel.Name);

#line default
#line hidden
                EndContext();
                BeginContext(803, 1, true);
                WriteLiteral(" ");
                EndContext();
                BeginContext(805, 24, false);
#line 31 "C:\Users\bakir\source\repos\Grupa1-Sjedi.ba\Implementacija\SjediBa\SjediBa\Views\Reservation\Reservation.cshtml"
                Write(e.OrganizerModel.Surname);

#line default
#line hidden
                EndContext();
                BeginContext(829, 7, true);
                WriteLiteral("</td>\r\n");
                EndContext();
#line 32 "C:\Users\bakir\source\repos\Grupa1-Sjedi.ba\Implementacija\SjediBa\SjediBa\Views\Reservation\Reservation.cshtml"
                if (ViewData["role"] == null || (string)ViewData["role"] == "Registred")
                {
#line default
#line hidden
                    BeginContext(928, 26, true);
                    WriteLiteral("                    <td>\r\n");
                    EndContext();
#line 34 "C:\Users\bakir\source\repos\Grupa1-Sjedi.ba\Implementacija\SjediBa\SjediBa\Views\Reservation\Reservation.cshtml"
                    var json = Newtonsoft.Json.JsonConvert.SerializeObject(e);

#line default
#line hidden
                    BeginContext(1043, 117, true);
                    WriteLiteral("                        <button type=\"button\" class=\"btn btn-primary\" data-toggle=\"modal\" data-target=\"#bookingPopup\"");
                    EndContext();
                    BeginWriteAttribute("onclick", " onclick=\"", 1160, "\"", 1192, 3);
                    WriteAttributeValue("", 1170, "SetCurrentEvent(", 1170, 16, true);
#line 35 "C:\Users\bakir\source\repos\Grupa1-Sjedi.ba\Implementacija\SjediBa\SjediBa\Views\Reservation\Reservation.cshtml"
                    WriteAttributeValue("", 1186, json, 1186, 5, false);

#line default
#line hidden
                    WriteAttributeValue("", 1191, ")", 1191, 1, true);
                    EndWriteAttribute();
                    BeginContext(1193, 104, true);
                    WriteLiteral(">\r\n                            Rezerviši\r\n                        </button>\r\n                    </td>\r\n");
                    EndContext();
#line 39 "C:\Users\bakir\source\repos\Grupa1-Sjedi.ba\Implementacija\SjediBa\SjediBa\Views\Reservation\Reservation.cshtml"
                }

#line default
#line hidden
                BeginContext(1316, 19, true);
                WriteLiteral("            </tr>\r\n");
                EndContext();
#line 41 "C:\Users\bakir\source\repos\Grupa1-Sjedi.ba\Implementacija\SjediBa\SjediBa\Views\Reservation\Reservation.cshtml"
            }

#line default
#line hidden
            BeginContext(1346, 753, true);
            WriteLiteral(@"    </table>
</div>


<!-- Modal -->
<div class=""modal fade"" id=""bookingPopup"" tabindex=""-1"" role=""dialog"" aria-labelledby=""modalLabel"" aria-hidden=""true"">
    <div class=""modal-dialog modal-lg"" role=""document"">
        <div class=""modal-content"">
            <div class=""modal-header"">
                <h5 class=""modal-title"" id=""modalLabel"">Rezerviši događaj</h5>
                <button type=""button"" class=""close"" data-dismiss=""modal"" aria-label=""Close"">
                <span aria-hidden=""true"">&times;</span>
                </button>
            </div>
            <div class=""modal-body"">
                <div class=""mb-3"">
                    <span class=""h3"" id=""eventName""></span><br>
                </div>
                ");
            EndContext();
            BeginContext(2099, 4953, false);
            __tagHelperExecutionContext = __tagHelperScopeManager.Begin("form", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "91be23ca559bd8ade0cddda63ed8fda03e797e1412590", async() => {
                BeginContext(2182, 84, true);
                WriteLiteral("\r\n                    <input type=\"hidden\" id=\"eventid\" name=\"eventid\" value=\"\">\r\n\r\n");
                EndContext();
#line 63 "C:\Users\bakir\source\repos\Grupa1-Sjedi.ba\Implementacija\SjediBa\SjediBa\Views\Reservation\Reservation.cshtml"
                if (ViewData["role"] == null)
                {
#line default
#line hidden
                    BeginContext(2340, 1653, true);
                    WriteLiteral(@"                        <input type= ""hidden"" id=""userid"" name= ""userid"" value=""0"">
                        <div class=""form-group row"">
                            <label for=""name"" class=""col-form-label col-sm-3"">Ime:</label>
                            <div class=""col-sm-9"">
                                <input type=""text"" class=""form-control"" name=""name"" id=""name"" placeholder=""Ime"">
                            </div>
                        </div>
                        <div class=""form-group row"">
                            <label for=""name"" class=""col-form-label col-sm-3"">Prezime:</label>
                            <div class=""col-sm-9"">
                                <input type=""text"" class=""form-control"" name=""surname"" id=""surname"" placeholder=""Prezime"">
                            </div>
                        </div>
                        <div class=""form-group row"">
                            <label for=""name"" class=""col-form-label col-sm-3"">Adresa:</label>
                ");
                    WriteLiteral(@"            <div class=""col-sm-9"">
                                <input type=""text"" class=""form-control"" name=""address"" id=""address"" placeholder=""Adresa"">
                            </div>
                        </div>
                        <div class=""form-group row"">
                            <label for=""date"" class=""col-form-label col-sm-3"">Datum rodjenja:</label>
                            <div class=""col-sm-9"">
                                <input type=""date"" class=""form-control"" name=""date"" id=""date"" placeholder=""Datum rodjenja"">
                            </div>
                        </div>
");
                    EndContext();
#line 90 "C:\Users\bakir\source\repos\Grupa1-Sjedi.ba\Implementacija\SjediBa\SjediBa\Views\Reservation\Reservation.cshtml"
                }
                else
                {
                    var currentUser = ReservationController.getCurrentForReservation((int)ViewData["id"]);



#line default
#line hidden
                    BeginContext(4235, 76, true);
                    WriteLiteral("                            <input type= \"hidden\" id=\"userid\" name= \"userid\"");
                    EndContext();
                    BeginWriteAttribute("value", " value=\"", 4311, "\"", 4334, 1);
#line 96 "C:\Users\bakir\source\repos\Grupa1-Sjedi.ba\Implementacija\SjediBa\SjediBa\Views\Reservation\Reservation.cshtml"
                    WriteAttributeValue("", 4319, ViewData["id"], 4319, 15, false);

#line default
#line hidden
                    EndWriteAttribute();
                    BeginContext(4335, 315, true);
                    WriteLiteral(@">
                            <div class=""form-group row""> 
                            <label for=""name"" class=""col-form-label col-sm-3"">Ime:</label>
                            <div class=""col-sm-9"">
                                <input disabled=""true"" type=""text"" class=""form-control"" name=""name"" id=""name""");
                    EndContext();
                    BeginWriteAttribute("value", " value=\"", 4650, "\"", 4675, 1);
#line 100 "C:\Users\bakir\source\repos\Grupa1-Sjedi.ba\Implementacija\SjediBa\SjediBa\Views\Reservation\Reservation.cshtml"
                    WriteAttributeValue("", 4658, currentUser.Name, 4658, 17, false);

#line default
#line hidden
                    EndWriteAttribute();
                    BeginContext(4676, 390, true);
                    WriteLiteral(@">
                            </div>
                        </div>
                        <div class=""form-group row"">
                            <label for=""name"" class=""col-form-label col-sm-3"">Prezime:</label>
                            <div class=""col-sm-9"">
                                <input disabled=""true"" type=""text"" class=""form-control"" name=""surename"" id=""surename""");
                    EndContext();
                    BeginWriteAttribute("value", " value=\"", 5066, "\"", 5094, 1);
#line 106 "C:\Users\bakir\source\repos\Grupa1-Sjedi.ba\Implementacija\SjediBa\SjediBa\Views\Reservation\Reservation.cshtml"
                    WriteAttributeValue("", 5074, currentUser.Surname, 5074, 20, false);

#line default
#line hidden
                    EndWriteAttribute();
                    BeginContext(5095, 387, true);
                    WriteLiteral(@">
                            </div>
                        </div>
                        <div class=""form-group row"">
                            <label for=""name"" class=""col-form-label col-sm-3"">Adresa:</label>
                            <div class=""col-sm-9"">
                                <input disabled=""true"" type=""text"" class=""form-control"" name=""address"" id=""address""");
                    EndContext();
                    BeginWriteAttribute("value", " value=\"", 5482, "\"", 5510, 1);
#line 112 "C:\Users\bakir\source\repos\Grupa1-Sjedi.ba\Implementacija\SjediBa\SjediBa\Views\Reservation\Reservation.cshtml"
                    WriteAttributeValue("", 5490, currentUser.Address, 5490, 20, false);

#line default
#line hidden
                    EndWriteAttribute();
                    BeginContext(5511, 389, true);
                    WriteLiteral(@">
                            </div>
                        </div>
                        <div class=""form-group row"">
                            <label for=""date"" class=""col-form-label col-sm-3"">Datum rodjenja:</label>
                            <div class=""col-sm-9"">
                                <input disabled=""true"" type=""date"" class=""form-control"" name=""date"" id=""date""");
                    EndContext();
                    BeginWriteAttribute("value", " value=\"", 5900, "\"", 5955, 1);
#line 118 "C:\Users\bakir\source\repos\Grupa1-Sjedi.ba\Implementacija\SjediBa\SjediBa\Views\Reservation\Reservation.cshtml"
                    WriteAttributeValue("", 5908, currentUser.DateOfBirth.ToString("yyyy-MM-dd"), 5908, 47, false);

#line default
#line hidden
                    EndWriteAttribute();
                    BeginContext(5956, 71, true);
                    WriteLiteral(">\r\n                            </div>\r\n                        </div>\r\n");
                    EndContext();
#line 121 "C:\Users\bakir\source\repos\Grupa1-Sjedi.ba\Implementacija\SjediBa\SjediBa\Views\Reservation\Reservation.cshtml"
                }

#line default
#line hidden
                BeginContext(6050, 249, true);
                WriteLiteral("                    <div class=\"form-group row\">\r\n                        <div class=\"col-sm-6\">\r\n                            <select class=\"form-control\" name=\"sector\" id=\"section\" onclick=\"SetSeats(); SetPrice()\">\r\n                                ");
                EndContext();
                BeginContext(6299, 32, false);
                __tagHelperExecutionContext = __tagHelperScopeManager.Begin("option", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "91be23ca559bd8ade0cddda63ed8fda03e797e1420281", async() => {
                    BeginContext(6316, 6, true);
                    WriteLiteral("Sektor");
                    EndContext();
                }
                                                                            );
                __Microsoft_AspNetCore_Mvc_TagHelpers_OptionTagHelper = CreateTagHelper <global::Microsoft.AspNetCore.Mvc.TagHelpers.OptionTagHelper>();
                __tagHelperExecutionContext.Add(__Microsoft_AspNetCore_Mvc_TagHelpers_OptionTagHelper);
                __Microsoft_AspNetCore_Mvc_TagHelpers_OptionTagHelper.Value = (string)__tagHelperAttribute_0.Value;
                __tagHelperExecutionContext.AddTagHelperAttribute(__tagHelperAttribute_0);
                await __tagHelperRunner.RunAsync(__tagHelperExecutionContext);
                if (!__tagHelperExecutionContext.Output.IsContentModified)
                {
                    await __tagHelperExecutionContext.SetOutputContentAsync();
                }
                Write(__tagHelperExecutionContext.Output);
                __tagHelperExecutionContext = __tagHelperScopeManager.End();
                EndContext();
                BeginContext(6331, 234, true);
                WriteLiteral("\r\n                            </select>\r\n                        </div>\r\n                        <div class=\"col-sm-6\">\r\n                            <select class=\"form-control\" name=\"seat\" id=\"seat\">\r\n                                ");
                EndContext();
                BeginContext(6565, 34, false);
                __tagHelperExecutionContext = __tagHelperScopeManager.Begin("option", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "91be23ca559bd8ade0cddda63ed8fda03e797e1421996", async() => {
                    BeginContext(6582, 8, true);
                    WriteLiteral("Sjedište");
                    EndContext();
                }
                                                                            );
                __Microsoft_AspNetCore_Mvc_TagHelpers_OptionTagHelper = CreateTagHelper <global::Microsoft.AspNetCore.Mvc.TagHelpers.OptionTagHelper>();
                __tagHelperExecutionContext.Add(__Microsoft_AspNetCore_Mvc_TagHelpers_OptionTagHelper);
                __Microsoft_AspNetCore_Mvc_TagHelpers_OptionTagHelper.Value = (string)__tagHelperAttribute_0.Value;
                __tagHelperExecutionContext.AddTagHelperAttribute(__tagHelperAttribute_0);
                await __tagHelperRunner.RunAsync(__tagHelperExecutionContext);
                if (!__tagHelperExecutionContext.Output.IsContentModified)
                {
                    await __tagHelperExecutionContext.SetOutputContentAsync();
                }
                Write(__tagHelperExecutionContext.Output);
                __tagHelperExecutionContext = __tagHelperScopeManager.End();
                EndContext();
                BeginContext(6599, 446, true);
                WriteLiteral(@"
                            </select>
                        </div>
                    </div>
                    <span id=""seatPrice""> </span>
                    <div class=""modal-footer"">
                        <button type=""button"" class=""btn btn-secondary"" data-dismiss=""modal"">Odustani</button>
                        <input type=""submit"" value=""Rezerviši"" class=""btn btn-primary""/>
                    </div>
                ");
                EndContext();
            }
                                                                        );
            __Microsoft_AspNetCore_Mvc_TagHelpers_FormTagHelper = CreateTagHelper <global::Microsoft.AspNetCore.Mvc.TagHelpers.FormTagHelper>();
            __tagHelperExecutionContext.Add(__Microsoft_AspNetCore_Mvc_TagHelpers_FormTagHelper);
            __Microsoft_AspNetCore_Mvc_TagHelpers_RenderAtEndOfFormTagHelper = CreateTagHelper <global::Microsoft.AspNetCore.Mvc.TagHelpers.RenderAtEndOfFormTagHelper>();
            __tagHelperExecutionContext.Add(__Microsoft_AspNetCore_Mvc_TagHelpers_RenderAtEndOfFormTagHelper);
            __tagHelperExecutionContext.AddHtmlAttribute(__tagHelperAttribute_1);
            __tagHelperExecutionContext.AddHtmlAttribute(__tagHelperAttribute_2);
            __Microsoft_AspNetCore_Mvc_TagHelpers_FormTagHelper.Method = (string)__tagHelperAttribute_3.Value;
            __tagHelperExecutionContext.AddTagHelperAttribute(__tagHelperAttribute_3);
            __tagHelperExecutionContext.AddHtmlAttribute(__tagHelperAttribute_4);
            await __tagHelperRunner.RunAsync(__tagHelperExecutionContext);

            if (!__tagHelperExecutionContext.Output.IsContentModified)
            {
                await __tagHelperExecutionContext.SetOutputContentAsync();
            }
            Write(__tagHelperExecutionContext.Output);
            __tagHelperExecutionContext = __tagHelperScopeManager.End();
            EndContext();
            BeginContext(7052, 88, true);
            WriteLiteral("\r\n                \r\n            </div>\r\n            \r\n        </div>\r\n    </div>\r\n</div>");
            EndContext();
        }
Example #4
0
 public AdminPanel()
 {
     InitializeComponent();
     reservationControll = new ReservationController();
     userController      = new AppUserController();
 }
        private void BookNowNxtBtn_Clicked(object sender, EventArgs e)
        {
            DateTime pickupDateTime = pickUpDate.Date + pickUpTime.Time;

            if (pickupDateTime < DateTime.Now)
            {
                PopupNavigation.Instance.PushAsync(new Error_popup("Plese check your pick-up time."));
            }

            else if (pickUpLocation.SelectedIndex == -1)
            {
                PopupNavigation.Instance.PushAsync(new Error_popup("Please select a pick-up location"));
            }
            //else if (DateTime.Now.AddHours(36) <= pickupDateTime)
            //{
            //    PopupNavigation.Instance.PushAsync(new Error_popup("Your pick up time may be no more than 36 hours from now"));
            //}
            else if (NumberOfDays.SelectedIndex == -1)
            {
                PopupNavigation.Instance.PushAsync(new Error_popup("Please select the number of days for your initial booking. You may extend your rental at any time"));
            }

            else
            {
                DateTime DropOffDateTime = pickupDateTime.AddDays(int.Parse(NumberOfDays.SelectedItem.ToString()));
                int      locId           = getLocationIdByName(pickUpLocation.SelectedItem.ToString());
                getStoreHoursMobileRequest.locationId = locId;
                try
                {
                    ReservationController reservationController = new ReservationController();
                    getStoreHoursMobileResponse = reservationController.getStoreHoursMobile(getStoreHoursMobileRequest, _token);
                }
                catch (Exception ex)
                {
                    PopupNavigation.Instance.PushAsync(new Error_popup(ex.Message));
                }
                if (getStoreHoursMobileResponse != null)
                {
                    if (getStoreHoursMobileResponse.storeHourModels != null)
                    {
                        if (getStoreHoursMobileResponse.storeHourModels.Count > 0)
                        {
                            bool      isPickUpStoreTime   = true;
                            bool      isDropOffStoreTime  = true;
                            bool      isPickUpNonHoliday  = true;
                            bool      isDropOffNonHoliday = true;
                            DayOfWeek date = (pickUpDate.Date + pickUpTime.Time).DayOfWeek;

                            foreach (SearchStoreHourModel sshm in getStoreHoursMobileResponse.storeHourModels)
                            {
                                if ((pickUpDate.Date + pickUpTime.Time).DayOfWeek.ToString() == Enum.GetName(typeof(DayOfWeek), sshm.Day - 1))
                                {
                                    if (((DateTime)sshm.StartTime).TimeOfDay <= pickUpTime.Time && pickUpTime.Time <= ((DateTime)sshm.EndTime).AddHours(-1).TimeOfDay)
                                    {
                                        if (sshm.IsHoliday)
                                        {
                                            isPickUpNonHoliday = false;
                                            PopupNavigation.Instance.PushAsync(new Error_popup("Sorry, the date you selected is a holiday. Please choose another pick up date"));
                                        }
                                        else
                                        {
                                            isPickUpNonHoliday = true;
                                            isPickUpStoreTime  = true;
                                        }
                                    }
                                    else
                                    {
                                        isPickUpStoreTime = false;
                                        PopupNavigation.Instance.PushAsync(new Error_popup("Our business hours are " + ((DateTime)sshm.StartTime).ToString("hh:mm tt") + " to " + (((DateTime)sshm.EndTime).AddHours(-1)).ToString("hh:mm tt") + ". Please select a pick up time within those hours."));
                                    }
                                }



                                //if ((DropOffDateTime).DayOfWeek.ToString() == Enum.GetName(typeof(DayOfWeek), sshm.Day-1))
                                //{
                                //    if (((DateTime)sshm.StartTime).TimeOfDay <= DropOffDateTime.TimeOfDay && DropOffDateTime.TimeOfDay <= ((DateTime)sshm.EndTime).TimeOfDay)
                                //    {

                                //        //if (sshm.IsHoliday)
                                //        //{
                                //        //    isDropOffNonHoliday = false;
                                //        //    PopupNavigation.Instance.PushAsync(new Error_popup("Sorry,your drop off date is a holiday. please choose another Drop-off date"));
                                //        //}
                                //        //else
                                //        //{
                                //        //    isDropOffNonHoliday = true;
                                //        //    isDropOffStoreTime = true;
                                //        //}

                                //        isDropOffNonHoliday = true;
                                //        isDropOffStoreTime = true;
                                //    }
                                //    else
                                //    {
                                //        isDropOffStoreTime = false;
                                //        PopupNavigation.Instance.PushAsync(new Error_popup("Sorry, we are only open during " + sshm.StartTimeStr + " to " + sshm.EndTimeStr + " Please select a different drop off time"));
                                //    }
                                //}
                            }
                            if (isPickUpStoreTime && isDropOffStoreTime && isPickUpNonHoliday && isDropOffNonHoliday)
                            {
                                navigateNextPage();
                            }
                        }
                        else
                        {
                            navigateNextPage();
                        }
                    }
                    else
                    {
                        navigateNextPage();
                    }
                }
                else
                {
                    navigateNextPage();
                }
            }
        }
        private async void Okbtng_Clicked(object sender, EventArgs e)
        {
            ReservationController           reservationController = new ReservationController();
            CancelReservationMobileResponse response = null;



            bool busy = false;

            if (!busy)
            {
                try
                {
                    busy = true;
                    await PopupNavigation.Instance.PushAsync(new LoadingPopup("Cancelling Reservation"));

                    await Task.Run(() =>
                    {
                        response = reservationController.cancelReservation(cancelReservationMobileRequest, token);
                    });
                }
                finally
                {
                    busy = false;

                    await PopupNavigation.Instance.PopAsync();

                    if (response != null)
                    {
                        if (response.message != null)
                        {
                            if (response.message.ErrorCode == "200")
                            {
                                if (response.refundStatus)
                                {
                                    if (response.ReservationNumber != null)
                                    {
                                        await PopupNavigation.Instance.PushAsync(new SuccessPopUp("Your reservation has been successfully cancelled. The balance of your payment will be refunded shortly.", 1));
                                    }
                                    else
                                    {
                                        await PopupNavigation.Instance.PushAsync(new Error_popup("Something went wrong, Please contact administrator to cancel your booking. ", 2));
                                    }
                                }
                                else
                                {
                                    if (response.ReservationNumber != null)
                                    {
                                        await PopupNavigation.Instance.PushAsync(new SuccessPopUp("Your reservation has been successfully cancelled. The balance of your payment will be refunded shortly. ", 1));
                                    }
                                    else
                                    {
                                        await PopupNavigation.Instance.PushAsync(new Error_popup("Something went wrong, Please contact administrator to cancel your booking. ", 2));
                                    }
                                }
                            }
                            else
                            {
                                await PopupNavigation.Instance.PushAsync(new Error_popup(response.message.ErrorMessage, 2));
                            }
                        }
                        else
                        {
                            await PopupNavigation.Instance.PushAsync(new Error_popup("Something went wrong, Please try again", 2));
                        }
                    }
                    else
                    {
                        await PopupNavigation.Instance.PushAsync(new Error_popup("Something went wrong, Please try again", 2));
                    }
                }
            }
        }
Example #7
0
        private void seatSelectBtn_Click(object sender, EventArgs e)
        {
            if (seatSelectBtn.Text.Equals("Select Seat"))
            {
                reloadSeat();
            }

            if (coachBox.Text.Equals("Coach"))
            {
                MessageBox.Show("Select a coach first", "Message", MessageBoxButtons.OK, MessageBoxIcon.Warning); return;
            }
            if (ticketSource.Text.Equals("From"))
            {
                MessageBox.Show("Select a source first", "Message", MessageBoxButtons.OK, MessageBoxIcon.Warning); return;
            }
            if (ticketDest.Text.Equals("To"))
            {
                MessageBox.Show("Select a destination first", "Message", MessageBoxButtons.OK, MessageBoxIcon.Warning); return;
            }

            var coachInfo = new
            {
                coach       = coachBox.Text.Trim(),
                source      = ticketSource.Text.Trim(),
                destination = ticketDest.Text.Trim(),
                date        = journeyDate.Text.Trim(),
                time        = journeyTime.Text.Trim()
            };
            var reservedCoach = ReservationController.getSingleCoachReservation(coachInfo);

            if (reservedCoach == null)
            {
                coachNameSeat.Text  = coachInfo.coach;
                bookedCount.Text    = "0";
                availableCount.Text = "40";
                foreach (var s in seatList)
                {
                    //s.Checked = false;
                    s.Enabled   = true;
                    s.BackColor = Color.Transparent;
                }
            }
            else
            {
                coachNameSeat.Text  = coachInfo.coach;
                bookedCount.Text    = reservedCoach.Booked.ToString();
                availableCount.Text = reservedCoach.Available.ToString();
                char[]   separator   = { ',' };
                string[] bookedSeats = reservedCoach.Seats.Split(separator, StringSplitOptions.RemoveEmptyEntries);

                string[] reservedSeats = reserve.Split(separator, StringSplitOptions.RemoveEmptyEntries);
                foreach (var s in seatList)
                {
                    s.Checked = false; s.Enabled = true; s.BackColor = Color.Transparent;
                }

                foreach (var s in seatList)
                {
                    foreach (var bs in bookedSeats)
                    {
                        if (s.Text.Equals(bs.Trim()))
                        {
                            s.BackColor = Color.DimGray;
                            s.Enabled   = false;
                        }
                    }
                    foreach (var rs in reservedSeats)
                    {
                        if (s.Text.Equals(rs.Trim()))
                        {
                            s.Enabled   = true;
                            s.Checked   = true;
                            s.BackColor = Color.Transparent;
                        }
                    }
                }
            }
            trashSeat.Visible = false;
            seatPanel.Show();
        }