예제 #1
0
        public void CallServiceReturningSession2TimesFor2Channels_sessionAreDifferentForDifferentChannels()
        {
            var address = @"net.pipe://127.0.0.1/1/test.test/test" + MethodBase.GetCurrentMethod().Name;

            var serv = new SessionService();
            var host = new ServiceHost(serv, new Uri(address));
            var b = new NetNamedPipeBinding();
            host.AddServiceEndpoint(typeof(ISessionService), b, address);
            var f1 = new ChannelFactory<ISessionService>(b);
            var f2 = new ChannelFactory<ISessionService>(b);
            var client1 = f1.CreateChannel(new EndpointAddress(address));
            var client2 = f2.CreateChannel(new EndpointAddress(address));
            host.Open();

            var session11 = client1.Call();
            var session21 = client2.Call();
            var session22 = client2.Call();
            var session12 = client1.Call();

            f1.Dispose();
            f2.Dispose();
            host.Dispose();
            Assert.AreEqual(session11, session12);
            Assert.AreEqual(session21, session22);
            Assert.AreNotEqual(session11, session21);
        }
        /// <summary>
        /// Create all your controls here for rendering.
        /// Try to avoid using the RenderWebPart() method.
        /// </summary>
        protected override void CreateChildControls()
        {
            if (!_error)
            {
                try
                {
                    base.CreateChildControls();

                    // Get the session token
                    ISessionService sessionService = new SessionService(Utilities.ApiProvider);
                    Domain.Session session = sessionService.GetToken("/");

                    string buttonUri = session.ReturnURL;

                    // Create the container control
                    HtmlGenericControl containerControl = new HtmlGenericControl("div");
                    this.Controls.Add(containerControl);

                    // Create the button control
                    HtmlGenericControl buttonControl = new HtmlGenericControl("input");
                    buttonControl.Attributes["type"] = "button";
                    buttonControl.Attributes["onclick"] = "javascript:location.href='" + buttonUri + "';";
                    buttonControl.Attributes["value"] = (!String.IsNullOrEmpty(_buttonValue) ? _buttonValue.Replace("\"", "&quot;") : "Launch");
                    containerControl.Controls.Add(buttonControl);
                }
                catch (Exception ex)
                {
                    HandleException(ex);
                }
            }
        }
        public EsendexSmsFacade(string account, string username, string password)
        {
            var sessionService = new SessionService();
            Guid sessionId = sessionService.GetSessionID(username, password);

            _messageDispatcherService = new MessageDispatcherService(account, sessionId);
        }
예제 #4
0
        /// <summary>
        /// Create all your controls here for rendering.
        /// Try to avoid using the RenderWebPart() method.
        /// </summary>
        protected override void CreateChildControls()
        {
            if (!_error)
            {
                try
                {
                    base.CreateChildControls();

                    // Parse any given 23_return_url path
                    NameValueCollection query = Page.Request.QueryString;

                    var returnUrl = "/";

                    if (!String.IsNullOrEmpty(query.Get("23_return_url")))
                    {
                        returnUrl = query.Get("23_return_url");
                    }

                    // Get the session token
                    ISessionService sessionService = new SessionService(Utilities.ApiProvider);
                    Domain.Session session = sessionService.GetToken(returnUrl, null, null);

                    string iframeUri = session.ReturnURL;

                    // Build the width and height
                    string width = (String.IsNullOrEmpty(Width.ToString()) ? "100%" : Width.ToString());
                    string height = (String.IsNullOrEmpty(Height.ToString()) ? "100%" : Height.ToString());

                    // Create the container control
                    HtmlGenericControl ContainerControl = new HtmlGenericControl("div");
                    ContainerControl.Attributes["width"] = width;
                    ContainerControl.Attributes["height"] = height;
                    this.Controls.Add(ContainerControl);

                    // Create the inline frame control
                    HtmlGenericControl InlineFrameControl = new HtmlGenericControl("iframe");
                    InlineFrameControl.Attributes["width"] = width;
                    InlineFrameControl.Attributes["height"] = height;
                    InlineFrameControl.Attributes["src"] = iframeUri;
                    InlineFrameControl.Attributes["style"] = _inlineStyle;
                    InlineFrameControl.Attributes["frameborder"] = "0";
                    ContainerControl.Controls.Add(InlineFrameControl);
                }
                catch (Exception ex)
                {
                    HandleException(ex);
                }
            }
        }
예제 #5
0
        public ActionResult <ScriptSession> Get()
        {
            return(Execute(() =>
            {
                ScriptSession pythonSession = SessionService.CreateSession();

                ExpireSessionTimer sessionTimer = new ExpireSessionTimer(pythonSession, SettingsProvider.SessionLifetime);
                Sessions.Add(pythonSession.Id, sessionTimer);
                sessionTimer.Start();

                Log.Information($"Request new session DONE. Created session with ID '{pythonSession.Id}' and expire date '{pythonSession.ExpireDate.ToLongTimeString()}'");

                return Ok(pythonSession);
            }));
        }
예제 #6
0
        public async Task <ResultReturn <IEnumerable <DTO_SessionMessage> > > GetMessages(
            [FromServices] MessageService message,
            [FromServices] SessionService session,
            [FromQuery] long sessionId,
            [FromQuery] long lastMessageId = -1)
        {
            if (!await session.IsUserExistsInSession(sessionId, CurrentUserId))
            {
                return(new FailResultReturn <IEnumerable <DTO_SessionMessage> >("无效sessionId"));
            }

            var lst = await message.GetSessionMessage(sessionId, lastMessageId);

            return(new SuccessResultReturn <IEnumerable <DTO_SessionMessage> >(lst.Reverse()));
        }
예제 #7
0
        protected void Page_Load(object sender, EventArgs e)
        {
            litPortalName.Text = "PIXCILE";
            Slogon.Text        = "QR APP";


            AuthenticationModel oAuthenticationModel = SessionService.GetCurrentUser();

            if (oAuthenticationModel != null)
            {
                if (oAuthenticationModel.Authenticated)
                {
                }
            }
        }
        public async Task <IActionResult> Recipient(CertificateRecipientViewModel vm)
        {
            var certData = await GetCertificateData(vm.Id);

            if (ModelState.IsValid && vm.RecipientHasChanged(certData))
            {
                // when recipient has been changed the complete journey is required
                SessionService.SetRedirectToCheck(false);
            }

            return(await SaveViewModel(vm,
                                       returnToIfModelNotValid : "~/Views/Certificate/Recipient.cshtml",
                                       nextAction : RedirectToAction("ConfirmAddress", "CertificateAddress"),
                                       action : CertificateActions.Address));
        }
 private void SetDishes()
 {
     dishes = SessionService.GetJson <List <Dish> >(HttpContext.Session, SessionKeys.DishesKey);
     if (dishes == null)
     {
         dishes = new List <Dish>()
         {
             new Dish {
                 Id = 1, Name = "Chrupiące Skrzydełka", Price = 19.95M, Amount = 0
             },
             new Dish {
                 Id = 2, Name = "Tatar z polędwicy Wołowej", Price = 31.95M, Amount = 0
             },
             new Dish {
                 Id = 3, Name = "Panierowane kalmary", Price = 29.95M, Amount = 0
             },
             new Dish {
                 Id = 4, Name = "Chrupiące krewetki", Price = 29.95M, Amount = 0
             },
             new Dish {
                 Id = 5, Name = "Carpaccio z polędwicy wołowej", Price = 30.95M, Amount = 0
             },
             new Dish {
                 Id = 6, Name = "Burger Italian", Price = 35.95M, Amount = 0
             },
             new Dish {
                 Id = 7, Name = "Burger Classic", Price = 29.95M, Amount = 0
             },
             new Dish {
                 Id = 8, Name = "Burger California", Price = 34.95M, Amount = 0
             },
             new Dish {
                 Id = 9, Name = "Perła 500ml", Price = 9.95M, Amount = 0
             },
             new Dish {
                 Id = 10, Name = "Zwierzyniec 500ml", Price = 10.95M, Amount = 0
             },
             new Dish {
                 Id = 11, Name = "Perła Export 500ml", Price = 11.95M, Amount = 0
             },
             new Dish {
                 Id = 12, Name = "Łomża Miodowa 500ml", Price = 10.95M, Amount = 0
             }
         };
         SessionService.SetJson(HttpContext.Session, SessionKeys.DishesKey, dishes);
     }
     dishes = dishes.OrderBy(x => x.Name).ToList();
 }
예제 #10
0
파일: Session.cs 프로젝트: valiant-tms/PDM
        public static void setObjectPolicy(DataTable attributes)
        {
            SessionService       sessService = SessionService.getService(getConnection());
            ObjectPropertyPolicy policy      = new ObjectPropertyPolicy();

            List <String> bomAttributes1 = new List <String> {
            };
            List <String> revAttributes1 = new List <string> {
            };

            int bomAttributeIndex = 0;
            int revAttributeIndex = 0;

            foreach (DataRow attribute in attributes.Rows)
            {
                if (attribute["ATYPE"].ToString().Equals("BOMLINE"))
                {
                    String bomAttribute = attribute["ATTRI"].ToString();
                    bomAttributes1.Add(bomAttribute);
                    bomAttributeIndex++;
                }
                else
                {
                    String revAttribute = attribute["ATTRI"].ToString();
                    revAttributes1.Add(revAttribute);
                    revAttributeIndex++;
                }
            }

            String[] bomAttributes = new String[bomAttributeIndex];
            String[] revAttributes = new String[revAttributeIndex];

            for (int ai = 0; ai < bomAttributeIndex; ai++)
            {
                bomAttributes[ai] = bomAttributes1[ai].ToString();
            }
            for (int ai = 0; ai < revAttributeIndex; ai++)
            {
                revAttributes[ai] = revAttributes1[ai].ToString();
            }

            policy.AddType(new PolicyType("BOMLine", bomAttributes));
            policy.AddType(new PolicyType("ModelObject", new string[] { "item_id", "object_type", "object_name", "object_properties" }));
            policy.AddType(new PolicyType("Item", new string[] { "object_type", "object_name", "bom_view_tags", "revision_list", "item_revision", "vmt9_design_type_cmp", "VMT9_Shn_Tool_RH_Qtys" }));
            policy.AddType(new PolicyType("ItemRevision", revAttributes));
            policy.AddType(new PolicyType("", new string[] { "" }, new string[] { PolicyProperty.WITH_PROPERTIES }));
            sessService.SetObjectPropertyPolicy(policy);
        }
예제 #11
0
        public ActionResult CreateCheckoutSession()
        {
            try
            {
                // Get Product from Stripe e.g. "Funding Apple FCU Account"
                var product = _stripeProvider?.GetProduct().Result;

                // Get Price from Stripe e.g. "Funding Apple FCU Account Price"
                var price = _stripeProvider?.GetPrice().Result;

                var options = new SessionCreateOptions
                {
                    PaymentMethodTypes = new List <string>
                    {
                        "card",
                    },
                    LineItems = new List <SessionLineItemOptions>
                    {
                        new SessionLineItemOptions
                        {
                            PriceData = new SessionLineItemPriceDataOptions
                            {
                                UnitAmount  = price?.UnitAmount,
                                Currency    = price?.Currency,
                                ProductData = new SessionLineItemPriceDataProductDataOptions
                                {
                                    Name   = product?.Name,
                                    Images = product?.Images
                                },
                            },
                            Quantity = 1,
                        },
                    },
                    Mode       = "payment",
                    SuccessUrl = "https://example.com/success",
                    CancelUrl  = "https://example.com/cancel",
                };
                var sessionService = new SessionService(_client);
                var session        = sessionService?.Create(options);
                Console.WriteLine($"Checkout Session with ID {session?.Id} Completed");
                return(Json(new { id = session?.Id }));
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
                throw;
            }
        }
예제 #12
0
        public void OnGet()
        {
            this.ShoppingCart = GetShoppingCart();
            this.CartItems    = GetCartItems(this.ShoppingCart);
            this.TotalCost    = GetTotalCost(this.ShoppingCart);

            if (CartItems.Count <= 0)
            {
                this.Empty = true;
            }
            List <SessionLineItemOptions> convertedOptions = new List <SessionLineItemOptions>();

            foreach (CartItem item in CartItems)
            {
                convertedOptions.Add(ConvertProductToStripe(item));
            }

            var options = new SessionCreateOptions
            {
                BillingAddressCollection = "required",
                PaymentMethodTypes       = new List <string>
                {
                    "card",
                },
                ShippingAddressCollection = new SessionShippingAddressCollectionOptions
                {
                    AllowedCountries = new List <string>
                    {
                        "US",
                        "CA",
                        "JP",
                        "KR",
                        "CN",
                    },
                },
                LineItems     = convertedOptions,
                Mode          = "payment",
                SuccessUrl    = "https://projectstation.azurewebsites.net/shopstuff/PaymentSuccess",
                CancelUrl     = "https://projectstation.azurewebsites.net/shopstuff/PaymentFailure",
                Customer      = null,
                CustomerEmail = null,
            };

            var     service = new SessionService();
            Session session = service.Create(options);

            this.Session = session;
        }
예제 #13
0
        public ActionResult Login(FormCollection PC)
        {
            // Set your secret key. Remember to switch to your live secret key in production!
            // See your keys here: https://dashboard.stripe.com/account/apikeys
            StripeConfiguration.ApiKey = "XXX";

            var options = new SessionCreateOptions
            {
                Customer  = "cus_HkS69UeMf55BrW",
                ReturnUrl = "https://localhost:44305/Home/Index",
            };

            var     service = new SessionService();
            Session test    = service.Create(options);

            var config = new AmazonDynamoDBConfig {
                RegionEndpoint = RegionEndpoint.APSoutheast1
            };
            //var credentials = new BasicAWSCredentials(Environment.GetEnvironmentVariable("AWS_ACCESS_KEY_ID"), Environment.GetEnvironmentVariable("AWS_SECRET_ACCESS_KEY"));
            var credentials = new BasicAWSCredentials("XXX", "XXX");
            AmazonDynamoDBClient _dynamoDbClient = new AmazonDynamoDBClient(credentials, config);
            Table table = Table.LoadTable(_dynamoDbClient, "Users");
            var   book  = new Document();

            book["User_ID"]     = test.Id;
            book["customer_ID"] = test.Customer;
            book["object_id"]   = test.Id;
            book["object_type"] = test.Object;
            book["return_url"]  = test.ReturnUrl;

            table.PutItem(book);

            //var options1 = new WebhookEndpointCreateOptions
            //{
            //    Url = "https://git.heroku.com/sptask6.git",
            //    EnabledEvents = new List<string>
            //{
            //    "charge.failed",
            //    "charge.succeeded",
            //},
            //};
            //var service1 = new WebhookEndpointService();
            //service1.Create(options1);

            //service1.Get("we_1GxplED1GhlR3Zf7y0VwRON8");

            return(Redirect(test.Url));
        }//
예제 #14
0
        public string GetDetailGrid(int pageTemplateId, string refKeyValue)
        {
            PageTemplate pageTemplate = SessionService.PageTemplate(pageTemplateId);

            if (pageTemplate.RefKey2 == 0)
            {
                return("");
            }

            GridFilters gridFilters = new GridFilters {
                Logic = "and", Filters = new List <GridFilter> {
                    new GridFilter {
                        Field = pageTemplate.RefKey2Name, Operator = "eq", Value = refKeyValue
                    }
                }
            };


            PageTemplate    pageTemplate2 = SessionService.PageTemplate(pageTemplate.PageTemplateId2);
            List <GridSort> gridSorts     = new List <GridSort>();

            //xxx fix
            //if (pageTemplate2.SortColumns.Length > 2)
            //{
            //    var sortColumns = pageTemplate2.SortColumns;
            //    if (sortColumns.Contains(","))
            //    {
            //        var items = sortColumns.Split(new char[',']);
            //        foreach (var item in items)
            //        {
            //            var columnId = item.Replace(" ", "").Replace("ASC", "").Replace("DESC", "");
            //            var columnName = SessionService.ColumnName(Convert.ToInt32(columnId));
            //            GridSort gridSort = new GridSort { Field = columnName, Dir = (item.Contains("ASC")) ? "ASC" : "DESC" };
            //            gridSorts.Add(gridSort);
            //        }
            //    } else
            //    {
            //        var columnId = sortColumns.Replace(" ", "").Replace("ASC", "").Replace("DESC", "");
            //        var columnName = SessionService.ColumnName(Convert.ToInt32(columnId));
            //        GridSort gridSort = new GridSort { Field = columnName, Dir = (sortColumns.Contains("ASC")) ? "ASC" : "DESC" };
            //        gridSorts.Add(gridSort);
            //    }
            //}

            var json = PageService.GetServerSideRecords(0, 500000, 0, 0, gridSorts, gridFilters, pageTemplate.PageTemplateId2);

            return(json);
        }
예제 #15
0
        public async Task <Session> CreateCheckoutSession(string customerId, string successUrl, string cancelUrl)
        {
            var options = new SessionCreateOptions {
                PaymentMethodTypes = new List <string> {
                    "card",
                },
                Mode       = "setup",
                Customer   = customerId,
                SuccessUrl = successUrl,
                CancelUrl  = cancelUrl,
            };

            var service = new SessionService();

            return(await service.CreateAsync(options));
        }
        public async Task <StripeIdResponse> UpdateCustomerDescriptionAsync(string sessionId, string description)
        {
            var customerService = new CustomerService();
            var sessionService  = new SessionService();
            var session         = await sessionService.GetAsync(sessionId);

            var customer = await customerService.UpdateAsync(session.CustomerId, new CustomerUpdateOptions
            {
                Description = description
            });

            return(new StripeIdResponse
            {
                Id = customer.Id
            });
        }
 public SalesController
     (ISaleService saleService, IProductService productService, ICountryService countryService,
     IPaymentMethodService paymentMethodService, ICartService cartService, IUserService userService, IMapper mapper,
     SessionService sessionService, PaymentIntentService paymentIntentService, RefundService refundService)
 {
     this.saleService          = saleService;
     this.productService       = productService;
     this.countryService       = countryService;
     this.paymentMethodService = paymentMethodService;
     this.cartService          = cartService;
     this.userService          = userService;
     this.mapper               = mapper;
     this.sessionService       = sessionService;
     this.refundService        = refundService;
     this.paymentIntentService = paymentIntentService;
 }
예제 #18
0
        public static string GetPrimaryKey(int pageTemplateId, string tableName)
        {
            var pageTemplate = SessionService.PageTemplate(pageTemplateId);
            var dbEntity     = SessionService.DbEntity(pageTemplate.DbEntityId);

            using (TargetEntities Db = new TargetEntities())
            {
                Db.Database.Connection.ConnectionString = dbEntity.ConnectionString;
                var columnName = Db.Database.SqlQuery <string>("SELECT COLUMN_NAME FROM INFORMATION_SCHEMA.KEY_COLUMN_USAGE WHERE OBJECTPROPERTY(OBJECT_ID(CONSTRAINT_SCHEMA + '.' + CONSTRAINT_NAME), 'IsPrimaryKey') = 1 AND TABLE_NAME = '" + tableName + "'").FirstOrDefault();
                if (columnName != null)
                {
                    return(columnName);
                }
            }
            return("");
        }
예제 #19
0
        async private void LoadUserInfo()
        {
            SharedPreferences prefs = Constants.GetSharedPreferences(Constants.PreferencesFileName);

            UserFirstName = prefs.GetString(Constants.UserFirstNameKey);
            UserLastName  = prefs.GetString(Constants.UserLastNameKey);
            string image_url = prefs.GetString(Constants.UserImageUrlKey);

            CacheService cache = CacheService.Init(SessionService.GetCredentialFileName(), Constants.PreferencesFileName, Constants.LocalDbName);

            /*if (!string.IsNullOrEmpty(image_url))
             * {
             *  var tuple = await cache.tryGetResource(image_url);
             *  UserImage = tuple.Item1;
             * } */
        }
 public string DeletePageTemplate(int pageTemplateId)
 {
     try
     {
         using (SourceControlEntities Db = new SourceControlEntities())
         {
             Db.Database.ExecuteSqlCommand("DELETE FROM Menu WHERE MenuPageTemplateId = " + pageTemplateId + ";DELETE FROM PageTemplate WHERE PageTemplateId = " + pageTemplateId + ";DELETE FROM ColumnDef WHERE PageTemplateId = " + pageTemplateId);
         }
         SessionService.ResetPageSession(pageTemplateId);
         return("");
     }
     catch (Exception ex)
     {
         return("Unable to process DeletePageTemplate() - " + ex.Message);
     }
 }
        protected bool TrySignIn()
        {
            PromptForCredentialsIfNotPresent();

            Console.WriteLine("Signing in...");
            bool signedIn = SessionService.SignIn(UserName, Password);

            if (!signedIn)
            {
                Console.WriteLine("Failed to sign in as {0}.", UserName);
                return(false);
            }

            Console.WriteLine("Signed in as {0}.", UserName);
            return(true);
        }
예제 #22
0
        // GET: Wait
        public ActionResult FlightWait(int id)
        {
            SessionService sessionService = new SessionService();
            if (!sessionService.ItemExists(SessionEnum.FlightSearch, id.ToString()))
            {
                // ah error has happend the session has gone
                // now we could be clever here and get the search back out of the database and restart it
                throw new Exception("Session Gone");
            }

            var flightSearchResult = sessionService.GetItem<FlightSearchResult>(SessionEnum.FlightSearch, id.ToString());

            // display anything we need on this please wait page

            return View(new FlightWaitViewModel { Id = id });
        }
예제 #23
0
        public ActionResult Edit(string add, string remove, int customerId)
        {
            FillLookups();

            if (!string.IsNullOrEmpty(add))
            {
                SessionService.Get().CustomerViewModel.CurrentEditLocation = new CustomerLocationViewModel
                {
                    CustomerId = customerId
                };

                return(View(SessionService.Get().CustomerViewModel));
            }

            return(View());
        }
예제 #24
0
        public async Task <ActionResult> OrderSuccess([FromQuery] string session_id, int bookingId)
        {
            var     sessionService = new SessionService();
            Session session        = sessionService.Get(session_id);

            var      customerService = new CustomerService();
            Customer customer        = customerService.Get(session.CustomerId);

            var bookingDetails = await unitOfWork.BookingRepo.Find(b => b.BookingId == bookingId);

            bookingDetails.Paid = 1; //paid done
            unitOfWork.BookingRepo.Update(bookingDetails);
            unitOfWork.Save();

            return(RedirectToAction("Index", "MyBookings"));
        }
예제 #25
0
        public bool RegisterPushToken(string sessionKey, string pushToken)
        {
            var dbContext      = DbContextFactory.GetContext();
            var sessionService = new SessionService();
            var user           = sessionService.GetUser(sessionKey);

            if (user == null)
            {
                return(false);
            }
            user.PushToken = pushToken;

            dbContext.SaveChanges();

            return(true);
        }
예제 #26
0
파일: Program.cs 프로젝트: chao1573/io
        public static void Main(string[] args)
        {
            Console.WriteLine("Hello World!");

            MatchService      matchService    = new MatchService();
            MessageDispatcher dispatcher      = new MessageDispatcher(matchService);
            SessionRegistry   sessionRegistry = new SessionRegistry();

            SessionService sessionService = new SessionService(sessionRegistry, dispatcher);

            sessionService.Start();
            Console.WriteLine("Server start.");

            autoEvent.WaitOne();
            Console.WriteLine("Server exit.");
        }
예제 #27
0
        private SuperadminPatientModel GetSuperadminPatient(User user)
        {
            var result = new SuperadminPatientModel
            {
                User         = new UserViewModel(user),
                AverageScore = ReviewService.GetUserAverageScore(user)
            };

            var sessions = SessionService.GetUserSessions(user).ToList();

            result.TotalSessionsCount = sessions.Count;
            result.TotalRefunds       = sessions.Where(x => x.Status == SessionStatus.Refund).ToList().Count;
            result.TotalPaid          = sessions.Where(x => x.Status == SessionStatus.Success).Sum(x => x.Reward);

            return(result);
        }
예제 #28
0
        public static void ExchangeCurrency(string personFirstName, string personLastName, DateTime birthDate,
                                            string passportSeries, string passportId, string currencyName, double amount, bool isSelling)
        {
            var person = GetCustomerBO.GetCustomerByPassportId(passportId);

            if (person == null)
            {
                person = new Abstract.model.Person
                {
                    FirstName      = personFirstName, LastName = personLastName, BirthDate = birthDate,
                    PassportSeries = passportSeries, PassportId = passportId
                };
                CreateCustomerBO.CreateCustomer(person);
            }

            var currency = GetCurrencyBO.GetCurrencyByName(currencyName);

            var outcomeAmount = currency.Purchase * amount;

            if (isSelling)
            {
                outcomeAmount = amount / currency.Sell;
            }


            if (!ValidateForDailyLimits(amount, currency))
            {
                ModernDialog.ShowMessage("Person can't exchange more than 1000 units \nof currency per day.", "Warning",
                                         MessageBoxButton.OK);
                return;
            }

            var outReport = new Abstract.model.Report
            {
                UserId        = SessionService.GetInstance().User.UserId,
                PersonId      = person.PersonId,
                CurrencyId    = currency.CurrencyId,
                IncomAmount   = amount,
                OutcomeAmount = outcomeAmount,
                Date          = DateTime.Now
            };

            CreateReportBO.CreateReport(outReport);

            ModernDialog.ShowMessage("The operation completed successfully. \nYou need to issue " + outcomeAmount +
                                     " units of currency.", "Success!", MessageBoxButton.OK);
        }
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);

            string debug = Context.Request.QueryString["debug"];

            if (WebPartManager.DisplayMode == WebPartManager.EditDisplayMode)
            {
                debug = "yes";
            }

            IApiProvider apiProvider = Utilities.ApiProvider;

            _session = null;
            string return_url = Context.Request.QueryString["return_url"];

            if (return_url == null)
            {
                return_url = "/";
                debug      = "yes"; // Do not instant redirect
            }

            if (apiProvider != null)
            {
                SPUser user     = SPContext.Current.Web.CurrentUser;
                string email    = null;
                string fullname = null;

                if (user != null)
                {
                    email    = _sendEmail ? user.Email : null;
                    fullname = _sendFullName ? user.Name : null;
                }

                ISessionService sessionService = new SessionService(apiProvider);
                _session = sessionService.GetToken(return_url, email, fullname);
            }

            // Do not redirect if debug is set
            if (debug == null)
            {
                if (_session != null)
                {
                    SPUtility.Redirect(_session.ReturnURL, SPRedirectFlags.Static, HttpContext.Current);
                }
            }
        }
예제 #30
0
 public LoginController(
     IRepositoryBase <staff_view> users,
     IRepositoryBase <customer_view> customers,
     IRepositoryBase <ipmevent> ipmevents,
     IRepositoryBase <placeinmap> placesinmap,
     IRepositoryBase <coordinate> coordinates,
     IRepositoryBase <sitetype> sitetypes,
     IRepositoryBase <siterate> siterates,
     IRepositoryBase <styleurl> stylesurl,
     IRepositoryBase <rvsite_available_view> rvsites_available,
     IRepositoryBase <selecteditem> selecteditems,
     IRepositoryBase <reservationitem> reservationitems,
     IRepositoryBase <payment> payments,
     IRepositoryBase <person> persons,
     IRepositoryBase <paymentreservationitem> paymentsreservationitems,
     IRepositoryBase <session> sessions,
     IRepositoryBase <site_description_rate_view> sites_description_rate
     )
 {
     this.users     = users;
     this.customers = customers;
     this.ipmevents = ipmevents;
     this.payments  = payments;
     this.persons   = persons;
     this.paymentsreservationitems = paymentsreservationitems;
     this.placesinmap            = placesinmap;
     this.coordinates            = coordinates;
     this.sitetypes              = sitetypes;
     this.siterates              = siterates;
     this.stylesurl              = stylesurl;
     this.selecteditems          = selecteditems;
     this.reservationitems       = reservationitems;
     this.rvsites_available      = rvsites_available;
     this.sites_description_rate = sites_description_rate;
     this.sessions  = sessions;
     sessionService = new SessionService(
         this.sessions,
         this.customers,
         this.users
         );
     paymentService = new PaymentService(
         this.selecteditems,
         this.reservationitems,
         this.payments,
         this.paymentsreservationitems
         );
 }//end Constructor
예제 #31
0
        public ActionResult Products_Read([DataSourceRequest] DataSourceRequest request)
        {
            var customerProductItems = _customerProductDataRepository.GetByCustomer(SessionService.Get().CustomerViewModel.Id).Select(x => new CustomerProductItem()
            {
                Id                 = x.Product.Id,
                Name               = x.Product.EnglishDescription,
                Upc                = x.Product.Upc,
                Gtin               = x.Gtin,
                PricePerPound      = x.PricePerPound,
                ProductCode        = x.ProductCode,
                BoxQuantity        = x.BoxQuantity,
                PieceQuantity      = x.PieceQuantity,
                ProductDescription = x.ProductDescription,
                IsSelected         = true,
                BagSize            = x.BagSizeEntity != null ? new CaseSize()
                {
                    Name = x.BagSizeEntity.Name, Id = x.BagSizeEntity.Id
                } : null,
                BoxSize = x.BoxSizeEntity != null ? new CaseSize()
                {
                    Name = x.BoxSizeEntity.Name, Id = x.BoxSizeEntity.Id
                } : null,
            }).ToList();
            var productItems =
                _productRepository.GetAll().ToList().Where(i => customerProductItems.Any(x => x.Id != i.Id) && (i.CustomerTypeId == null || i.CustomerTypeId.Value == SessionService.Get().CustomerViewModel.CustomerType)).Select(x => new CustomerProductItem()
            {
                Id                 = x.Id,
                Name               = x.EnglishDescription,
                Upc                = x.Upc,
                Gtin               = x.Gtin,
                PricePerPound      = x.PricePerPound,
                ProductCode        = x.Code,
                ProductDescription = x.EnglishDescription,
                IsSelected         = false,
                BagSize            = x.BagSizeEntity != null ? new CaseSize()
                {
                    Name = x.BagSizeEntity.Name, Id = x.BagSizeEntity.Id
                } : null,
                BoxSize = x.BoxSizeEntity != null ? new CaseSize()
                {
                    Name = x.BoxSizeEntity.Name, Id = x.BoxSizeEntity.Id
                } : null,
            }).ToList();
            var allProductItems = customerProductItems.Concat(productItems).OrderByDescending(p => p.IsSelected).ThenBy(p => p.Name);

            return(Json(allProductItems.ToDataSourceResult(request)));
        }
        public TransactionsViewModel(NavigationService navigationService, SessionService session) : base(session)
        {
            this.navigationService = navigationService;
            this.Categories        = session.Categories;
            this.PaymentMethods    = session.PaymentMethods;
            this.Transactions      = session.Transactions;
            this.TransactionsView  = new ListCollectionView(this.Transactions);
            this.TransactionsView.SortDescriptions.Add(new SortDescription("Date", ListSortDirection.Descending));
            this.TransactionsView.Filter = ((transaction) => TransactionsView_Filter(transaction as Transaction));

            this.FilterDates = new MyObservableCollection <CheckedListItem <DateTime> >();
            this.FilterDates.CollectionChanged += this.FilterList_CollectionChanged;
            this.FilterDates.MemberChanged     += this.FilterList_PropertyChanged;
            this.FilterItems = new MyObservableCollection <CheckedListItem <string> >();
            this.FilterItems.CollectionChanged += this.FilterList_CollectionChanged;
            this.FilterItems.MemberChanged     += this.FilterList_PropertyChanged;
            this.FilterPayees = new MyObservableCollection <CheckedListItem <string> >();
            this.FilterPayees.CollectionChanged += this.FilterList_CollectionChanged;
            this.FilterPayees.MemberChanged     += this.FilterList_PropertyChanged;
            this.FilterAmounts = new MyObservableCollection <CheckedListItem <decimal> >();
            this.FilterAmounts.CollectionChanged += this.FilterList_CollectionChanged;
            this.FilterAmounts.MemberChanged     += this.FilterList_PropertyChanged;
            this.FilterCategories = new MyObservableCollection <CheckedListItem <Category> >();
            this.FilterCategories.CollectionChanged += this.FilterList_CollectionChanged;
            this.FilterCategories.MemberChanged     += this.FilterList_PropertyChanged;
            this.FilterPaymentMethods = new MyObservableCollection <CheckedListItem <PaymentMethod> >();
            this.FilterPaymentMethods.CollectionChanged += this.FilterList_CollectionChanged;
            this.FilterPaymentMethods.MemberChanged     += this.FilterList_PropertyChanged;
            this.FilterComments = new MyObservableCollection <CheckedListItem <string> >();
            this.FilterComments.CollectionChanged += this.FilterList_CollectionChanged;
            this.FilterComments.MemberChanged     += this.FilterList_PropertyChanged;

            this.FilterView       = new ListCollectionView(this.FilterDates);
            this.activeColumnName = "Date";

            this.Transactions.CollectionChanged += this.Transactions_CollectionChanged;
            this.Transactions.MemberChanged     += this.Transaction_PropertyChanged;

            //Set Commands
            this.AddTransactionCommand       = new RelayCommand(() => this.AddTransaction());
            this.DeleteTransactionCommand    = new RelayCommand(() => this.DeleteTransaction());
            this.DuplicateTransactionCommand = new RelayCommand(() => this.DuplicateTransaction());
            this.UpdateFilterCommand         = new RelayCommand(() => { this.TransactionsView.Refresh(); });
            this.OpenFilterPopupCommand      = new RelayCommand <string>((a) => this.OpenPopup(a));
            this.SelectAllFiltersCommand     = new RelayCommand(() => this.SelectFilters());
            this.DeselectAllFiltersCommand   = new RelayCommand(() => this.DeselectFilters());
        }
예제 #33
0
        public CurrentSessionViewModel(
            IViewModelNavigator navigator,
            SessionService sessionService,
            ImagePrinter printer,
            SettingsProvider settings
            )
        {
            _navigator      = navigator;
            _sessionService = sessionService;
            _printer        = printer;
            AppSettingsDto appSettings = settings.GetAppSettings();

            if (appSettings != null)
            {
                _printerName = appSettings.PrinterName;
            }
        }
예제 #34
0
        public async Task GetAllAsyncWhenNoSessionsReturnsEmptyCollection()
        {
            // Arrange
            var mockUnitOfWork        = GetDefaultUnitOfWorkRepositoryInstance();
            var mockSessionRepository = GetDefaultSessionRepositoryInstance();

            mockSessionRepository.Setup(r => r.ListAsync()).ReturnsAsync(new List <Session>());
            var service = new SessionService(mockSessionRepository.Object, null, null, mockUnitOfWork.Object);

            // Act
            List <Session> result = (List <Session>) await service.ListAsync();

            var sessionCount = result.Count;

            // Assert
            sessionCount.Should().Equals(0);
        }
예제 #35
0
        public ActionResult FlightSearchStart(int id)
        {
            SessionService sessionService = new SessionService();
            if (!sessionService.ItemExists(SessionEnum.FlightSearch, id.ToString()))
            {
                // ah error has happend the session has gone
                // now we could be clever here and get the search back out of the database and restart it
                throw new Exception("Session Gone");
            }

            var flightSearchResult = sessionService.GetItem<FlightSearchResult>(SessionEnum.FlightSearch, id.ToString());

            // lets do the search
            flightSearchResult = flightServiceClient.PerformSearch(flightSearchResult.FlightSearch, flightSearchResult.FlightSearchId);
            sessionService.SetItem(SessionEnum.FlightSearch, id.ToString(), flightSearchResult);
            return Json(new { success = flightSearchResult.Success, error = flightSearchResult.ErrorMessage });
        }
예제 #36
0
        public ActionResult Manage(string catalog, string handle = null)
        {
            string admin = SessionService.Get <string>("Admin");

            if (string.IsNullOrEmpty(admin) && !"login".Equals(catalog, StringComparison.OrdinalIgnoreCase))
            {
                if (Request.AcceptTypes.Contains("application/json"))
                {
                    return(Json(new { success = false, msg = "请先登录" }));
                }
                else
                {
                    return(Redirect(Url.Content("~/Manage/Login")));
                }
            }
            return(View("~/Views/Manage/" + catalog + (string.IsNullOrEmpty(handle) ? "" : ("/" + handle)) + ".cshtml"));
        }
예제 #37
0
        // GET: Results
        public ActionResult FlightResults(int id)
        {
            SessionService sessionService = new SessionService();
            if (!sessionService.ItemExists(SessionEnum.FlightSearch, id.ToString()))
            {
                // ah error has happend the session has gone
                // now we could be clever here and get the search back out of the database and restart it
                throw new Exception("Session Gone");
            }

            var flightSearchResult = sessionService.GetItem<FlightSearchResult>(SessionEnum.FlightSearch, id.ToString());

            return View(new FlightResultViewModel
            {
                Message = flightSearchResult.ErrorMessage
            });
        }
예제 #38
0
        public ActionResult ProcessFlightSearch(FlightSearch flightSearch)
        {
            if (ModelState.IsValid)
            {
                // for now we are going to pretend it is a package search
                // this call will prep the search
                FlightServiceClient flightServiceClient = new FlightServiceClient();
                var flightSearchResult = flightServiceClient.StartSearch(flightSearch);

                // save this into session
                SessionService sessionService = new SessionService();
                sessionService.SetItem(SessionEnum.FlightSearch, flightSearchResult.FlightSearchId.ToString(), flightSearchResult);

                // this will change depending on the search type
                return Redirect("search/package-flight-wait/?id=" + flightSearchResult.FlightSearchId);
            }
            else
            {
                return View("flightSearch");
            }
        }
예제 #39
0
        public ActionResult ProcessSearchFormInput(SearchForm model)
        {
            // this method works out what the search type is.
            // from here we can then work out how we do the search.

            // for now we are going to pretend it is a package search
            // this call will prep the search
            FlightServiceClient flightServiceClient = new FlightServiceClient();
            var flightSearchResult = flightServiceClient.StartSearch(new FlightSearch
            {
                IsPackage = true,
                SearchType = "Package"
            });

            // save this into session
            SessionService sessionService = new SessionService();
            sessionService.SetItem(SessionEnum.FlightSearch, flightSearchResult.FlightSearchId.ToString(), flightSearchResult);

            // this will change depending on the search type
            return Redirect("search/package-flight-wait/?id=" + flightSearchResult.FlightSearchId);
        }
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);

            string debug = Context.Request.QueryString["debug"];

            if (WebPartManager.DisplayMode == WebPartManager.EditDisplayMode)
                debug = "yes";

            IApiProvider apiProvider = Utilities.ApiProvider;
            _session = null;
            string return_url = Context.Request.QueryString["return_url"];
            if (return_url == null)
            {
                return_url = "/";
                debug = "yes"; // Do not instant redirect
            }

            if (apiProvider != null)
            {
                SPUser user = SPContext.Current.Web.CurrentUser;
                string email = null;
                string fullname = null;

                if (user != null)
                {
                    email = _sendEmail ? user.Email : null;
                    fullname = _sendFullName ? user.Name : null;
                }

                ISessionService sessionService = new SessionService(apiProvider);
                _session = sessionService.GetToken(return_url, email, fullname);
            }

            // Do not redirect if debug is set
            if (debug == null)
            {
                if (_session != null)
                {
                    SPUtility.Redirect(_session.ReturnURL, SPRedirectFlags.Static, HttpContext.Current);
                }
            }
        }
예제 #41
0
    void OnGUI()
    {
        if (Time.time % 2 < 1) {
            success = callBack.getResult();
        }

        // For Setting Up ResponseBox.
        GUI.TextArea(new Rect(10,5,1300,175), success);

        //=======================================SESSION_SERVICE=======================================

        if (GUI.Button(new Rect(50, 200, 200, 30), "GetSession"))
            {
                sessionService = sp.BuildSessionService(); // Initializing Session Service.
                sessionService.GetSession(cons.userName,callBack);
            }

        //====================================SESSION_SERVICE==========================================

        if (GUI.Button(new Rect(260, 200, 200, 30), "GetSessionIsCreate"))
            {
                sessionService = sp.BuildSessionService(); // Initializing Session Service.
                sessionService.GetSession(cons.userName, cons.isCreate, callBack);
            }

        //====================================SESSION_SERVICE=========================================

        if (GUI.Button(new Rect(470, 200, 200, 30), "Invalidate"))
            {
                sessionService = sp.BuildSessionService(); // Initializing Session Service.
                sessionService.Invalidate(cons.sessionId, callBack);
            }

        //=====================================SESSION_SERVICE========================================

        if (GUI.Button(new Rect(680, 200, 200, 30), "SetAttribute"))
            {
                sessionService = sp.BuildSessionService(); // Initializing Session Service.
                sessionService.SetAttribute(cons.sessionId,cons.attributeName, cons.attributeValue, callBack);
            }

        //======================================SESSION_SERVICE=======================================

        if (GUI.Button(new Rect(890, 200, 200, 30), "GetAttribute"))
            {
                sessionService = sp.BuildSessionService(); // Initializing Session Service.
                sessionService.GetAttribute(cons.sessionId,cons.attributeName, callBack);
            }

        //======================================SESSION_SERVICE=======================================

        if (GUI.Button(new Rect(50, 250, 200, 30), "GetAllAttributes"))
            {
                sessionService = sp.BuildSessionService(); // Initializing Session Service.
                sessionService.GetAllAttributes(cons.sessionId, callBack);
            }

        //=======================================SESSION_SERVICE======================================

        if (GUI.Button(new Rect(260, 250, 200, 30), "RemoveAttribute"))
            {
                sessionService = sp.BuildSessionService(); // Initializing Session Service.
                sessionService.RemoveAttribute(cons.sessionId,cons.attributeName, callBack);
            }

        //========================================SESSION_SERVICE=====================================

        if (GUI.Button(new Rect(470, 250, 200, 30), "RemoveAllAttributes"))
            {
                sessionService = sp.BuildSessionService(); // Initializing Session Service.
                sessionService.RemoveAllAttributes(cons.sessionId, callBack);
            }
    }