public ActionResult Index() { var session = new SessionFacade(HttpContext.Session); var categories = _storageContext.Categories.LoadAll(); var lineItems = session .ShoppingCart .LineItems .Select(x => new ShoppingCartItemModel { Product = _storageContext .Products .LoadSingle(y => y.Id == x.ProductId), Quantity = x.Quantity }); var model = new ShoppingCartModel { CardItems = lineItems, Categories = categories, SumAllItems = lineItems.Select(x => x.Product.UnitPrice * x.Quantity).Sum() }; return View(model); }
public ActionResult AddCustomerData(AddCustomerModel model) { var sessionFacade = new SessionFacade(HttpContext.Session); var categories = _storageContext.Categories.LoadAll(); if (!ModelState.IsValid) { model.Categories = categories; return View("OrderCart", model); } // do handle customer var customer = new Customer { Id = model.CustomerId, Salutation = model.Salutation, Name = model.Name, FamilyName = model.FamilyName, Address = model.Address, Zip = model.Zip, City = model.City, Email = model.Email }; sessionFacade.Customer = customer; return RedirectToAction("OrderReview"); }
// the quote system constructor public QuoteSystem(Logger l, ConsorsGate cg) { //setting the local variables _log = l; _cg = cg; _log.info("QuoteSystem::QuoteSystem", "constructing quote system"); //initialize the consors system. // Create the session facade try{ sf = new SessionFacade(); // Login sf.LoginWithAddOnName("Ulrich Staudinger"); _log.info("QuoteSystem::QuoteSystem", "logged in."); //registering for now, the plain dax values. // Create the parameters that you need for the quote subscription, here the QuoteKey QuoteKey qk = sf.CreateQuoteKey(); // Set all necessary parameters qk.SecurityCode = "846900"; qk.StockexchangeId = "ETR"; // Acquire the subscription with this QuoteKey QuoteSubscription qs = sf.GetQuoteSubscription(qk); // Register your event handler on the subscription CallbackQuote cbQuote = new CallbackQuote(quoteHandler); qs.OnQuoteUpdate += cbQuote; _log.info("QuoteSystem::QuoteSystem", "subscribed to dax."); } catch (Exception ex) { _log.fatal("QuoteSystem::QuoteSystem", "Exception while starting QuoteSystem:"); _log.fatal("QuoteSystem::QuoteSystem", ex.Message); } Thread constantRunner = new Thread(new ThreadStart(Run)); constantRunner.Start(); }
public ActionResult OrderReview() { var sessionFacade = new SessionFacade(HttpContext.Session); var categories = _storageContext.Categories.LoadAll(); var cart = new Cart(sessionFacade, _storageContext); var items = cart.GetOrder().Lineitems.Select(x => new OrderReviewItemModel { Product = _storageContext.Products.LoadSingle(y => y.Id == x.ProductId), Quantity = x.Quantity }); return View(new OrderReviewModel { OrderItems = items, Customer = sessionFacade.Customer, Categories = categories, SumAllItems = items.Select(x => x.Product.UnitPrice * x.Quantity).Sum() }); }
public ActionResult OrderCart() { var sessionFacade = new SessionFacade(HttpContext.Session); var categories = _storageContext.Categories.LoadAll(); var customer = sessionFacade.Customer; var model = new AddCustomerModel { Categories = categories, CustomerId = customer.Id, Name = customer.Name, FamilyName = customer.FamilyName, Address = customer.Address, Zip = customer.Zip, City = customer.City, Email = customer.Email }; return View(model); }
public ActionResult OrderReview(OrderReviewModel model) { var sessionFacade = new SessionFacade(HttpContext.Session); var categories = _storageContext.Categories.LoadAll(); var cart = new Cart(sessionFacade, _storageContext); var items = cart.GetOrder().Lineitems.Select(x => new OrderReviewItemModel { Product = _storageContext.Products.LoadSingle(y => y.Id == x.ProductId), Quantity = x.Quantity }); if (!ModelState.IsValid) { model.OrderItems = items; model.Customer = sessionFacade.Customer; model.Categories = categories; model.SumAllItems = items.Select(x => x.Product.UnitPrice * x.Quantity).Sum(); return View(model); } var newCustomerId = GetNewCustomerId(); var newOrderId = GetNewOrderId(); // Do Checkout var customer = sessionFacade.Customer; if (customer.Id <= 0) { customer.Id = newCustomerId; sessionFacade.Customer = customer; } var order = cart.GetOrder(); order.Id = newOrderId; order.CustomerId = customer.Id; UpdateUnitsInStock(order); SaveCustomer(customer); SaveOrder(order); sessionFacade.ShoppingCart = null; return RedirectToAction("Index", "Home"); }
public void verificaAcesso() { if (validaAcesso) { Session.Timeout = 9999; if (SessionFacade.Id.Equals(0) && false) { SessionFacade.Id = 2; SessionFacade.Nome = "Cláudio"; SessionFacade.Contrato = "ABC12345"; SessionFacade.Controle = "O"; SessionFacade.TipoId = 1; //SessionFacade.listaModulos = "ABC12345,TAG548"; //SessionFacade. } if (SessionFacade.Id.Equals(0)) { if (SessionFacade.getApp("usaCookie") != null && SessionFacade.getApp("usaCookie") != String.Empty) { if (Request.Cookies["logado"] != null) { HttpCookie cookie = Request.Cookies["logado"]; if (cookie.Value != String.Empty) { string[] ar = cookie.Value.Split("||".ToCharArray()); SessionFacade.Id = Convert.ToInt32(ar[0]); SessionFacade.Login = ar[1]; SessionFacade.Nome = ar[2]; SessionFacade.listaProcessos = ar[3]; SessionFacade.listaModulos = ar[4]; if (Request.Cookies["_contrato"] != null && Request.Cookies["_contrato"].Value != String.Empty) { Session["_contrato"] = Request.Cookies["_contrato"].Value; } if (Request.Cookies["_controle"] != null && Request.Cookies["_controle"].Value != String.Empty) { Session["_controle"] = Request.Cookies["_controle"].Value; } if (Request.Cookies["TipoId"] != null && Request.Cookies["TipoId"].Value != String.Empty) { Session["TipoId"] = Request.Cookies["TipoId"].Value; } return; } } } } if (SessionFacade.Id.Equals(0)) { //Request.Q if (!isPopup) { Response.Redirect("~/login.aspx"); } else { Utilities.JavaScript.Alert("Sessão expirada!", this.Page); Utilities.JavaScript.ExecuteScript(this.Page, "opener.location.href='login.aspx'; window.close();", true); } } } }
public static void Display(this LookupDobSignedCarriersSuccessData data, SessionFacade session) { new LookupDobSignedCarriersDisplayHelper(data, session).Display(); }
public static void Display(this LookupDobEventsSuccessData data, SessionFacade session) { new LookupDobEventsDisplayHelper(data, session).Display(); }
public Cart(SessionFacade session, StorageContext storageContext) { _session = session; _storageContext = storageContext; }
protected void Page_Load(object sender, EventArgs e) { if (SessionFacade.Id <= 0) { if (Request.Cookies["logado"] != null) { HttpCookie cookie = Request.Cookies["logado"]; if (cookie.Value != String.Empty) { // // string ids = SessionFacade.Id.ToString() + "||" + SessionFacade.Nome + "||" + SessionFacade.listaProcessos + // "||" + SessionFacade.listaModulos + "||" + SessionFacade.TextoChamada + "||" + SessionFacade.Email; string[] ar = cookie.Value.Split(new string[] { "||" }, System.StringSplitOptions.None); SessionFacade.Id = Convert.ToInt32(ar[0]); SessionFacade.Login = String.Empty; SessionFacade.Nome = ar[1]; try { // if (ar[2] != String.Empty) // SessionFacade.TipoId = Convert.ToInt32(ar[2]); SessionFacade.listaProcessos = ar[2]; SessionFacade.listaModulos = ar[3]; SessionFacade.TextoChamada = ar[4]; //SessionFacade.Email = ar[5]; } catch { } } } } if (SessionFacade.Id > 0) { string filtroDestinatario = " and ( exists ( select ss.id_mensagem from mensagem_destino ss where ss.id_destinatario = " + SessionFacade.Id.ToString() + " and ss.id_mensagem = m.id and ifNull(ss.arquivada,0) = 0 ) or m.todos = 1 ) "; string sqlcont = " select count(*) from mensagem m where 1 = 1 " + filtroDestinatario + " and m.id not in ( select id_mensagem from mensagem_destino where id_destinatario =" + SessionFacade.Id.ToString() + " and data_lida is not null ) "; int qtdeMensagensNaoLidas = Convert.ToInt32(DataAccess.ConnAccess.fetchData(DataAccess.ConnAccess.getConn(), sqlcont)); a_msg.InnerHtml = "- Mensagens (" + qtdeMensagensNaoLidas.ToString() + ") "; if (qtdeMensagensNaoLidas > 0) { a_msg.Attributes.Remove("style"); a_msg.Attributes.Add("style", "color: orange"); } else { a_msg.Attributes.Remove("style"); a_msg.Attributes.Add("style", "color: blue"); } //a_msg } if (SessionFacade.getApp("NaoConfereAcesso") == "1") { } else { if (SessionFacade.Id <= 0) { //Response.Redirect("login.aspx"); } } string urlAtual = Request.ServerVariables["URL"].ToString(); SessionFacade.TelaAtual = urlAtual; Control txPesquisar = encontraControles(this.Page.Form, "txtPesquisar"); Control imgPesq = encontraControles(this.Page.Form, "imgRefreshFiltro"); if (txPesquisar != null && imgPesq != null) { //this.setEnter((TextBox)txPesquisar, (ImageButton)imgPesq); } //Informa em que módulo o sistema se encontra. string mod = "Entretenimento"; if (Request.QueryString["modulo"] != null && Request.QueryString["modulo"].ToString() != String.Empty) { SessionFacade.Modulo = Request.QueryString["modulo"].ToString(); } //setInputSpeech_control(this.form1); //carregaMenuSistema(); lb_usuario.Text = SessionFacade.Nome; lb_perfil.Text = "(" + SessionFacade.TextoChamada + ") "; if (!Page.IsPostBack) { // UcFiltroBasico1.CaminhoExcel = // Server.MapPath("estrutura_banco.xls"); } }
public ActionResult EnterToken(Token token) { SessionFacade.StoreAuthToken(token.AuthToken); return(RedirectToAction("Index", "Boards")); }
/// <summary> /// Returns the right IHttpHandler for the current request /// </summary> /// <param name="context">The current HttpContext</param> /// <param name="requestType">The current RequestType (HTTP verb)</param> /// <param name="url">The requestes Url</param> /// <param name="pathTranslated">The translated physical path</param> /// <param name="container">The container.</param> /// <returns>The right IHttpHandler instance for the current request</returns> protected override IHttpHandler GetHandlerCore(HttpContext context, string requestType, string url, string pathTranslated, IContainer container) { context = Enforce.NotNull(context, () => context); requestType = Enforce.NotNullOrEmpty(requestType, () => requestType); url = Enforce.NotNullOrEmpty(url, () => url); pathTranslated = Enforce.NotNullOrEmpty(pathTranslated, () => pathTranslated); // Get the mapping for the requested name. IMapping mapping = null; // Try fetch the Mapping with identifier. string id = this.Data.Trim('/'); if (id != null && id.IsGuid()) { mapping = this._mappingService.ReadMapping( SessionFacade.GetSessionValue <IUser>(SessionFacadeKey.CurrentlyLoggedOnUser), id.ToOrDefault <Guid>()); if (mapping == null) { throw new SilkveilException(String.Format(CultureInfo.CurrentCulture, "The id '{0}' is invalid.", id)); } } else { // Try fetch the Mapping with name. if (!String.IsNullOrEmpty(id)) { mapping = this._mappingService.ReadMappingByName( SessionFacade.GetSessionValue <IUser>(SessionFacadeKey.CurrentlyLoggedOnUser), id); if (mapping == null) { throw new SilkveilException(String.Format(CultureInfo.CurrentCulture, "The name '{0}' is invalid.", id)); } } } // No valid guid or name is provided, fail. if (mapping == null) { throw new MappingNotFoundException( String.Format( CultureInfo.CurrentCulture, "There was no mapping found for ID '{0}'.", id)); } // Get the data source that holds the download and write the download to the output stream. IDataSource dataSource = DataSourceFactory.GetMappedDataSource(mapping, container); DownloadHandler handler = new DownloadHandler(); // Grab the right Handler correnspondents to our Mapping, if there any source authentication set if (mapping.SourceAuthentication != null) { switch (mapping.SourceAuthentication.AuthenticationType) { case AuthenticationType.HttpBasicAuthentication: handler.AuthenticationStrategy = new HttpBasicAuthentication(); break; case AuthenticationType.HttpDigestAuthentication: handler.AuthenticationStrategy = new HttpDigestAuthentication(); break; } // Set properties needed for the autentication strategy. handler.AuthenticationStrategy.Realm = mapping.Id.ToString(); handler.AuthenticationStrategy.UserName = mapping.SourceAuthentication.UserName; handler.AuthenticationStrategy.Password = mapping.SourceAuthentication.Password; } // Set Mapping and DataSource to the handlers properties handler.Mapping = mapping; handler.DataSource = dataSource; return(handler); }
public ActionResult Logout() { SessionFacade.DeleteSession(); return(RedirectToAction("Login", "Login")); }