コード例 #1
0
        public ActionResult News(long?newsId)
        {
            PublicViewModel publicViewModel = new PublicViewModel();

            if (Session["CompanySetting"] != null)
            {
                publicViewModel.CompanySetting = (CompanySetting)Session["CompanySetting"];
            }
            else
            {
                publicViewModel.CompanySetting = CompanySettingsManager.GetCompanySettings(1);
            }

            if (string.IsNullOrEmpty(newsId.ToString()))
            {
                publicViewModel.NewsList = NewsEventsManager.GetAllNews();
                if (publicViewModel.NewsList.Any() && publicViewModel.NewsList.Count > 0)
                {
                    publicViewModel.News = publicViewModel.NewsList.FirstOrDefault();
                }
            }
            else
            {
                publicViewModel.NewsList = NewsEventsManager.GetAllNews();
                publicViewModel.News     = NewsEventsManager.GetNewsById(newsId);
            }

            return(View(publicViewModel));
        }
コード例 #2
0
        public ActionResult SubCategory(long id = 0)
        {
            PublicViewModel pv = new PublicViewModel();

            if (Session["CompanySetting"] != null)
            {
                pv.CompanySetting = (CompanySetting)Session["CompanySetting"];
            }
            else
            {
                pv.CompanySetting = CompanySettingsManager.GetCompanySettings(1);
            }

            if (id > 0)
            {
                pv.ProductSubCategories = CategoryManager.GetSubCategoryByCategoryId(id);
                pv.ProductCategory      = CategoryManager.GetProductCategoryById(id);
                if (pv.ProductSubCategories.Count == 0)
                {
                    //pv.Products = CategoryManager.GetAllProductsByCategoryId(id);
                    var routeValues = new RouteValueDictionary {
                        { "id", id },
                        { "category", "category" }
                    };
                    return(RedirectToAction("Products", routeValues));
                }
                return(View(pv));
            }
            return(RedirectToAction("ProductCategory"));
        }
コード例 #3
0
        public ActionResult ProductDetails(long?id)
        {
            PublicViewModel publicViewModel = new PublicViewModel();

            if (Session["CompanySetting"] != null)
            {
                publicViewModel.CompanySetting = (CompanySetting)Session["CompanySetting"];
            }
            else
            {
                publicViewModel.CompanySetting = CompanySettingsManager.GetCompanySettings(1);
            }

            if (!string.IsNullOrEmpty(id.ToString()) && id > 0)
            {
                publicViewModel.Product = ProductManager.GetProductById(id);
                if (publicViewModel.Product != null)
                {
                    try
                    {
                        publicViewModel.ProductGalleries = ProductManager.GetAllProductGalleriesByProductId(id);
                    }
                    catch (Exception ex)
                    {
                        Console.WriteLine(ex.Message);
                        publicViewModel.ProductGalleries = new List <ProductGallery>();
                    }
                    return(View(publicViewModel));
                }
            }

            return(View(publicViewModel));
        }
コード例 #4
0
        public async Task <ActionResult <PublicViewModel> > GetPublicData()
        {
            try
            {
                var buyerPersonalInfos = await buyerDbContext.BuyerPersonalInfos.ToListAsync();

                var buyerContactInfos = await buyerDbContext.BuyerContactInfos.ToListAsync();

                var colors = await attributeDbContext.Colors.ToListAsync();

                var currencies = await attributeDbContext.Currencies.ToListAsync();

                var sizes = await attributeDbContext.Sizes.ToListAsync();

                PublicViewModel publicViewModel = new PublicViewModel
                {
                    lstBuyerContactInfos  = buyerContactInfos,
                    lstBuyerPersonalInfos = buyerPersonalInfos,
                    lstColors             = colors,
                    lstCurrencies         = currencies,
                    lstSizes = sizes,
                };
                return(Ok(new { obj = publicViewModel }));
            }
            catch (Exception e)
            {
                throw e;
            }
        }
コード例 #5
0
        public void Init(PublicViewModel mod)
        {
            _thisMod   = mod;
            _thisStack = new StackLayout();
            var tempCard = new DutchBlitzCardInformation();
            var thisP    = Resolve <IProportionImage>();

            HeightRequest                = tempCard.DefaultSize.Height * thisP.Proportion;
            _thisStack.Orientation       = StackOrientation.Horizontal; // start out horizontally
            _thisStack.HorizontalOptions = LayoutOptions.Start;
            _thisStack.VerticalOptions   = LayoutOptions.Start;
            Grid grid = new Grid();

            _drawControl = new SKCanvasView();
            _drawControl.EnableTouchEvents = true;
            _drawControl.Touch            += TouchEvent;
            _pileList = _thisMod.PileList; // i think its that simple.
            _pileList.CollectionChanged += PileList_CollectionChanged;
            foreach (var thisPile in _pileList)
            {
                IndividualPileXF thisCon = new IndividualPileXF();
                thisCon.ThisPile = thisPile;
                thisCon.MainMod  = _thisMod;
                thisCon.Init(); // i think i needed this as well
                _thisStack.Children.Add(thisCon);
            }
            grid.Children.Add(_drawControl);
            grid.Children.Add(_thisStack);
            Content = grid;
        }
コード例 #6
0
        public void Init(PublicViewModel mod)
        {
            Background = Brushes.Transparent;
            _thisMod   = mod;
            _thisStack = new WrapPanel();
            var tempCard = new DutchBlitzCardInformation();
            var thisP    = Resolve <IProportionImage>();

            _thisStack.ItemHeight  = tempCard.DefaultSize.Height * thisP.Proportion;
            _thisStack.ItemWidth   = tempCard.DefaultSize.Width * thisP.Proportion;
            _thisStack.Orientation = Orientation.Horizontal; // start out horizontally
            MouseUp  += PublicPilesWPF_MouseUp;
            _pileList = _thisMod.PileList;                   // i think its that simple.
            _pileList.CollectionChanged += PileList_CollectionChanged;
            foreach (var thisPile in _pileList)
            {
                IndividualPileWPF thisCon = new IndividualPileWPF();
                thisCon.IsHitTestVisible = true;
                thisCon.ThisPile         = thisPile;
                thisCon.MainMod          = _thisMod;
                thisCon.Init(); // i think i needed this as well
                _thisStack.Children.Add(thisCon);
            }
            Content = _thisStack;
        }
コード例 #7
0
        public ActionResult About()
        {
            PublicViewModel publicViewModel = new PublicViewModel();

            publicViewModel.OurClients = ClientManager.GetAllClients();
            publicViewModel.AboutUs    = HomeManager.GetAboutUs(1);
            return(View(publicViewModel));
        }
コード例 #8
0
        public ActionResult Gallery()
        {
            PublicViewModel pv = new PublicViewModel();

            pv.ImageGalleries = NewsEventsManager.GetAllImageGallery();
            pv.VideoGalleries = NewsEventsManager.GetAllVideoGallery();

            return(View(pv));
        }
コード例 #9
0
        public ActionResult ProductDetails(PublicViewModel pv)
        {
            if (!ModelState.IsValid)
            {
                pv.ProductGalleries = ProductManager.GetAllProductGalleriesByProductId(pv.Product.Id);
                return(View(pv));
            }
            if (Session["CompanySetting"] != null)
            {
                pv.CompanySetting = (CompanySetting)Session["CompanySetting"];
            }
            else
            {
                pv.CompanySetting = CompanySettingsManager.GetCompanySettings(1);
            }

            FeedbackManager.InsertFeedback(pv.Feedback);

            try
            {
                string path = System.Web.HttpContext.Current.Server.MapPath("~/Mail/mz-email.html");
                string html = System.IO.File.ReadAllText(path);
                html = html.Replace("{name}", pv.Feedback.Name);
                html = html.Replace("{mobile}", pv.Feedback.Mobile);
                html = html.Replace("{message}", pv.Feedback.Message);
                html = html.Replace("{p_name}", pv.Product.ProductName);
                html = html.Replace("{p_price}", pv.Product.Price.ToString());
                html = html.Replace("{p_link}", Request.Url?.AbsoluteUri);
                html = html.Replace("{date}", DateTime.Now.ToString("dd MMM yyyy"));

                bool hasWords = HasBadWords(pv.Feedback.Message);

                if (hasWords == false)
                {
                    SendEmailFromGoDaddy("MazedaMart contact us inquiry", html);
                }

                StringBuilder sb = new StringBuilder();
                sb.AppendFormat("<div class=\"alert alert-success\" id=\"contactSuccess\">");
                sb.AppendFormat("<strong>Success!</strong> Your message has been sent to us.");
                sb.AppendFormat("</div>");
                //pv.EmailStatus = sb.ToString();
                Session["EmailStatus"] = sb.ToString();
            }
            catch (Exception ex)
            {
                StringBuilder sb = new StringBuilder();
                sb.AppendFormat("<div class=\"alert alert-success\" id=\"contactSuccess\">");
                sb.AppendFormat(" <strong>Error!</strong> There was an error sending your message.{0} - {1}", ex.Message, ex.InnerException?.Message);
                sb.AppendFormat("<span class=\"font-size-xs mt-sm display-block\" id=\"mailErrorMessage\"></span>");
                sb.AppendFormat("</div>");
                //pv.EmailStatus = sb.ToString();
                Session["EmailStatus"] = sb.ToString();
            }

            return(Redirect("/Home/ProductDetails/" + pv.Product.Id));
        }
コード例 #10
0
        public ActionResult SearchResult(string searchKey = "")
        {
            PublicViewModel pv = new PublicViewModel();

            if (!string.IsNullOrEmpty(searchKey))
            {
                pv.SearchResults = SearchManager.GetSearchResults(searchKey);
                return(View(pv));
            }

            return(View());
        }
コード例 #11
0
 public DutchBlitzVMData(IEventAggregator aggregator, CommandContainer command, DutchBlitzGameContainer gameContainer)
 {
     Deck1          = new DeckObservablePile <DutchBlitzCardInformation>(aggregator, command);
     Pile1          = new PileObservable <DutchBlitzCardInformation>(aggregator, command);
     PlayerHand1    = new HandObservable <DutchBlitzCardInformation>(command);
     Stops          = new CustomStopWatchCP();
     _aggregator    = aggregator;
     _command       = command;
     _gameContainer = gameContainer;
     Stops.MaxTime  = 7000;
     Pile1.Text     = "Waste";
     StockPile      = new StockViewModel(command, aggregator);
     PublicPiles1   = new PublicViewModel(gameContainer);           //hopefully no overflows using the game container (?)
     OtherPile      = Pile1;
 }
コード例 #12
0
        public ActionResult Contact()
        {
            PublicViewModel publicViewModel = new PublicViewModel();

            if (Session["CompanySetting"] != null)
            {
                publicViewModel.CompanySetting = (CompanySetting)Session["CompanySetting"];
            }
            else
            {
                publicViewModel.CompanySetting = CompanySettingsManager.GetCompanySettings(1);
            }

            return(View(publicViewModel));
        }
コード例 #13
0
 public void UpdateLists(PublicViewModel mod)
 {
     _thisMod = mod;
     _thisStack !.Children.Clear(); //best to just redo this time.
     _pileList !.CollectionChanged -= PileList_CollectionChanged;
     _pileList = _thisMod.PileList;
     _pileList.CollectionChanged += PileList_CollectionChanged;
     foreach (var thisPile in _pileList)
     {
         IndividualPileXF thisCon = new IndividualPileXF();
         thisCon.ThisPile = thisPile;
         thisCon.MainMod  = _thisMod;
         thisCon.Init(); // i think i needed this as well
         _thisStack.Children.Add(thisCon);
     }
 }
コード例 #14
0
        public ActionResult Index()
        {
            PublicViewModel publicViewModel = new PublicViewModel();

            if (Session["CompanySetting"] != null)
            {
                publicViewModel.CompanySetting = (CompanySetting)Session["CompanySetting"];
            }
            else
            {
                publicViewModel.CompanySetting = CompanySettingsManager.GetCompanySettings(1);
            }

            //publicViewModel.OurClients = ClientManager.GetAllClients();
            publicViewModel.Banners           = HomeManager.GetAllBanners();
            publicViewModel.ProductCategories = CategoryManager.GetAllProductCategory();
            return(View(publicViewModel));
        }
コード例 #15
0
        public ActionResult PublicInfo(string widgetZone, object additionalData = null)
        {
            var productsCount = this._settingService.GetSettingByKey <int>("HomePageNewProductsSettings.ProductsCount");
            var products      = _productService.SearchProducts(
                orderBy: ProductSortingEnum.CreatedOn,
                pageSize: productsCount);

            var model = new PublicViewModel();

            model.Products = this.PrepareProductOverviewModels(_workContext,
                                                               _storeContext, _categoryService, _productService, _specificationAttributeService,
                                                               _priceCalculationService, _priceFormatter, _permissionService,
                                                               _localizationService, _taxService, _currencyService,
                                                               _pictureService, _webHelper, _cacheManager,
                                                               _catalogSettings, _mediaSettings, products);


            return(View("~/Plugins/Widgets.HomePageNewProducts/Views/WidgetsHomePageNewProducts/PublicInfo.cshtml", model));
        }
コード例 #16
0
        public ActionResult ProductCategory()
        {
            PublicViewModel publicViewModel = new PublicViewModel();

            if (Session["CompanySetting"] != null)
            {
                publicViewModel.CompanySetting = (CompanySetting)Session["CompanySetting"];
            }
            else
            {
                publicViewModel.CompanySetting = CompanySettingsManager.GetCompanySettings(1);
            }
            publicViewModel.ProductCategories = CategoryManager.GetAllProductCategory();
            if (publicViewModel.ProductCategories.Any() && publicViewModel.ProductCategories.Count > 0)
            {
                return(View(publicViewModel));
            }

            return(RedirectToAction("Index"));
        }
コード例 #17
0
        public ActionResult Products(long id = 0, string category = "")
        {
            Session["EmailStatus"] = null;
            PublicViewModel publicViewModel = new PublicViewModel();

            if (Session["CompanySetting"] != null)
            {
                publicViewModel.CompanySetting = (CompanySetting)Session["CompanySetting"];
            }
            else
            {
                publicViewModel.CompanySetting = CompanySettingsManager.GetCompanySettings(1);
            }

            if (!string.IsNullOrEmpty(id.ToString()))
            {
                if (id == 0)
                {
                    publicViewModel.Products = ProductManager.GetAllProduct();
                }
                else
                {
                    //publicViewModel.ProductSubCategories = CategoryManager.GetSubCategoryByCategoryId(id);
                    if (category.ToLower() != "category")
                    {
                        publicViewModel.Products = CategoryManager.GetAllProductsBySubCategoryId(id);
                    }
                    else
                    {
                        publicViewModel.Products = CategoryManager.GetAllProductsByCategoryId(id);
                    }
                }

                publicViewModel.ProductSubCategory = CategoryManager.GetProductSubCategoryById(id);
                publicViewModel.Feedback           = new Feedback();
                return(View(publicViewModel));
            }

            return(RedirectToAction("ProductCategory"));
        }
コード例 #18
0
        public async Task <JsonResult> GetPackageByTrackingNumber(string trackingNumber)
        {
            if (trackingNumber == "" || trackingNumber == null)
            {
                return(Json(false));
            }
            else
            {
                var package = await _context.Packages
                              .Include(m => m.DeliveryMan)
                              .Include(m => m.PickUpRequest)
                              .Include(m => m.PickUpRequest.LocationFrom)
                              .Include(m => m.LocationTo)
                              .Include(m => m.DeliveryMan)
                              .Include(m => m.PackageCatagory)
                              .Include(m => m.PickUpRequest.Merchant)
                              .Where(m => m.TrackingNumber == trackingNumber).FirstOrDefaultAsync();



                if (package != null)
                {
                    PublicViewModel publicViewModel = new PublicViewModel();
                    publicViewModel.Status          = package.Status;
                    publicViewModel.Merchant        = package.PickUpRequest.Merchant.Name;
                    publicViewModel.LocationFrom    = package.PickUpRequest.LocationFrom.Name;
                    publicViewModel.LocationTo      = package.LocationTo.Name;
                    publicViewModel.PackageCatagory = package.PackageCatagory.Name;
                    publicViewModel.Weight          = (double)package.Weight;
                    publicViewModel.Price           = (double)(package.Price + package.ProductPrice);
                    return(Json(publicViewModel));
                }
                else
                {
                    return(Json(false));
                }
            }
        }