Exemple #1
0
        public void GetSessionDetail_ShouldGetBrowserStackSessionDetailWhenStatusIsOk()
        {
            // Arrange
            var          sessionId   = Guid.NewGuid().ToString();
            const string baseAddress = "http://some/address";
            var          client      = Substitute.For <IHttpClient>();

            _clientFactory.Create(baseAddress).Returns(client);
            var session = new SessionDetail {
                AutomationSession = new AutomationSession {
                    Name = "blah"
                }
            };
            var content = new ObjectContent <SessionDetail>(session, new JsonMediaTypeFormatter());

            _configurationProvider.BrowserStackApiUrl.Returns(baseAddress);
            client
            .GetAsync($"sessions/{sessionId}.json")
            .Returns(Task.FromResult(new HttpResponseMessage(HttpStatusCode.OK)
            {
                Content = content
            }));


            // Act
            var result = _sut.GetSessionDetail(sessionId);

            // Assert
            result.Should().BeSameAs(session.AutomationSession);
            client.Received().GetFormatters();
        }
Exemple #2
0
        public async Task AddScan(string userSessionId, byte[] imageData)
        {
            //var taskResult = await BatchAnalyzeAsync(imageData);
            //taskResult.EnsureSuccessStatusCode();
            File.WriteAllBytes("screenshot.png", imageData);

            var ocrResult = new OcrResult();

            // Analyze an image to get features and other properties.
            using (var client = Authenticate(GetOcrEndpoint(null), _azureSettings.ApiKey))
                using (var memStream = new MemoryStream(imageData))
                {
                    var recognizePrintedTextResult = await client.RecognizePrintedTextInStreamAsync(true, memStream);

                    ObjectId sessionId         = ObjectId.Parse(userSessionId);
                    var      userSessionResult = await _userSessionRepository.GetUserSessionByUserSessionId(sessionId);

                    ObjectId modifiedById  = userSessionResult.ModifiedById;
                    var      sessionDetail = new SessionDetail()
                    {
                        Id           = ObjectId.GenerateNewId(),
                        SessionId    = sessionId,
                        ModifiedById = modifiedById,

                        PrintedTextResult = recognizePrintedTextResult
                    };

                    await _sessionDetailRepository.UpsertSessionDetail(sessionDetail);
                }

            return;
        }
Exemple #3
0
        public async Task GivesBackForecastMatchingRequestedInterval()
        {
            var sessionData = new SessionDetail {
                DataSetName = "HourlyNetTest"
            };

            sessionData.Columns.Add("value", new ColumnMetadata {
                DataType = ColumnType.Numeric, Role = ColumnRole.Target
            });
            await fixture.Client.DataSets.Create(DataSet.From(sessionData.DataSetName, new StreamReader(File.OpenRead("csvfiles/sensor2.csv"))));

            var session = await fixture.Client.Sessions.CreateForecast(Sessions.Forecast(sessionData.DataSetName, DateTime.Parse("2017-01-08"), DateTime.Parse("2017-01-09"), ResultInterval.Hour));

            while (true)
            {
                var status = await fixture.Client.Sessions.GetStatus(session.SessionId);

                if (status.Status == Status.Completed)
                {
                    break;
                }
                Thread.Sleep(5000);
            }

            var results = await fixture.Client.Sessions.GetResults(session.SessionId);

            Assert.NotNull(results);
            var date1 = DateTimeOffset.Parse(results.Data[0]["timeStamp"]);
            var date2 = DateTimeOffset.Parse(results.Data[1]["timeStamp"]);

            Assert.Equal(1, (date2 - date1).Hours);
            await fixture.Client.DataSets.Remove(new DataSetRemoveCriteria(sessionData.DataSetName){ Options = DataSetDeleteOptions.CascadeAll });
        }
        public ActionResult WithoutEditorTemplates()
        {
            SessionDetail details = new SessionDetail {
                sessions = repo.GetSessions()
            };

            return(View(details));
        }
        public Task <SessionResponse> CreateForecast(SessionDetail data, DateTimeOffset startDate, DateTimeOffset endDate, ResultInterval resultInterval,
                                                     string statusCallbackUrl, Action <HttpRequestMessage, HttpResponseMessage> httpMessageTransformer, CancellationToken cancellationToken)
        {
            Argument.IsNotNull(data, nameof(data));
            Argument.IsNotNullOrEmpty(data.DataSetName, "data.DataSetName");

            return(CreateSessionInternal("sessions/forecast", data, null /* eventName */, startDate, endDate, resultInterval, statusCallbackUrl, httpMessageTransformer, cancellationToken, isEstimate: false));
        }
        public Task <SessionResponse> EstimateImpact(SessionDetail data, string eventName, DateTimeOffset startDate, DateTimeOffset endDate,
                                                     ResultInterval resultInterval, Action <HttpRequestMessage, HttpResponseMessage> httpMessageTransformer, CancellationToken cancellationToken)
        {
            Argument.IsNotNull(data, nameof(data));
            Argument.IsNotNullOrEmpty(data.DataSetName, "data.DataSetName");
            Argument.IsNotNullOrEmpty(eventName, nameof(eventName));

            return(CreateSessionInternal("sessions/impact", data, eventName, startDate, endDate, resultInterval, null, httpMessageTransformer, cancellationToken, isEstimate: true));
        }
Exemple #7
0
        /// <summary>
        /// Fired when the timer period elapses.
        /// </summary>
        /// <param name="sender">The sender.</param>
        /// <param name="e">The event arguments.</param>
        private void TimerTick(object sender, EventArgs e)
        {
            SessionDetailProvider provider;
            SessionDetail         data = null;
            string largeImageKey;
            string largeImageText;
            string smallImageKey;
            string smallImageText;


            provider       = new SessionDetailProvider();
            largeImageKey  = null;
            largeImageText = null;
            smallImageKey  = null;
            smallImageText = null;

            var t = Task.Run(async() => {
                data = await provider.GetPlayerCountAsync(_sessionName);
            });

            t.Wait();

            if (data != null)
            {
                if (IsValidSessionDate(data.date))
                {
                    _presence.details = $"{data.pc} players in session";
                }
                else
                {
                    _presence.details = "Session data out of date";
                }
            }
            else
            {
                _presence.details = $"Error communicating with session";
            }

            var dispatcher = Application.Current.Dispatcher;

            dispatcher.Invoke(() => {
                largeImageKey  = TextBox_largeImageKey.Text;
                largeImageText = TextBox_largeImageText.Text;
                smallImageKey  = TextBox_smallImageKey.Text;
                smallImageText = TextBox_smallImageText.Text;
            });

            _presence.state          = "Time until next update:";
            _presence.startTimestamp = (long)(DateTime.UtcNow.Subtract(new DateTime(1970, 1, 1))).TotalSeconds;
            _presence.endTimestamp   = (long)(DateTime.UtcNow.AddSeconds(30).Subtract(new DateTime(1970, 1, 1))).TotalSeconds;
            _presence.largeImageKey  = string.IsNullOrEmpty(largeImageKey) ? "" : largeImageKey;
            _presence.largeImageText = string.IsNullOrEmpty(largeImageText) ? "" : largeImageText;
            _presence.smallImageKey  = string.IsNullOrEmpty(smallImageKey) ? "" : smallImageKey;
            _presence.smallImageText = string.IsNullOrEmpty(smallImageText) ? "" : smallImageText;

            DiscordRpc.UpdatePresence(ref _presence);
        }
        public ActionResult ThePostAction(SessionDetail details)
        {
            if (details.sessions is null)
            {
                return(View("~/Views/Shared/Error.cshtml"));
            }
            List <Session> chosenSessions = details != null?details.sessions.Where(m => m.IsSignedUp).ToList() : new List <Session>();

            return(Receipt(chosenSessions));
        }
        public void GivenANutritionistLoggedIn()
        {
            //Variable setup:
            userRepositoryMock    = new Mock <IUserRepository>();
            unitofworkMock        = new Mock <IUnitOfWork>();
            sessionRepositoryMock = new Mock <ISessionRepository>();
            nutritionistRole      = new Role
            {
                Id   = 3,
                Name = "Nutricionista"
            };
            patientRole = new Role
            {
                Id   = 2,
                Name = "Paciente"
            };
            nutritionistUser = new User
            {
                Id   = 1,
                Role = nutritionistRole
            };
            patientUser = new User
            {
                Id   = 2,
                Role = patientRole
            };

            diet = new Diet
            {
                Id          = 1,
                Description = "Una dieta",
                Title       = "Dieta 1"
            };

            sessionDetail = new SessionDetail
            {
                Id      = 1,
                Session = session,
                User    = patientUser
            };

            session = new Session
            {
                Id    = 1,
                Diets = new List <Diet> {
                    diet
                },
                Link           = "link",
                User           = nutritionistUser,
                SessionDetails = new List <SessionDetail> {
                    sessionDetail
                }
            };
        }
Exemple #10
0
        protected DataProviderState dataProviderState;  // current state of our DataProvider ('READY' means the DataProvider is ready to use).

        protected DataProviderBase()
        {
            prop = new KeyValueCollection(PropertyNames);

            tradeCycle         = null;
            previousTradeCycle = null;
            sessionDetail      = null;

            // Assume we are in the READY state. Any data provider that is not in the READY state
            // when it starts up should change the dataProviderState value in its constructor.
            dataProviderState = DataProviderState.READY;
        }
        public async Task<SessionDetailResponse> SaveAsync(SessionDetail sessionDetail)
        {
            try
            {
                await _sessionDetailRepository.AddAsync(sessionDetail);
                await _unitOfWork.CompleteAsync();

                return new SessionDetailResponse(sessionDetail);
            }
            catch (Exception ex)
            {
                return new SessionDetailResponse($"An error ocurred while saving sessionDetail: {ex.Message}");
            }
        }
Exemple #12
0
        public virtual AutomationSession GetSessionDetail(string sessionId)
        {
            var result = new SessionDetail();

            using (var client = _clientFactory.Create(_configurationProvider.BrowserStackApiUrl))
            {
                var response = client.GetAsync(GetSessionRelativeUrl(sessionId)).Result;
                if (response.IsSuccessStatusCode)
                {
                    result = response.Content.ReadAsAsync <SessionDetail>(client.GetFormatters()).Result;
                }
            }
            return(result.AutomationSession);
        }
Exemple #13
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);
            var extras = Intent.Extras;

            if (extras != null)
            {
                //Get vars from bundle
                var sessionId = extras.GetInt("Id");
                cts.Cancel();
                //Get the Session Details
                session = Services.Session.GetSession(sessionId);
                SetToolbarColor(ListBaseAdapter.GetColor(session.Type.Length));
                UpdateFields();
                cts.Cancel();
            }
        }
Exemple #14
0
        public ActionResult SessionDetail(int?id)
        {
            var           DateNow  = DateTime.Now.ToString("dd.MM.yyyy");
            var           ListSS   = db.Sessions.Where(s => s.ClazzId == id).ToList();
            SessionDetail SSDetail = null;

            foreach (var item in ListSS)
            {
                var ListSSDetail = db.SessionDetails.Where(ss => ss.SessionId == item.SessionId).ToList();
                foreach (SessionDetail detail in ListSSDetail)
                {
                    var rsStatus = detail.Status.Equals(Models.SessionDetail.SessionDetailStatus.DONE);
                    var date     = detail.DateStart.ToString("dd.MM.yyyy");
                    if (date == DateNow && rsStatus == false)
                    {
                        TimeSpan TimeStart  = item.StartTime;
                        TimeSpan FinishTime = item.FinishTime;
                        TimeSpan TimeNow    = DateTime.Now.TimeOfDay;

                        int rs1 = TimeSpan.Compare(TimeNow, TimeStart);
                        int rs2 = TimeSpan.Compare(TimeNow, FinishTime);

                        if (rs1 == 1 && rs2 == -1)
                        {
                            detail.Status  = Models.SessionDetail.SessionDetailStatus.ONGOING;
                            ViewBag.Attend = 1;
                            db.SaveChanges();
                        }
                        else
                        {
                            ViewBag.Attend = 0;
                        }

                        SSDetail = detail;
                        return(View(SSDetail));
                    }
                    else
                    {
                        SSDetail = null;
                    }
                }
            }
            return(View(SSDetail));
        }
        public Task <SessionResponse> CreateForecast(string dataSetName, string targetColumn, DateTimeOffset startDate, DateTimeOffset endDate, ResultInterval resultInterval,
                                                     string statusCallbackUrl, Action <HttpRequestMessage, HttpResponseMessage> httpMessageTransformer, CancellationToken cancellationToken)
        {
            Argument.IsNotNullOrEmpty(dataSetName, nameof(dataSetName));
            Argument.IsNotNullOrEmpty(targetColumn, nameof(targetColumn));

            var data = new SessionDetail
            {
                DataSetName = dataSetName,
                Columns     = new Dictionary <string, ColumnMetadata>()
                {
                    { targetColumn, new ColumnMetadata {
                          Role = ColumnRole.Target
                      } }
                }
            };

            return(CreateForecast(data, startDate, endDate, resultInterval, statusCallbackUrl, httpMessageTransformer, cancellationToken));
        }
        public async Task<SessionDetailResponse> UpdateAsync(int userId, SessionDetail sessionDetail)
        {
            var existingSessionDetail = await _sessionDetailRepository.FindById(userId);
            if (existingSessionDetail == null)
                return new SessionDetailResponse("SessionDetail not found");

            existingSessionDetail.State = sessionDetail.State;

            try
            {
                _sessionDetailRepository.Update(existingSessionDetail);
                await _unitOfWork.CompleteAsync();

                return new SessionDetailResponse(existingSessionDetail);
            }
            catch (Exception ex)
            {
                return new SessionDetailResponse($"An error ocurred while updating SessionDetail: {ex.Message}");
            }
        }
        public SessionDetail GetSessionByID(int id)
        {
            using (var db = new ApplicationDbContext())
            {
                var entity = db.Sessions.Single(s => s.SessionID == id);

                var model = new SessionDetail
                {
                    SessionID     = entity.SessionID,
                    SessionTypeID = entity.SessionTypeID,
                    Name          = entity.SessionType.Name,
                    StartTime     = entity.StartTime,
                    EndTime       = entity.EndTime,
                    CreatedUtc    = entity.CreatedUtc,
                    ModifiedUtc   = entity.ModifiedUtc,
                    Extras        = entity.Extras,
                    Price         = entity.Price
                };
                return(model);
            }
        }
        private Task <SessionResponse> CreateSessionInternal(string path, SessionDetail data, string eventName, DateTimeOffset startDate, DateTimeOffset endDate,
                                                             ResultInterval resultInterval, string statusCallbackUrl, Action <HttpRequestMessage, HttpResponseMessage> httpMessageTransformer, CancellationToken cancellationToken, bool isEstimate)
        {
            var parameters = new Dictionary <string, string>
            {
                { "dataSetName", data.DataSetName },
                { nameof(startDate), startDate.ToString("O") },
                { nameof(endDate), endDate.ToString("O") },
                { nameof(isEstimate), isEstimate.ToString().ToLowerInvariant() },
                { nameof(resultInterval), resultInterval.ToString().ToLowerInvariant() }
            };

            if (!string.IsNullOrEmpty(eventName))
            {
                parameters.Add(nameof(eventName), eventName);
            }
            if (!string.IsNullOrEmpty(statusCallbackUrl))
            {
                parameters.Add("callbackUrl", statusCallbackUrl);
            }
            return(apiConnection.Post <SessionResponse>(path, parameters, data, httpMessageTransformer, cancellationToken));
        }
Exemple #19
0
        public async Task ForecastStartsNewSession()
        {
            var dataSetName = $"testDataSet-{DateTime.Now:s}";
            var dataSet     = DataSetGenerator.Run(DateTime.Parse("2016-08-01"), DateTime.Parse("2017-03-26"), "instances");
            await fixture.Client.DataSets.Create(dataSetName, dataSet);

            var sessionRequest = new SessionDetail()
            {
                DataSetName = dataSetName,
                Columns     = new Dictionary <string, ColumnMetadata>()
                {
                    ["instances"] =
                        new ColumnMetadata()
                    {
                        DataType = ColumnType.NumericMeasure, Role = ColumnRole.Target
                    }
                }
            };

            var actual = await fixture.Client.Sessions.CreateForecast(sessionRequest, DateTimeOffset.Parse("2017-03-26"), DateTimeOffset.Parse("2017-04-25"), ResultInterval.Day);

            Assert.NotNull(actual.SessionId);
            await fixture.Client.DataSets.Remove(dataSetName, DataSetDeleteOptions.CascadeAll);
        }
 public Task <SessionResponse> EstimateForecast(SessionDetail data, DateTimeOffset startDate, DateTimeOffset endDate, ResultInterval resultInterval,
                                                Action <HttpRequestMessage, HttpResponseMessage> httpMessageTransformer)
 {
     return(EstimateForecast(data, startDate, endDate, resultInterval, httpMessageTransformer, CancellationToken.None));
 }
 public Task <SessionResponse> EstimateImpact(SessionDetail data, string eventName, DateTimeOffset startDate,
                                              DateTimeOffset endDate, ResultInterval resultInterval)
 {
     return(EstimateImpact(data, eventName, startDate, endDate, resultInterval, null));
 }
 public Task <SessionResponse> CreateForecast(SessionDetail data, DateTimeOffset startDate, DateTimeOffset endDate, ResultInterval resultInterval,
                                              string statusCallbackUrl)
 {
     return(CreateForecast(data, startDate, endDate, resultInterval, statusCallbackUrl, null));
 }
 public Task <SessionResponse> AnalyzeImpact(SessionDetail data, string eventName, DateTimeOffset startDate,
                                             DateTimeOffset endDate, ResultInterval resultInterval, string statusCallbackUrl)
 {
     return(AnalyzeImpact(data, eventName, startDate, endDate, resultInterval, statusCallbackUrl, null));
 }
 public void Remove(SessionDetail sessionDetail)
 {
     _context.SessionDetails.Remove(sessionDetail);
 }
 public Task <SessionResponse> AnalyzeImpact(SessionDetail data, string eventName, DateTimeOffset startDate,
                                             DateTimeOffset endDate, ResultInterval resultInterval, string statusCallbackUrl, Action <HttpRequestMessage, HttpResponseMessage> httpMessageTransformer)
 {
     return(AnalyzeImpact(data, eventName, startDate, endDate, resultInterval, statusCallbackUrl, httpMessageTransformer, CancellationToken.None));
 }
            /// <summary>
            /// Post process payment (used by payment gateways that require redirecting to a third-party URL)
            /// </summary>
            /// <param name="postProcessPaymentRequest">Payment info required for an order processing</param>
            public void PostProcessPaymentDistributedOrder(PostProcessTransactionPaymentRequest postProcessPaymentRequest)
            {

                PGResponse objPGResponse = new PGResponse();
                CustomerDetails oCustomer = new CustomerDetails();
                SessionDetail oSession = new SessionDetail();
                AirLineTransaction oAirLine = new AirLineTransaction();
                MerchanDise oMerchanDise = new MerchanDise();

                SFA.CardInfo objCardInfo = new SFA.CardInfo();

                SFA.Merchant objMerchant = new SFA.Merchant();

                ShipToAddress objShipToAddress = new ShipToAddress();
                BillToAddress oBillToAddress = new BillToAddress();
                ShipToAddress oShipToAddress = new ShipToAddress();
                MPIData objMPI = new MPIData();
                PGReserveData oPGreservData = new PGReserveData();
                Address oHomeAddress = new Address();
                Address oOfficeAddress = new Address();
                // For getting unique MerchantTxnID 
                // Only for testing purpose. 
                // In actual scenario the merchant has to pass his transactionID
                DateTime oldTime = new DateTime(1970, 01, 01, 00, 00, 00);
                DateTime currentTime = DateTime.Now;
                TimeSpan structTimespan = currentTime - oldTime;
                string lMrtTxnID = ((long)structTimespan.TotalMilliseconds).ToString();
                var merchantId = _EmiPaymentSettings.MerchantId.ToString();
                var orderId = postProcessPaymentRequest.CurrentOrderTransaction.TransactionId;
                var Id = orderId.ToString();
                var amount = postProcessPaymentRequest.CurrentOrderTransaction.TransactionAmount.ToString(new CultureInfo("en-US", false).NumberFormat);


                //Setting Merchant Details
                objMerchant.setMerchantDetails(merchantId, merchantId, merchantId, "", lMrtTxnID, Id, "https://www.laorigin.com/PaymentEmi/ReturnDistributedOrder?orderId=" + Id, "POST", "INR", "INV123", "req.Sale", amount, "GMT+05:30", "ASP.NET64", "true", "ASP.NET64", "ASP.NET64", "ASP.NET64");

                // Setting BillToAddress Details
                oBillToAddress.setAddressDetails(postProcessPaymentRequest.Order.CustomerId.ToString(),
                                                   postProcessPaymentRequest.Order.Customer.SystemName,
                                                postProcessPaymentRequest.Order.BillingAddress.Address1,
                                                 postProcessPaymentRequest.Order.BillingAddress.Address2,
                                                 "",
                                                  postProcessPaymentRequest.Order.BillingAddress.City,
                                                 postProcessPaymentRequest.Order.BillingAddress.StateProvince.Name
                                                 , postProcessPaymentRequest.Order.BillingAddress.ZipPostalCode,
                                                 postProcessPaymentRequest.Order.BillingAddress.Country.Name,
                                                  postProcessPaymentRequest.Order.Customer.Email);

                // Setting ShipToAddress Details
                oShipToAddress.setAddressDetails(postProcessPaymentRequest.Order.BillingAddress.Address1,
                                                postProcessPaymentRequest.Order.BillingAddress.Address2,
                                                "",
                                                postProcessPaymentRequest.Order.BillingAddress.City,
                                                postProcessPaymentRequest.Order.BillingAddress.StateProvince.Name,

                                                postProcessPaymentRequest.Order.BillingAddress.ZipPostalCode,
                                                postProcessPaymentRequest.Order.BillingAddress.Country.Name,
                                                postProcessPaymentRequest.Order.Customer.Email);

                //Setting MPI datails.
                //objMPI.setMPIRequestDetails ("1000","INR10.00","356","2","2 shirts","","","","0","","image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/vnd.ms-powerpoint, application/vnd.ms-excel, application/msword, application/x-shockwave-flash, */*","Mozilla/4.0 (compatible; MSIE 5.5; Windows NT 5.0)");

                // Setting Name home/office Address Details 
                // Order of Parameters =>        AddLine1, AddLine2,      AddLine3,   City,   State ,  Zip,          Country, Email id
                oHomeAddress.setAddressDetails("2Sandeep", "Uttam Corner", "Chinchwad", "Pune", "state", "4385435873", "IND", "*****@*****.**");

                // Order of Parameters =>        AddLine1, AddLine2,      AddLine3,   City,   State ,  Zip,          Country, Email id
                oOfficeAddress.setAddressDetails("2Opus", "MayFairTowers", "Wakdewadi", "Pune", "state", "4385435873", "IND", "*****@*****.**");

                // Stting  Customer Details 
                // Order of Parameters =>  First Name,LastName ,Office Address Object,Home Address Object,Mobile No,RegistrationDate, flag for matching bill to address and ship to address 
                oCustomer.setCustomerDetails(postProcessPaymentRequest.Order.Customer.SystemName, "", oOfficeAddress, oHomeAddress, "", "13-06-2007", "Y");

                //Setting Merchant Dise Details 
                // Order of Parameters =>       Item Purchased,Quantity,Brand,ModelNumber,Buyers Name,flag value for matching CardName and BuyerName
                oMerchanDise.setMerchanDiseDetails("Computer", "2", "Intel", "P4", "Sandeep Patil", "Y");

                //Setting  Session Details        
                // Order of Parameters =>     Remote Address, Cookies Value            Browser Country,Browser Local Language,Browser Local Lang Variant,Browser User Agent'
                oSession.setSessionDetails(getRemoteAddr(), getSecureCookie(HttpContext.Current.Request), "", HttpContext.Current.Request.ServerVariables["HTTP_ACCEPT_LANGUAGE"], "", HttpContext.Current.Request.ServerVariables["HTTP_USER_AGENT"]);

                //Settingr AirLine Transaction Details  
                //Order of Parameters =>               Booking Date,FlightDate,Flight   Time,Flight Number,Passenger Name,Number Of Tickets,flag for matching card name and customer name,PNR,sector from,sector to'
                oAirLine.setAirLineTransactionDetails("10-06-2007", "22-06-2007", "13:20", "119", "Sandeep", "1", "Y", "25c", "Pune", "Mumbai");

                SFAClient objSFAClient = new SFAClient("c:\\inetpub\\wwwroot\\SFAClient\\Config\\");
                objPGResponse = objSFAClient.postSSL(objMPI, objMerchant, oBillToAddress, oShipToAddress, oPGreservData, oCustomer, oSession, oAirLine, oMerchanDise);

                if (objPGResponse.RedirectionUrl != "" & objPGResponse.RedirectionUrl != null)
                {
                    string strResponseURL = objPGResponse.RedirectionUrl;
                    HttpContext.Current.Response.Redirect(strResponseURL);
                }
                else
                {
                    HttpContext.Current.Response.Write("Response Code:" + objPGResponse.RespCode);
                    HttpContext.Current.Response.Write("Response message:" + objPGResponse.RespMessage);
                }
            }
Exemple #27
0
 public async Task InitializeAESEngine(IStartupLoader sl)
 {
     DataUsage.safeReloadPlugins();
     SessionDetail.setSession();
 }
        /// <summary>
        /// Post process payment (used by payment gateways that require redirecting to a third-party URL)
        /// </summary>
        /// <param name="postProcessPaymentRequest">Payment info required for an order processing</param>
        public void PostProcessPaymentDistributedOrder(PostProcessTransactionPaymentRequest postProcessPaymentRequest)
        {
            PGResponse         objPGResponse = new PGResponse();
            CustomerDetails    oCustomer     = new CustomerDetails();
            SessionDetail      oSession      = new SessionDetail();
            AirLineTransaction oAirLine      = new AirLineTransaction();
            MerchanDise        oMerchanDise  = new MerchanDise();

            SFA.CardInfo objCardInfo = new SFA.CardInfo();

            SFA.Merchant objMerchant = new SFA.Merchant();

            ShipToAddress objShipToAddress = new ShipToAddress();
            BillToAddress oBillToAddress   = new BillToAddress();
            ShipToAddress oShipToAddress   = new ShipToAddress();
            MPIData       objMPI           = new MPIData();
            PGReserveData oPGreservData    = new PGReserveData();
            Address       oHomeAddress     = new Address();
            Address       oOfficeAddress   = new Address();
            // For getting unique MerchantTxnID
            // Only for testing purpose.
            // In actual scenario the merchant has to pass his transactionID
            DateTime oldTime        = new DateTime(1970, 01, 01, 00, 00, 00);
            DateTime currentTime    = DateTime.Now;
            TimeSpan structTimespan = currentTime - oldTime;
            string   lMrtTxnID      = ((long)structTimespan.TotalMilliseconds).ToString();
            var      merchantId     = _EmiPaymentSettings.MerchantId.ToString();
            var      orderId        = postProcessPaymentRequest.CurrentOrderTransaction.TransactionId;
            var      Id             = orderId.ToString();
            var      amount         = postProcessPaymentRequest.CurrentOrderTransaction.TransactionAmount.ToString(new CultureInfo("en-US", false).NumberFormat);


            //Setting Merchant Details
            objMerchant.setMerchantDetails(merchantId, merchantId, merchantId, "", lMrtTxnID, Id, "https://www.laorigin.com/PaymentEmi/ReturnDistributedOrder?orderId=" + Id, "POST", "INR", "INV123", "req.Sale", amount, "GMT+05:30", "ASP.NET64", "true", "ASP.NET64", "ASP.NET64", "ASP.NET64");

            // Setting BillToAddress Details
            oBillToAddress.setAddressDetails(postProcessPaymentRequest.Order.CustomerId.ToString(),
                                             postProcessPaymentRequest.Order.Customer.SystemName,
                                             postProcessPaymentRequest.Order.BillingAddress.Address1,
                                             postProcessPaymentRequest.Order.BillingAddress.Address2,
                                             "",
                                             postProcessPaymentRequest.Order.BillingAddress.City,
                                             postProcessPaymentRequest.Order.BillingAddress.StateProvince.Name
                                             , postProcessPaymentRequest.Order.BillingAddress.ZipPostalCode,
                                             postProcessPaymentRequest.Order.BillingAddress.Country.Name,
                                             postProcessPaymentRequest.Order.Customer.Email);

            // Setting ShipToAddress Details
            oShipToAddress.setAddressDetails(postProcessPaymentRequest.Order.BillingAddress.Address1,
                                             postProcessPaymentRequest.Order.BillingAddress.Address2,
                                             "",
                                             postProcessPaymentRequest.Order.BillingAddress.City,
                                             postProcessPaymentRequest.Order.BillingAddress.StateProvince.Name,

                                             postProcessPaymentRequest.Order.BillingAddress.ZipPostalCode,
                                             postProcessPaymentRequest.Order.BillingAddress.Country.Name,
                                             postProcessPaymentRequest.Order.Customer.Email);

            //Setting MPI datails.
            //objMPI.setMPIRequestDetails ("1000","INR10.00","356","2","2 shirts","","","","0","","image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/vnd.ms-powerpoint, application/vnd.ms-excel, application/msword, application/x-shockwave-flash, */*","Mozilla/4.0 (compatible; MSIE 5.5; Windows NT 5.0)");

            // Setting Name home/office Address Details
            // Order of Parameters =>        AddLine1, AddLine2,      AddLine3,   City,   State ,  Zip,          Country, Email id
            oHomeAddress.setAddressDetails("2Sandeep", "Uttam Corner", "Chinchwad", "Pune", "state", "4385435873", "IND", "*****@*****.**");

            // Order of Parameters =>        AddLine1, AddLine2,      AddLine3,   City,   State ,  Zip,          Country, Email id
            oOfficeAddress.setAddressDetails("2Opus", "MayFairTowers", "Wakdewadi", "Pune", "state", "4385435873", "IND", "*****@*****.**");

            // Stting  Customer Details
            // Order of Parameters =>  First Name,LastName ,Office Address Object,Home Address Object,Mobile No,RegistrationDate, flag for matching bill to address and ship to address
            oCustomer.setCustomerDetails(postProcessPaymentRequest.Order.Customer.SystemName, "", oOfficeAddress, oHomeAddress, "", "13-06-2007", "Y");

            //Setting Merchant Dise Details
            // Order of Parameters =>       Item Purchased,Quantity,Brand,ModelNumber,Buyers Name,flag value for matching CardName and BuyerName
            oMerchanDise.setMerchanDiseDetails("Computer", "2", "Intel", "P4", "Sandeep Patil", "Y");

            //Setting  Session Details
            // Order of Parameters =>     Remote Address, Cookies Value            Browser Country,Browser Local Language,Browser Local Lang Variant,Browser User Agent'
            oSession.setSessionDetails(getRemoteAddr(), getSecureCookie(HttpContext.Current.Request), "", HttpContext.Current.Request.ServerVariables["HTTP_ACCEPT_LANGUAGE"], "", HttpContext.Current.Request.ServerVariables["HTTP_USER_AGENT"]);

            //Settingr AirLine Transaction Details
            //Order of Parameters =>               Booking Date,FlightDate,Flight   Time,Flight Number,Passenger Name,Number Of Tickets,flag for matching card name and customer name,PNR,sector from,sector to'
            oAirLine.setAirLineTransactionDetails("10-06-2007", "22-06-2007", "13:20", "119", "Sandeep", "1", "Y", "25c", "Pune", "Mumbai");

            SFAClient objSFAClient = new SFAClient("c:\\inetpub\\wwwroot\\SFAClient\\Config\\");

            objPGResponse = objSFAClient.postSSL(objMPI, objMerchant, oBillToAddress, oShipToAddress, oPGreservData, oCustomer, oSession, oAirLine, oMerchanDise);

            if (objPGResponse.RedirectionUrl != "" & objPGResponse.RedirectionUrl != null)
            {
                string strResponseURL = objPGResponse.RedirectionUrl;
                HttpContext.Current.Response.Redirect(strResponseURL);
            }
            else
            {
                HttpContext.Current.Response.Write("Response Code:" + objPGResponse.RespCode);
                HttpContext.Current.Response.Write("Response message:" + objPGResponse.RespMessage);
            }
        }
Exemple #29
0
 private void internal_InitSession()
 {
     sessionDetails = new SessionDetail();
     sessionEnded   = false;
 }
 public void Update(SessionDetail sessionDetail)
 {
     _context.SessionDetails.Update(sessionDetail);
 }
 public async Task AddAsync(SessionDetail sessionDetail)
 {
     await _context.SessionDetails.AddAsync(sessionDetail);
 }