/// <summary>
        /// View the product
        /// </summary>
        /// <returns></returns>
        public ActionResult Details(string id)
        {
            try
            {
                Product Prod = ProductDAO.LoadByBsonId(id);

                try
                {
                    if (Prod != null && !string.IsNullOrWhiteSpace(Prod.Name))
                    {
                        ChimeraWebsite.Helpers.SiteContext.RecordPageView("Ecommerce_ViewProduct=" + Prod.Name);
                    }
                }
                catch (Exception e)
                {
                    CompanyCommons.Logging.WriteLog("ChimeraWebsite.Controllers.ViewProduct.Details.RecordPageVisit()", e);
                }

                SettingGroup EcommerceSettings = SettingGroupDAO.LoadSettingGroupByName(SettingGroupKeys.ECOMMERCE_SETTINGS);

                ViewBag.ProductModel = new ProductModel(EcommerceSettings.GetSettingVal(ECommerceSettingKeys.ViewProductDetailPage), Prod);

                return(View("Details", String.Format("~/Templates/{0}/Views/Shared/Template.Master", Models.ChimeraTemplate.TemplateName)));
            }
            catch (Exception e)
            {
                CompanyCommons.Logging.WriteLog("ChimeraWebsite.Controllers.ViewProductController.Details() " + e.Message);
            }

            //TODO: return 404 page instead?
            return(RedirectToAction("Index", "Home"));
        }
Пример #2
0
        public ActionResult EditSchema(string id, string settingGroupData)
        {
            try
            {
                SettingGroup SettingGroup = new SettingGroup();

                if (!string.IsNullOrWhiteSpace(id))
                {
                    SettingGroup = SettingGroupDAO.LoadSettingGroupById(id);
                }
                else if (string.IsNullOrWhiteSpace(settingGroupData))
                {
                    //add an empty setting for new setting groups
                    SettingGroup.SettingsList.Add(new Setting());
                }
                else
                {
                    SettingGroup = JsonConvert.DeserializeObject <SettingGroup>(settingGroupData);
                }

                ViewBag.SettingGroup          = SettingGroup;
                ViewBag.StaticPropertyKeyList = StaticPropertyDAO.LoadAllKeyNames();
            }
            catch (Exception e)
            {
                CompanyCommons.Logging.WriteLog("ChimeraWebsite.Areas.Admin.Controllers.SettingsController.EditSchema() " + e.Message);
            }

            return(View());
        }
Пример #3
0
        /// <summary>
        /// Get a dictionary where the shipping method type is the key and the value is the global price when selecting that shipping method.
        /// </summary>
        /// <param name="shippingMethods"></param>
        /// <param name="paypalPurchaseSettings"></param>
        /// <returns></returns>
        public static Dictionary <string, decimal> GetGlobalShippingMethodDictionary(StaticProperty shippingMethods = null, SettingGroup paypalPurchaseSettings = null)
        {
            if (shippingMethods == null)
            {
                shippingMethods = StaticPropertyDAO.LoadByKeyName(StaticProperty.SHIPPING_METHOD_PROPERTY_KEY);
            }

            if (paypalPurchaseSettings == null)
            {
                paypalPurchaseSettings = SettingGroupDAO.LoadSettingGroupByName(SettingGroupKeys.PAYPAL_PURCHASE_SETTINGS);
            }

            Dictionary <string, decimal> GlobalShippingMethodDictionary = new Dictionary <string, decimal>();

            if (shippingMethods != null && shippingMethods.PropertyNameValues != null && shippingMethods.PropertyNameValues.Count > 0)
            {
                foreach (var ShippValueKey in shippingMethods.PropertyNameValues)
                {
                    Setting GlobalShippingPriceSetting = paypalPurchaseSettings.SettingsList.Where(e => e.Key.Equals("GlobalBaseShippingAmt_" + ShippValueKey)).FirstOrDefault();

                    decimal GlobalShippingPrice = 0.00m;

                    if (GlobalShippingPriceSetting != null && !string.IsNullOrWhiteSpace(GlobalShippingPriceSetting.Value))
                    {
                        GlobalShippingPrice = Decimal.Parse(GlobalShippingPriceSetting.Value);
                    }

                    GlobalShippingMethodDictionary.Add(ShippValueKey, GlobalShippingPrice);
                }
            }

            return(GlobalShippingMethodDictionary);
        }
Пример #4
0
        /// <summary>
        /// Get the model for the view cart view
        /// </summary>
        /// <returns></returns>
        private ShoppingCartModel GetModel()
        {
            List <SettingGroup> SettingGroupList = SettingGroupDAO.LoadByMultipleGroupNames(new List <string> {
                SettingGroupKeys.ECOMMERCE_SETTINGS, SettingGroupKeys.PAYPAL_PURCHASE_SETTINGS
            });

            SettingGroup EcommerceSettings = SettingGroupList.Where(e => e.GroupKey.Equals(SettingGroupKeys.ECOMMERCE_SETTINGS)).FirstOrDefault();

            SettingGroup PaypalPurchaseSettings = SettingGroupList.Where(e => e.GroupKey.Equals(SettingGroupKeys.PAYPAL_PURCHASE_SETTINGS)).FirstOrDefault();

            StaticProperty ShippingMethods = StaticPropertyDAO.LoadByKeyName(StaticProperty.SHIPPING_METHOD_PROPERTY_KEY);

            return(new ShoppingCartModel(PaypalPurchaseSettings, EcommerceSettings.GetSettingVal(ECommerceSettingKeys.ViewShoppingCartPage), ShippingMethods));
        }
Пример #5
0
        public ActionResult InitCheckout(string shippingMethod)
        {
            try
            {
                List <ShoppingCartProduct> ShoppingCartList = SiteContext.ShoppingCartProductList;

                SettingGroup PayPalSettings = SettingGroupDAO.LoadSettingGroupByName(SettingGroupKeys.PAYPAL_PURCHASE_SETTINGS);

                //create auth header obj
                AuthHeader PayPalAuthHeader = Chimera.Core.PurchaseOrders.PayPalAuthHeader.GetAuthHeaderFromSetting(PayPalSettings);

                //create authorization obj
                Authorization PayPalAuthorization = new Authorization();

                string BaseWebsiteURL = CM.AppSettings["BaseWebsiteURL"];

                PayPalAuthorization.StoreImageURL   = PayPalSettings.GetSettingVal(PayPalSettingKeys.PayPal_HDRIMG);
                PayPalAuthorization.SuccessOrderURL = BaseWebsiteURL + "Order/PayPalSuccess";
                PayPalAuthorization.CancelOrderURL  = BaseWebsiteURL + "Order/PayPalCancel";

                //create purchase order details obj
                PurchaseOrderDetails PurchaseOrder = new PurchaseOrderDetails(shippingMethod, ShoppingCartList, Helpers.ShippingMethod.GetGlobalShippingMethodDictionary(null, PayPalSettings)[shippingMethod], PayPalSettings.GetSettingVal(PayPalSettingKeys.GlobalTaxAmount));

                //call paypal API to get new order details
                OrderDetails AuthOrderDetails = CompanyCommons.Ecommerce.PayPal.Functions.Execute.Authorization(PayPalAuthHeader, PayPalAuthorization, PurchaseOrder.PayPalOrderDetails, PurchaseOrder.CreatePayPalItemDescriptions());

                if (AuthOrderDetails != null)
                {
                    //store purchase order object into session
                    PurchaseOrder.PayPalOrderDetails = AuthOrderDetails;

                    //add updated info to session
                    SiteContext.PayPalPurchaseOrder = PurchaseOrder;

                    //redirect to paypal
                    return(Redirect(CompanyCommons.Ecommerce.PayPal.Functions.Execute.GetAuthorizationRedirectURL(PayPalSettings.GetSettingVal(PayPalSettingKeys.PayPal_REDIRECT), AuthOrderDetails)));
                }

                //if we got this far the call the paypal's API failed
            }
            catch (Exception e)
            {
                CompanyCommons.Logging.WriteLog("ChimeraWebsite.Controllers.OrderController.InitCheckout() " + e.Message);
            }

            //TODO: return 404 page instead?
            return(RedirectToAction("Index", "Home"));
        }
Пример #6
0
        public void ProcessFile()
        {
            XmlDocument XmlDoc = new XmlDocument();

            XmlDoc.Load(FilePath);

            foreach (var Node in XmlDoc.DocumentElement.GetElementsByTagName("SettingGroup"))
            {
                XmlElement Element = (XmlElement)Node;

                SettingGroup SetGroup = new SettingGroup();

                SetGroup.GroupKey         = Element.GetElementsByTagName("GroupKey")[0].InnerText;
                SetGroup.UserFriendlyName = Element.GetElementsByTagName("UserFriendlyName")[0].InnerText;
                SetGroup.Description      = Element.GetElementsByTagName("Description")[0].InnerText;
                SetGroup.ParentCategory   = (ParentCategoryType)Enum.Parse(typeof(ParentCategoryType), Element.GetElementsByTagName("ParentCategory")[0].InnerText);

                foreach (var ChildNode in Element.GetElementsByTagName("Setting"))
                {
                    XmlElement ChildElement = (XmlElement)ChildNode;

                    Setting Sett = new Setting();

                    Sett.Key = ChildElement.GetElementsByTagName("Key")[0].InnerText;
                    Sett.UserFriendlyName           = ChildElement.GetElementsByTagName("UserFriendlyName")[0].InnerText;
                    Sett.Description                = ChildElement.GetElementsByTagName("Description")[0].InnerText;
                    Sett.Value                      = ChildElement.GetElementsByTagName("Value")[0].InnerText;
                    Sett.EntryType                  = (DataEntryType)Enum.Parse(typeof(DataEntryType), ChildElement.GetElementsByTagName("EntryType")[0].InnerText);
                    Sett.DataEntryStaticPropertyKey = ChildElement.GetElementsByTagName("DataEntryStaticPropertyKey")[0].InnerText;

                    foreach (var ChildChildNode in ChildElement.GetElementsByTagName("SettingAttribute"))
                    {
                        XmlElement ChildChildElement = (XmlElement)ChildChildNode;

                        SettingAttribute SetAttr = new SettingAttribute();

                        SetAttr.Key   = ChildChildElement.GetElementsByTagName("Key")[0].InnerText;
                        SetAttr.Value = ChildChildElement.GetElementsByTagName("Value")[0].InnerText;

                        Sett.SettingAttributeList.Add(SetAttr);
                    }

                    SetGroup.SettingsList.Add(Sett);
                }

                SettingGroupDAO.Save(SetGroup);
            }
        }
Пример #7
0
        public ActionResult EditSchema_Post(string settingGroupData)
        {
            try
            {
                SettingGroup SettingGroup = JsonConvert.DeserializeObject <SettingGroup>(settingGroupData);

                List <WebUserMessage> ErrorList = SettingGroup.Validate();

                //if passed validation
                if (ErrorList == null || ErrorList.Count == 0)
                {
                    //remove data entry property key if data entry does not require just to be safe
                    foreach (var Sett in SettingGroup.SettingsList)
                    {
                        if (!DataEntryTypeProperty.DataTypesRequireProperties.Contains(Sett.EntryType))
                        {
                            Sett.DataEntryStaticPropertyKey = string.Empty;
                        }
                    }

                    if (SettingGroupDAO.Save(SettingGroup))
                    {
                        AddWebUserMessageToSession(Request, String.Format("Successfully saved/updated setting group \"{0}\"", SettingGroup.GroupKey), SUCCESS_MESSAGE_TYPE);
                    }
                    else
                    {
                        AddWebUserMessageToSession(Request, String.Format("Unable to saved/update setting group \"{0}\" at this time", SettingGroup.GroupKey), FAILED_MESSAGE_TYPE);
                    }
                }
                //failed validation
                else
                {
                    AddWebUserMessageToSession(Request, ErrorList);

                    return(RedirectToAction("EditSchema", "Settings", new { settingGroupData = settingGroupData }));
                }

                return(RedirectToAction("Index", "Dashboard"));
            }
            catch (Exception e)
            {
                CompanyCommons.Logging.WriteLog("ChimeraWebsite.Areas.Admin.Controllers.SettingsController.EditSchema_Post() " + e.Message);
            }

            AddWebUserMessageToSession(Request, String.Format("Unable to save/update setting schemas at this time."), FAILED_MESSAGE_TYPE);

            return(RedirectToAction("Index", "Dashboard"));
        }
Пример #8
0
        public ActionResult ShipOrder(string id, string trackingNumber)
        {
            try
            {
                PurchaseOrderDetails PurchaseOrderDetail = PurchaseOrderDetailsDAO.LoadByBsonId(id);

                PurchaseOrderDetail.PayPalOrderDetails.ShippingTrackingNumber = trackingNumber;
                PurchaseOrderDetail.PayPalOrderDetails.OrderShippedDateUtc    = DateTime.UtcNow;

                if (PurchaseOrderDetailsDAO.Save(PurchaseOrderDetail))
                {
                    Chimera.Core.Notifications.PurchaseOrder.ProcessPurchaseOrderShipped(PurchaseOrderDetail);

                    try
                    {
                        List <SettingGroup> SettingGroupList = SettingGroupDAO.LoadByMultipleGroupNames(new List <string> {
                            SettingGroupKeys.TEMPLATE_CUSTOM_SETTINGS, SettingGroupKeys.EMAIL_SETTINGS
                        });

                        SettingGroup EmailSettings = SettingGroupList.Where(e => e.GroupKey.Equals(SettingGroupKeys.EMAIL_SETTINGS)).FirstOrDefault();

                        SettingGroup TemplateSettings = SettingGroupList.Where(e => e.GroupKey.Equals(SettingGroupKeys.TEMPLATE_CUSTOM_SETTINGS)).FirstOrDefault();

                        Chimera.Emails.Ecommerce.SendOrderShippedEmail(PurchaseOrderDetail, EmailSettings.GetSettingVal(EmailSettingKeys.CustomerOrderShippedEmail), EmailSettings.GetSettingVal(EmailSettingKeys.SenderEmailAddress), TemplateSettings.GetSettingVal("WebsiteTitle"));
                    }
                    catch (Exception e)
                    {
                        CompanyCommons.Logging.WriteLog("ChimeraWebsite.Areas.Admin.Controllers.PurchaseOrdersController.ShipOrder.SendEmail()" + e.Message);
                    }

                    AddWebUserMessageToSession(Request, String.Format("Tracking # added and user notified order shipped!"), SUCCESS_MESSAGE_TYPE);
                }
                else
                {
                    AddWebUserMessageToSession(Request, String.Format("Unable to add tracking # and email user of shipped order."), FAILED_MESSAGE_TYPE);
                }
            }
            catch (Exception e)
            {
                CompanyCommons.Logging.WriteLog("ChimeraWebsite.Areas.Admin.Controllers.PurchaseOrdersController.ShipOrder()" + e.Message);
            }

            return(RedirectToAction("Search", "PurchaseOrders"));
        }
Пример #9
0
        /// <summary>
        /// User redirected back here from paypal after successfully filling out all the necessary form data from paypal
        /// </summary>
        /// <returns></returns>
        public ActionResult PayPalSuccess()
        {
            try
            {
                if (!string.IsNullOrWhiteSpace(SiteContext.PayPalPurchaseOrder.PayPalOrderDetails.PaypalInfo.Token))
                {
                    SiteContext.RecordPageView("Ecommerce_PayPalSuccess");

                    List <SettingGroup> SettingGroupList = SettingGroupDAO.LoadByMultipleGroupNames(new List <string> {
                        SettingGroupKeys.ECOMMERCE_SETTINGS, SettingGroupKeys.PAYPAL_PURCHASE_SETTINGS
                    });

                    SettingGroup PayPalSettings = SettingGroupList.Where(e => e.GroupKey.Equals(SettingGroupKeys.PAYPAL_PURCHASE_SETTINGS)).FirstOrDefault();

                    //create auth header obj
                    AuthHeader PayPalAuthHeader = Chimera.Core.PurchaseOrders.PayPalAuthHeader.GetAuthHeaderFromSetting(PayPalSettings);

                    PurchaseOrderDetails PayPalPurchaseOrder = SiteContext.PayPalPurchaseOrder;

                    OrderDetails CheckoutOrderDetails = CompanyCommons.Ecommerce.PayPal.Functions.Execute.ExpressCheckout(PayPalAuthHeader, PayPalPurchaseOrder.PayPalOrderDetails);

                    if (CheckoutOrderDetails != null)
                    {
                        PayPalPurchaseOrder.PayPalOrderDetails = CheckoutOrderDetails;

                        SiteContext.PayPalPurchaseOrder = PayPalPurchaseOrder;

                        SettingGroup EcommerceSettings = SettingGroupList.Where(e => e.GroupKey.Equals(SettingGroupKeys.ECOMMERCE_SETTINGS)).FirstOrDefault();

                        ViewBag.PayPalSuccessModel = new PayPalSuccessModel(EcommerceSettings.GetSettingVal(ECommerceSettingKeys.FinalizeCheckoutPage), PayPalPurchaseOrder);

                        return(View("PayPalSuccess", String.Format("~/Templates/{0}/Views/Shared/Template.Master", Models.ChimeraTemplate.TemplateName)));
                    }
                }
            }
            catch (Exception e)
            {
                CompanyCommons.Logging.WriteLog("ChimeraWebsite.Controllers.OrderController.PayPalSuccess() " + e.Message);
            }

            //TODO: return 404 page instead?
            return(RedirectToAction("Index", "Home"));
        }
Пример #10
0
        public ActionResult EditValues(string id)
        {
            try
            {
                SettingGroup SettingGroup = SettingGroupDAO.LoadSettingGroupById(id);

                List <string> StaticPropertyKeys = (from e in SettingGroup.SettingsList.AsQueryable() where DataEntryTypeProperty.DataTypesRequireProperties.Contains(e.EntryType) && !string.IsNullOrWhiteSpace(e.DataEntryStaticPropertyKey) select e.DataEntryStaticPropertyKey).ToList();

                ViewBag.SettingGroup = SettingGroup;

                ViewBag.StaticPropertyList = StaticPropertyKeys != null && StaticPropertyKeys.Count > 0 ?StaticPropertyDAO.LoadByMultipleKeyNames(StaticPropertyKeys) : new List <StaticProperty>();

                ViewBag.ImageList = ImageDAO.LoadAll();
            }
            catch (Exception e)
            {
                CompanyCommons.Logging.WriteLog("ChimeraWebsite.Areas.Admin.Controllers.SettingsController.EditValues() " + e.Message);
            }

            return(View());
        }
Пример #11
0
        public ActionResult EditValues_Post(string id)
        {
            try
            {
                SettingGroup SettingGroup = SettingGroupDAO.LoadSettingGroupById(id);

                foreach (var Sett in SettingGroup.SettingsList)
                {
                    if (!string.IsNullOrWhiteSpace(Request["setting_" + Sett.Key]))
                    {
                        Sett.Value = Request["setting_" + Sett.Key];
                    }
                    else
                    {
                        Sett.Value = string.Empty;
                    }
                }

                if (SettingGroupDAO.Save(SettingGroup))
                {
                    AddWebUserMessageToSession(Request, String.Format("Successfully saved/updated setting group \"{0}\"", SettingGroup.GroupKey), SUCCESS_MESSAGE_TYPE);
                }
                else
                {
                    AddWebUserMessageToSession(Request, String.Format("Unable to saved/update setting group \"{0}\" at this time", SettingGroup.GroupKey), FAILED_MESSAGE_TYPE);
                }

                return(RedirectToAction("Index", "Dashboard"));
            }
            catch (Exception e)
            {
                CompanyCommons.Logging.WriteLog("ChimeraWebsite.Areas.Admin.Controllers.SettingsController.EditValues_Post() " + e.Message);
            }

            AddWebUserMessageToSession(Request, String.Format("Unable to save/update setting values at this time."), FAILED_MESSAGE_TYPE);

            return(RedirectToAction("Index", "Dashboard"));
        }
Пример #12
0
        public ActionResult Index(string friendlyURL, string previewPageData)
        {
            friendlyURL = string.IsNullOrWhiteSpace(friendlyURL) ? "Index" : friendlyURL;

            if (friendlyURL.ToUpper().Equals("ADMIN"))
            {
                return(RedirectToRoute("Admin_Default"));
            }

            Models.PageModel PageModel = new Models.PageModel();

            if (!string.IsNullOrWhiteSpace(previewPageData))
            {
                ViewBag.PreviewPageData = previewPageData;
                PageModel.InEditMode    = true;
            }
            else
            {
                PageModel = new Models.PageModel(friendlyURL, Request);
            }

            if (!string.IsNullOrWhiteSpace(PageModel.Page.Id) || PageModel.InEditMode)
            {
                ViewBag.PageModel = PageModel;

                return(View("Index", String.Format("~/Templates/{0}/Views/Shared/Template.Master", Models.ChimeraTemplate.TemplateName)));
            }

            //if we got this far this is a 404

            SettingGroup SettingGroup = SettingGroupDAO.LoadSettingGroupByName(SettingGroupKeys.TEMPLATE_CUSTOM_SETTINGS);

            ViewBag.ViewType = SettingGroup.GetSettingVal("PageNotFoundPage");

            return(View("PageNotFound", String.Format("~/Templates/{0}/Views/Shared/Template.Master", Models.ChimeraTemplate.TemplateName)));
        }
Пример #13
0
        public ActionResult CapturePayment(string id)
        {
            try
            {
                PurchaseOrderDetails PurchaseOrderDetail = PurchaseOrderDetailsDAO.LoadByBsonId(id);

                SettingGroup PayPalSettings = SettingGroupDAO.LoadSettingGroupByName(SettingGroupKeys.PAYPAL_PURCHASE_SETTINGS);

                //create auth header obj
                AuthHeader PayPalAuthHeader = Chimera.Core.PurchaseOrders.PayPalAuthHeader.GetAuthHeaderFromSetting(PayPalSettings);

                OrderDetails CapturedOrderDetails = CompanyCommons.Ecommerce.PayPal.Functions.Execute.CapturePayment(PayPalAuthHeader, PurchaseOrderDetail.PayPalOrderDetails);

                if (CapturedOrderDetails != null)
                {
                    PurchaseOrderDetail.PayPalOrderDetails = CapturedOrderDetails;

                    if (PurchaseOrderDetailsDAO.Save(PurchaseOrderDetail))
                    {
                        Chimera.Core.Notifications.PurchaseOrder.ProcessPurchaseOrderPaymentCaptured(PurchaseOrderDetail);

                        AddWebUserMessageToSession(Request, String.Format("PayPal payment successfully captured!"), SUCCESS_MESSAGE_TYPE);
                    }
                    else
                    {
                        AddWebUserMessageToSession(Request, String.Format("Unable to capture PayPal payment at this time."), FAILED_MESSAGE_TYPE);
                    }
                }
            }
            catch (Exception e)
            {
                CompanyCommons.Logging.WriteLog("ChimeraWebsite.Areas.Admin.Controllers.PurchaseOrdersController.CapturePayment()" + e.Message);
            }

            return(RedirectToAction("Search", "PurchaseOrders"));
        }
Пример #14
0
        /// <summary>
        /// Called after the user reviews their order on our side right and wishes to finalize the purchase
        /// </summary>
        /// <returns></returns>
        public ActionResult FinalCheckout()
        {
            SiteContext.RecordPageView("Ecommerce_FinalCheckout");

            try
            {
                PurchaseOrderDetails PayPalPurchaseOrder = SiteContext.PayPalPurchaseOrder;

                if (PayPalPurchaseOrder != null && !string.IsNullOrWhiteSpace(PayPalPurchaseOrder.PayPalOrderDetails.PaypalInfo.Token))
                {
                    List <SettingGroup> SettingGroupList = SettingGroupDAO.LoadByMultipleGroupNames(new List <string> {
                        SettingGroupKeys.TEMPLATE_CUSTOM_SETTINGS, SettingGroupKeys.EMAIL_SETTINGS, SettingGroupKeys.ECOMMERCE_SETTINGS, SettingGroupKeys.PAYPAL_PURCHASE_SETTINGS
                    });

                    SettingGroup PayPalSettings = SettingGroupList.Where(e => e.GroupKey.Equals(SettingGroupKeys.PAYPAL_PURCHASE_SETTINGS)).FirstOrDefault();

                    //create auth header obj
                    AuthHeader PayPalAuthHeader = Chimera.Core.PurchaseOrders.PayPalAuthHeader.GetAuthHeaderFromSetting(PayPalSettings);

                    OrderDetails FinalOrderDetails = CompanyCommons.Ecommerce.PayPal.Functions.Execute.FinalConfirmedAuthorization(PayPalAuthHeader, PayPalPurchaseOrder.PayPalOrderDetails);

                    if (FinalOrderDetails != null)
                    {
                        PayPalPurchaseOrder.PayPalOrderDetails = FinalOrderDetails;

                        //generate a new id so we can give the user a confirmation #
                        PayPalPurchaseOrder.Id = ObjectId.GenerateNewId().ToString();

                        //save to the database as an order
                        PurchaseOrderDetailsDAO.Save(PayPalPurchaseOrder);

                        //clear session cart
                        SiteContext.ClearShoppingCart();

                        //subtract stock from current products
                        Chimera.Core.PurchaseOrders.ProductStock.ProcessNewOrderStockLevels(PayPalSettings, PayPalPurchaseOrder);

                        //send emails
                        Chimera.Core.PurchaseOrders.Email.SendNewEcommerceOrderEmails(SettingGroupList, PayPalPurchaseOrder);

                        //add admin notification
                        Chimera.Core.Notifications.PurchaseOrder.ProcessNewPurchaseOrder(PayPalPurchaseOrder);

                        //return view
                        SettingGroup EcommerceSettings = SettingGroupList.Where(e => e.GroupKey.Equals(SettingGroupKeys.ECOMMERCE_SETTINGS)).FirstOrDefault();

                        ViewBag.ConfirmationNumber = PayPalPurchaseOrder.Id.ToString();
                        ViewBag.ViewType           = EcommerceSettings.GetSettingVal(ECommerceSettingKeys.CheckoutFinishedPage);

                        return(View("FinalCheckout", String.Format("~/Templates/{0}/Views/Shared/Template.Master", Models.ChimeraTemplate.TemplateName)));
                    }
                }
            }
            catch (Exception e)
            {
                CompanyCommons.Logging.WriteLog("ChimeraWebsite.Controllers.OrderController.FinalCheckout() " + e.Message);
            }

            //TODO: return 404 page instead?
            return(RedirectToAction("Index", "Home"));
        }
Пример #15
0
        public ActionResult ViewAll()
        {
            ViewBag.SettingGroupList = SettingGroupDAO.LoadAll();

            return(View());
        }