protected void OkButton_Click(object sender, EventArgs e)
        {
            // Looping through all the rows in the GridView
            foreach (GridViewRow row in SearchResultsGrid.Rows)
            {
                CheckBox checkbox = (CheckBox)row.FindControl("SelectCheckbox");
                if ((checkbox != null) && (checkbox.Checked))
                {
                    // Retreive the DigitalGood
                    int         digitalGoodId = Convert.ToInt32(SearchResultsGrid.DataKeys[row.RowIndex].Value);
                    DigitalGood dg            = DigitalGoodDataSource.Load(digitalGoodId);

                    // ( Bug 8262 ) CREATE A NEW ORDER ITEM FOR EACH DIGITAL GOOD
                    OrderItem oi = new OrderItem();
                    oi.OrderId = _OrderId;
                    oi.CustomFields["DigitalGoodIndicator"] = "1";
                    oi.Name          = dg.Name;
                    oi.OrderItemType = OrderItemType.Product;
                    oi.Price         = 0;
                    oi.Quantity      = 1;
                    oi.Shippable     = Shippable.No;
                    oi.IsHidden      = true;
                    oi.Save();

                    OrderItemDigitalGood orderItemDigitalGood = new OrderItemDigitalGood();
                    orderItemDigitalGood.OrderItemId   = oi.Id;
                    orderItemDigitalGood.DigitalGoodId = digitalGoodId;
                    orderItemDigitalGood.Name          = dg.Name;
                    orderItemDigitalGood.Save();
                    orderItemDigitalGood.Save();
                }
            }
            Response.Redirect(string.Format("ViewDigitalGoods.aspx?OrderNumber={0}", _Order.OrderNumber));
        }
        protected void AttachButton_Click(object sender, EventArgs e)
        {
            string attach = Request.Form["attach"];

            if (!string.IsNullOrEmpty(attach))
            {
                string[] ids = attach.Replace(" ", "").Split(",".ToCharArray());
                foreach (string strId in ids)
                {
                    int         dgid = AlwaysConvert.ToInt(strId);
                    DigitalGood dg   = DigitalGoodDataSource.Load(dgid);
                    if (dg != null)
                    {
                        int index = _Product.DigitalGoods.IndexOf(dg.Id);
                        if (index < 0)
                        {
                            ProductDigitalGood pdg = new ProductDigitalGood();
                            pdg.Product     = _Product;
                            pdg.OptionList  = _OptionList;
                            pdg.DigitalGood = dg;
                            _Product.DigitalGoods.Add(pdg);
                        }
                    }
                }
                _Product.DigitalGoods.Save();
            }
            Response.Redirect(CancelButton.NavigateUrl);
        }
Exemplo n.º 3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            _DigitalGoodId = AlwaysConvert.ToInt(Request.QueryString["DigitalGoodId"]);
            _DigitalGood   = DigitalGoodDataSource.Load(_DigitalGoodId);
            if (_DigitalGood == null)
            {
                Response.Redirect("Default.aspx");
            }
            Caption.Text = string.Format(Caption.Text, _DigitalGood.Name);
            //GET ALL ORDER ITEMS ASSOCIATED WITH DIGITAL GOOD
            IList <OrderItemDigitalGood> oidgs = OrderItemDigitalGoodDataSource.LoadForDigitalGood(_DigitalGoodId);
            //BUILD DISTINCT LIST OF ORDERS
            List <Order> orders = new List <Order>();

            foreach (OrderItemDigitalGood oidg in oidgs)
            {
                Order order = oidg.OrderItem.Order;
                if (orders.IndexOf(order) < 0)
                {
                    orders.Add(order);
                }
            }
            //BIND TO GRID
            OrderGrid.DataSource = orders;
            OrderGrid.DataBind();
        }
Exemplo n.º 4
0
        private IList <DigitalGood> GetFileDigitalGoods(string fileName)
        {
            ICriteria criteria = NHibernateHelper.CreateCriteria <DigitalGood>();

            criteria.Add(Restrictions.Eq("Store", AbleContext.Current.Store));
            criteria.Add(Restrictions.Eq("ServerFileName", StringHelper.SafeSqlString(_RelativeDigitalGoodPath + fileName)));
            return(DigitalGoodDataSource.LoadForCriteria(criteria));
        }
Exemplo n.º 5
0
 protected void SearchResultsGrid_RowCommand(object sender, GridViewCommandEventArgs e)
 {
     if (e.CommandName == "Download")
     {
         int         digitalGoodId = AlwaysConvert.ToInt(e.CommandArgument);
         DigitalGood dg            = DigitalGoodDataSource.Load(digitalGoodId);
         if (dg != null)
         {
             AbleCommerce.Code.PageHelper.SendFileDataToClient(dg);
         }
     }
 }
Exemplo n.º 6
0
        protected void Page_Load(object sender, EventArgs e)
        {
            int digitalGoodId = AlwaysConvert.ToInt(Request.QueryString["DigitalGoodId"]);

            _DigitalGood = DigitalGoodDataSource.Load(digitalGoodId);
            if (_DigitalGood == null)
            {
                Response.Redirect("~/Admin/DigitalGoods/DigitalGoods.aspx");
            }
            _SerialKeyProviderId = Misc.GetClassId(typeof(DefaultSerialKeyProvider));
            Caption.Text         = string.Format(Caption.Text, _DigitalGood.Name);
        }
Exemplo n.º 7
0
        protected int GetProductCount(object dataItem)
        {
            Readme m = (Readme)dataItem;

            if (_ProductCounts.ContainsKey(m.Id))
            {
                return(_ProductCounts[m.Id]);
            }
            int count = DigitalGoodDataSource.CountForReadme(m.Id);

            _ProductCounts[m.Id] = count;
            return(count);
        }
Exemplo n.º 8
0
        protected int GetProductCount(object dataItem)
        {
            LicenseAgreement m = (LicenseAgreement)dataItem;

            if (_ProductCounts.ContainsKey(m.Id))
            {
                return(_ProductCounts[m.Id]);
            }
            int count = DigitalGoodDataSource.CountForLicenseAgreement(m.Id);

            _ProductCounts[m.Id] = count;
            return(count);
        }
 protected void Page_InIt(object sender, EventArgs e)
 {
     _DigitalGoodId = AlwaysConvert.ToInt(Request.QueryString["DigitalGoodId"]);
     _DigitalGood   = DigitalGoodDataSource.Load(_DigitalGoodId);
     if (_DigitalGood == null)
     {
         Response.Redirect("Default.aspx");
     }
     Caption.Text = string.Format(Caption.Text, _DigitalGood.Name);
     FindAssignProducts1.AssignmentValue  = _DigitalGoodId;
     FindAssignProducts1.OnAssignProduct += new AssignProductEventHandler(FindAssignProducts1_AssignProduct);
     FindAssignProducts1.OnLinkCheck     += new AssignProductEventHandler(FindAssignProducts1_LinkCheck);
     FindAssignProducts1.OnCancel        += new EventHandler(FindAssignProducts1_CancelButton);
 }
Exemplo n.º 10
0
        private bool DigitalGoodNameExists(String name)
        {
            ICriteria criteria = NHibernateHelper.CreateCriteria <DigitalGood>();

            criteria.Add(Restrictions.Eq("Store", AbleContext.Current.Store));
            criteria.Add(Restrictions.Eq("Name", StringHelper.SafeSqlString(name)));
            IList <DigitalGood> dgc = DigitalGoodDataSource.LoadForCriteria(criteria);

            if (dgc != null && dgc.Count > 0)
            {
                return(true);
            }
            return(false);
        }
        protected void Page_Init(object sender, System.EventArgs e)
        {
            _DigitalGoodId = AlwaysConvert.ToInt(Request.QueryString["DigitalGoodId"]);
            _DigitalGood   = DigitalGoodDataSource.Load(_DigitalGoodId);
            if (_DigitalGood == null)
            {
                Response.Redirect("Default.aspx");
            }
            Caption.Text            = string.Format(Caption.Text, _DigitalGood.Name);
            InstructionText.Text    = string.Format(InstructionText.Text, _DigitalGood.Name);
            ProductsGrid.DataSource = _DigitalGood.ProductDigitalGoods;
            ProductsGrid.DataBind();
            //GET ALL ORDER ITEMS ASSOCIATED WITH DIGITAL GOOD
            IList <OrderItemDigitalGood> oidgs = OrderItemDigitalGoodDataSource.LoadForDigitalGood(_DigitalGoodId);
            //BUILD DISTINCT LIST OF ORDERS
            List <CommerceBuilder.Orders.Order> orders = new List <CommerceBuilder.Orders.Order>();

            foreach (OrderItemDigitalGood oidg in oidgs)
            {
                CommerceBuilder.Orders.Order order = oidg.OrderItem.Order;
                if (orders.IndexOf(order) < 0)
                {
                    orders.Add(order);
                }
            }
            //BIND TO GRID
            OrderGrid.DataSource = orders;
            OrderGrid.DataBind();

            if (!String.IsNullOrEmpty(_DigitalGood.FileName))
            {
                ICriteria criteria = NHibernateHelper.CreateCriteria <DigitalGood>();
                criteria.Add(Restrictions.Eq("FileName", StringHelper.SafeSqlString(_DigitalGood.FileName)));
                IList <DigitalGood> dgc = DigitalGoodDataSource.LoadForCriteria(criteria);
                if (dgc != null && dgc.Count > 1)
                {
                    DeleteAllowedPanel.Visible   = false;
                    DeletePreventedPanel.Visible = true;
                    NoDeleteFileText.Text        = string.Format(NoDeleteFileText.Text, _DigitalGood.FileName);
                }
                else
                {
                    DeleteAllowedPanel.Visible   = true;
                    DeletePreventedPanel.Visible = false;
                    DeleteFile.Text = string.Format(DeleteFile.Text, _DigitalGood.FileName);
                }
            }
        }
Exemplo n.º 12
0
        public void ProcessRequest(HttpContext context)
        {
            context.Server.ScriptTimeout = 14400;
            HttpResponse Response = context.Response;

            // LOAD REQUESTED ORDER ITEM DIGITAL GOOD
            if (!string.IsNullOrEmpty(context.Request.QueryString["id"]))
            {
                int orderItemDigitalGoodId = AlwaysConvert.ToInt(context.Request.QueryString["id"]);
                HandleOrderItemDigitalGood(context, Response, orderItemDigitalGoodId);
            }

            // HANDLE DIGITAL GOOD DOWNLOAD REQUEST
            else if (!string.IsNullOrEmpty(context.Request.QueryString["dgid"]))
            {
                int         digitalGoodId = AlwaysConvert.ToInt(context.Request.QueryString["dgid"]);
                DigitalGood digitalGood   = DigitalGoodDataSource.Load(digitalGoodId);

                // VERIFY DIGITAL GOOD IS VALID
                if (digitalGood != null)
                {
                    bool hasAccess = false;
                    foreach (DigitalGoodGroup dgg in digitalGood.DigitalGoodGroups)
                    {
                        if (AbleContext.Current.User.IsInGroup(dgg.GroupId))
                        {
                            hasAccess = true;
                            break;
                        }
                    }

                    if (hasAccess)
                    {
                        DownloadHelper.SendFileDataToClient(context, digitalGood);
                    }
                    else
                    {
                        Response.Write("You are not authorized to download the requested file.");
                    }
                }
                else
                {
                    Response.Write("The requested file could not be located.");
                }
            }
        }
Exemplo n.º 13
0
        protected void Page_Load(object sender, EventArgs e)
        {
            _CategoryId          = AbleCommerce.Code.PageHelper.GetCategoryId();
            _ProductId           = AlwaysConvert.ToInt(Request.QueryString["ProductId"]);
            _DigitalGoodId       = AlwaysConvert.ToInt(Request.QueryString["DigitalGoodId"]);
            _DigitalGood         = DigitalGoodDataSource.Load(_DigitalGoodId);
            _SerialKeyProviderId = Misc.GetClassId(typeof(DefaultSerialKeyProvider));

            if (_DigitalGood == null)
            {
                if (_ProductId > 0)
                {
                    Response.Redirect("~/Admin/Products/EditProduct.aspx?CategoryId=" + _CategoryId.ToString()
                                      + "&ProductId=" + _ProductId.ToString() + "&DigitalGoodId=" + _DigitalGoodId.ToString());
                }
                else
                {
                    Response.Redirect("~/Admin/DigitalGoods/EditDigitalGood.aspx?DigitalGoodId=" + _DigitalGoodId.ToString());
                }
            }

            _SerialKeyId = AlwaysConvert.ToInt(Request.QueryString["SerialKeyId"]);
            _SerialKey   = SerialKeyDataSource.Load(_SerialKeyId);

            if (_SerialKey == null)
            {
                if (_ProductId > 0)
                {
                    Response.Redirect("~/Admin/Products/EditProduct.aspx?CategoryId=" + _CategoryId.ToString()
                                      + "&ProductId=" + _ProductId.ToString() + "&DigitalGoodId=" + _DigitalGoodId.ToString());
                }
                else
                {
                    Response.Redirect("~/Admin/DigitalGoods/EditDigitalGood.aspx?DigitalGoodId=" + _DigitalGoodId.ToString());
                }
            }

            Caption.Text = string.Format(Caption.Text, _DigitalGood.Name);

            if (!Page.IsPostBack)
            {
                InitializeForm();
            }
        }
Exemplo n.º 14
0
 protected void DigitalGoodGrid_RowCommand(object sender, GridViewCommandEventArgs e)
 {
     if (e.CommandName == "Copy")
     {
         int         dgid        = AlwaysConvert.ToInt(e.CommandArgument);
         DigitalGood digitalGood = DigitalGoodDataSource.Load(dgid);
         DigitalGood copy        = digitalGood.Copy();
         if (copy != null)
         {
             String newName = "Copy of " + copy.Name;
             if (newName.Length > 100)
             {
                 newName = newName.Substring(0, 97) + "...";
             }
             copy.Name = newName;
             copy.Save();
         }
         DigitalGoodGrid.DataBind();
     }
 }
Exemplo n.º 15
0
        private void InitializeForm(bool forceRefresh)
        {
            int digitalGoodId = AlwaysConvert.ToInt(Request.QueryString["DigitalGoodId"]);

            _DigitalGood = DigitalGoodDataSource.Load(digitalGoodId);
            if (_DigitalGood == null)
            {
                Response.Redirect(CancelButton.NavigateUrl);
            }
            RenameFileExtensions.Text = AbleContext.Current.Store.Settings.FileExt_DigitalGoods;
            if (!Page.IsPostBack || forceRefresh)
            {
                Name.Text     = _DigitalGood.Name;
                FileName.Text = _DigitalGood.FileName;
                MediaKey.Text = _DigitalGood.MediaKey;
                ListItem item = ActivationMode.Items.FindByValue(_DigitalGood.ActivationModeId.ToString());
                if (item != null)
                {
                    item.Selected = true;
                }
                if (_DigitalGood.MaxDownloads > 0)
                {
                    MaxDownloads.Text = _DigitalGood.MaxDownloads.ToString();
                }
                int days, hours, minutes;
                DigitalGood.ParseTimeout(_DigitalGood.ActivationTimeout, out days, out hours, out minutes);
                if (days > 0)
                {
                    ActivationTimeoutDays.Text = days.ToString();
                }
                if (hours > 0)
                {
                    ActivationTimeoutHours.Text = hours.ToString();
                }
                if (minutes > 0)
                {
                    ActivationTimeoutMinutes.Text = minutes.ToString();
                }
                DigitalGood.ParseTimeout(_DigitalGood.DownloadTimeout, out days, out hours, out minutes);
                if (days > 0)
                {
                    DownloadTimeoutDays.Text = days.ToString();
                }
                if (hours > 0)
                {
                    DownloadTimeoutHours.Text = hours.ToString();
                }
                if (minutes > 0)
                {
                    DownloadTimeoutMinutes.Text = minutes.ToString();
                }
                //bind license agreements
                LicenseAgreement.DataSource = LicenseAgreementDataSource.LoadAll();
                LicenseAgreement.DataBind();
                item = LicenseAgreement.Items.FindByValue(_DigitalGood.LicenseAgreementId.ToString());
                if (item != null)
                {
                    LicenseAgreement.SelectedIndex = LicenseAgreement.Items.IndexOf(item);
                }
                item = LicenseAgreementMode.Items.FindByValue(_DigitalGood.LicenseAgreementModeId.ToString());
                if (item != null)
                {
                    LicenseAgreementMode.SelectedIndex = LicenseAgreementMode.Items.IndexOf(item);
                }

                // BIND GROUPs
                Groups.DataBind();
                Groups.ClearSelection();

                foreach (DigitalGoodGroup dgg in _DigitalGood.DigitalGoodGroups)
                {
                    item = Groups.Items.FindByValue(dgg.Group.Id.ToString());
                    if (item != null)
                    {
                        item.Selected = true;
                    }
                }

                //bind readmes
                Readme.DataSource = ReadmeDataSource.LoadAll();
                Readme.DataBind();
                item = Readme.Items.FindByValue(_DigitalGood.ReadmeId.ToString());
                if (item != null)
                {
                    Readme.SelectedIndex = Readme.Items.IndexOf(item);
                }
                EnableSerialKeys.Checked = _DigitalGood.EnableSerialKeys;

                // INITIALIZE SERIAL KEY PROVIDERS
                KeySource.Items.Clear();
                KeySource.Items.Add(new ListItem("Manual Entry", "0"));

                // ADD PROVIDERS
                IList <ISerialKeyProvider> providers = SerialKeyProviderDataSource.GetSerialKeyProviders();
                foreach (ISerialKeyProvider provider in providers)
                {
                    string   classId = Misc.GetClassId(provider.GetType());
                    ListItem providerItem;
                    // (BUG # 8347) ABLECOMMERCE DEFAULT KEY PROVIDER SHOULD BE NAMED AS "Managed List of Keys"
                    if (provider.GetType() == typeof(DefaultSerialKeyProvider))
                    {
                        providerItem = new ListItem("Managed List of Keys", classId);
                    }
                    else
                    {
                        providerItem = new ListItem(provider.Name, classId);
                    }
                    KeySource.Items.Add(providerItem);
                }
                //SELECT CORRECT PROVIDER
                if (_DigitalGood.SerialKeyProviderId != null)
                {
                    ListItem providerItem = KeySource.Items.FindByValue(_DigitalGood.SerialKeyProviderId);
                    if (providerItem != null)
                    {
                        KeySource.SelectedIndex = KeySource.Items.IndexOf(providerItem);
                    }
                }

                IList <EmailTemplate> templates = EmailTemplateDataSource.LoadAll();
                foreach (EmailTemplate template in templates)
                {
                    ListItem activationItem = new ListItem(template.Name, template.Id.ToString());
                    ListItem fulfillItem    = new ListItem(template.Name, template.Id.ToString());

                    if (_DigitalGood.ActivationEmailId == template.Id)
                    {
                        activationItem.Selected = true;
                    }

                    if (_DigitalGood.FulfillmentEmailId == template.Id)
                    {
                        fulfillItem.Selected = true;
                    }

                    ActivationEmailTemplateList.Items.Add(activationItem);
                    FulfillmentEmailTemplateList.Items.Add(fulfillItem);
                }

                if (_DigitalGood.FulfillmentMode == CommerceBuilder.DigitalDelivery.FulfillmentMode.Manual)
                {
                    FulfillmentMode.SelectedIndex = 0;
                }
                else if (_DigitalGood.FulfillmentMode == CommerceBuilder.DigitalDelivery.FulfillmentMode.OnOrder)
                {
                    FulfillmentMode.SelectedIndex = 1;
                }
                else
                {
                    FulfillmentMode.SelectedIndex = 2;
                }

                ToggleConfigureProvider();
            }
        }
Exemplo n.º 16
0
        private void ProcessRules(BreadCrumbItem breadCrumbItem)
        {
            int id;

            if (breadCrumbItem.Url == "#")
            {
                return;
            }
            switch (breadCrumbItem.Url.ToLowerInvariant())
            {
            case "~/admin/orders/shipments/editshipment.aspx":
                id = AlwaysConvert.ToInt(Request.QueryString["OrderShipmentId"]);
                breadCrumbItem.Url  += "?OrderShipmentId=" + id;
                breadCrumbItem.Title = string.Format(breadCrumbItem.Title, id);
                break;

            case "~/admin/products/editproduct.aspx":
            case "~/admin/products/variants/variants.aspx":
            case "~/admin/products/variants/options.aspx":
            case "~/admin/products/digitalgoods/digitalgoods.aspx":
            case "~/admin/products/kits/editkit.aspx":
            case "~/admin/products/assets/images.aspx":
            case "~/admin/products/editproducttemplate.aspx":
            case "~/admin/products/specials/default.aspx":
                int categoryId = AbleCommerce.Code.PageHelper.GetCategoryId();
                id = AbleCommerce.Code.PageHelper.GetProductId();
                Product product = ProductDataSource.Load(id);
                if (categoryId > 0)
                {
                    breadCrumbItem.Url += "?CategoryId=" + categoryId + "&ProductId=" + id;
                }
                else
                {
                    breadCrumbItem.Url += "?ProductId=" + id;
                }
                breadCrumbItem.Title = string.Format(breadCrumbItem.Title, product.Name);
                break;

            case "~/admin/orders/vieworder.aspx":
            case "~/admin/orders/edit/editorderitems.aspx":
            case "~/admin/orders/viewdigitalgoods.aspx":
            case "~/admin/orders/payments/default.aspx":
            case "~/admin/orders/shipments/default.aspx":
                id = AbleCommerce.Code.PageHelper.GetOrderId();
                Order order = OrderDataSource.Load(id);
                breadCrumbItem.Url  += "?OrderNumber=" + order.OrderNumber;
                breadCrumbItem.Title = string.Format(breadCrumbItem.Title, order.OrderNumber);
                break;

            case "~/admin/marketing/coupons/editcoupon.aspx":
                id = AlwaysConvert.ToInt(Request.QueryString["CouponId"]);
                Coupon coupon = CouponDataSource.Load(id);
                breadCrumbItem.Url  += "?CouponId=" + id;
                breadCrumbItem.Title = string.Format(breadCrumbItem.Title, coupon.Name);
                break;

            case "~/admin/products/variants/editoption.aspx":
            case "~/admin/products/variants/editchoices.aspx":
                id = AlwaysConvert.ToInt(Request.QueryString["OptionId"]);
                Option option = OptionDataSource.Load(id);
                breadCrumbItem.Url  += "?OptionId=" + id;
                breadCrumbItem.Title = string.Format(breadCrumbItem.Title, option.Name);
                break;

            case "~/admin/products/giftwrap/editwrapgroup.aspx":
                id = AlwaysConvert.ToInt(Request.QueryString["WrapGroupId"]);
                WrapGroup wrapGroup = WrapGroupDataSource.Load(id);
                breadCrumbItem.Url  += "?WrapGroupId=" + id;
                breadCrumbItem.Title = string.Format(breadCrumbItem.Title, wrapGroup.Name);
                break;

            case "~/admin/marketing/email/managelist.aspx":
                id = AlwaysConvert.ToInt(Request.QueryString["EmailListId"]);
                EmailList emailList = EmailListDataSource.Load(id);
                if (emailList != null)
                {
                    breadCrumbItem.Url  += "?EmailListId=" + id;
                    breadCrumbItem.Title = string.Format(breadCrumbItem.Title, emailList.Name);
                }
                break;

            case "~/admin/marketing/discounts/editdiscount.aspx":
                id = AlwaysConvert.ToInt(Request.QueryString["VolumeDiscountId"]);
                VolumeDiscount discount = VolumeDiscountDataSource.Load(id);
                breadCrumbItem.Url  += "?VolumeDiscountId=" + id;
                breadCrumbItem.Title = string.Format(breadCrumbItem.Title, discount.Name);
                break;

            case "~/admin/catalog/editwebpage.aspx":
                id = AbleCommerce.Code.PageHelper.GetWebpageId();
                Webpage webpage = WebpageDataSource.Load(id);
                breadCrumbItem.Url  += "?WebpageId=" + id;
                breadCrumbItem.Title = string.Format(breadCrumbItem.Title, webpage.Name);
                break;

            case "~/admin/catalog/editLink.aspx":
                id = AbleCommerce.Code.PageHelper.GetLinkId();
                Link link = LinkDataSource.Load(id);
                breadCrumbItem.Url  += "?LinkId=" + id;
                breadCrumbItem.Title = string.Format(breadCrumbItem.Title, link.Name);
                break;

            case "~/admin/people/users/edituser.aspx":
                id = AlwaysConvert.ToInt(Request.QueryString["UserId"]);
                User user = UserDataSource.Load(id);
                breadCrumbItem.Url  += "?UserId=" + id;
                breadCrumbItem.Title = string.Format(breadCrumbItem.Title, user.UserName);
                break;

            case "~/admin/digitalgoods/editdigitalgood.aspx":
            case "~/admin/digitalgoods/serialkeyproviders/defaultprovider/configure.aspx":
                id = AlwaysConvert.ToInt(Request.QueryString["DigitalGoodId"]);
                DigitalGood dg = DigitalGoodDataSource.Load(id);
                if (dg != null)
                {
                    breadCrumbItem.Url  += "?DigitalGoodId=" + id;
                    breadCrumbItem.Title = string.Format(breadCrumbItem.Title, dg.Name);
                }
                break;

            case "~/admin/products/producttemplates/editproducttemplate.aspx":
                id = AlwaysConvert.ToInt(Request.QueryString["ProductTemplateId"]);
                ProductTemplate template = ProductTemplateDataSource.Load(id);
                if (template == null)
                {
                    InputField field = InputFieldDataSource.Load(AlwaysConvert.ToInt(Request.QueryString["InputFieldId"]));
                    if (field != null)
                    {
                        template = field.ProductTemplate;
                        id       = template.Id;
                    }
                }
                if (template != null)
                {
                    breadCrumbItem.Url  += "?ProductTemplateId=" + id;
                    breadCrumbItem.Title = string.Format(breadCrumbItem.Title, template.Name);
                }
                else
                {
                }
                break;

            case "~/admin/reports/dailyabandonedbaskets.aspx":
                id = AlwaysConvert.ToInt(Request.QueryString["BasketId"]);
                Basket basket = BasketDataSource.Load(id);
                if (basket != null)
                {
                    breadCrumbItem.Url += "?ReportDate=" + basket.User.LastActivityDate.Value.ToShortDateString();
                }
                break;
            }

            // resolve relative urls
            if (breadCrumbItem.Url.StartsWith("~/"))
            {
                breadCrumbItem.Url = Page.ResolveUrl(breadCrumbItem.Url);
            }
        }
Exemplo n.º 17
0
 private IList <DigitalGood> GetSubscriptionDigitalGoods()
 {
     return(DigitalGoodDataSource.FindByUserGroups(AbleContext.Current.UserId));
 }
Exemplo n.º 18
0
        protected void Page_Load(object sender, EventArgs e)
        {
            // get settings that impact menu tabs
            User user = AbleContext.Current.User;
            StoreSettingsManager settings = AbleContext.Current.Store.Settings;
            bool isRegistered             = !user.IsAnonymous;

            // construct links
            NameValueCollection menuLinks = new NameValueCollection();

            if (isRegistered)
            {
                menuLinks.Add("Orders", "MyAccount.aspx");
                if (SubscriptionDataSource.CountForUser(user.Id) > 0)
                {
                    menuLinks.Add("Subscriptions", "MySubscriptions.aspx");
                }

                if (OrderItemDigitalGoodDataSource.CountForUser(user.Id) > 0 || DigitalGoodDataSource.FindByUserGroupsCount(user.Id) > 0)
                {
                    menuLinks.Add("Digital Goods", "MyDigitalGoods.aspx");
                }
            }

            if (settings.WishlistsEnabled)
            {
                menuLinks.Add("Wishlist", "MyWishlist.aspx");
            }

            if (isRegistered)
            {
                menuLinks.Add("Profile", "MyCredentials.aspx");
                if (settings.EnablePaymentProfilesStorage && !AbleContext.Current.User.IsAnonymousOrGuest)
                {
                    menuLinks.Add("Payment Types", "PaymentTypes.aspx");
                }
                menuLinks.Add("Address Book", "MyAddressBook.aspx");

                if (settings.ProductReviewEnabled != CommerceBuilder.Users.UserAuthFilter.None)
                {
                    menuLinks.Add("Product Reviews", "MyProductReviews.aspx");
                }
            }

            int affiliateCount = UserDataSource.LoadUserAffiliateAccounts(user.Id).Count;

            if (affiliateCount > 0 || settings.AffiliateAllowSelfSignup)
            {
                menuLinks.Add("Affiliate Program", "MyAffiliateAccount.aspx");
            }

            // determine active page
            string activePage = Request.Url.Segments[Request.Url.Segments.Length - 1].ToLowerInvariant();

            // build menu
            StringBuilder menu = new StringBuilder();

            menu.AppendLine("<div class=\"tabstrip\">");
            menu.AppendLine("<ul>");
            foreach (string key in menuLinks.AllKeys)
            {
                if (IsActive(activePage, menuLinks[key].ToLowerInvariant()))
                {
                    menu.Append("<li class=\"active\">");
                }
                else
                {
                    menu.Append("<li>");
                }
                menu.AppendLine("<a href=\"" + Page.ResolveUrl("~/Members/" + menuLinks[key]) + "\">" + key + "</a></li>");
            }
            menu.AppendLine("</ul>");
            menu.AppendLine("</div>");
            MenuContent.Text = menu.ToString();
        }
Exemplo n.º 19
0
        protected void Page_Load(object sender, EventArgs e)
        {
            bool              hasSubscription    = false;
            bool              hasGiftCertificate = false;
            Order             order = LoadOrder();
            IList <OrderItem> items = order.Items;

            if (order != null)
            {
                NameValueCollection menuLinks = new NameValueCollection();
                menuLinks.Add("Summary", "ViewOrder.aspx");
                menuLinks.Add("Payments", "Payments/Default.aspx");
                menuLinks.Add("Shipments", "Shipments/Default.aspx");
                menuLinks.Add("Items", "Edit/EditOrderItems.aspx");
                menuLinks.Add("Returns", "Edit/ReturnItems.aspx");
                menuLinks.Add("Notes", "OrderHistory.aspx");
                menuLinks.Add("Addresses", "EditAddresses.aspx");

                foreach (OrderItem item in items)
                {
                    if (item.Subscriptions.Count > 0 || (item.Product != null && item.Product.IsSubscription))
                    {
                        hasSubscription = true;
                    }

                    if (item.GiftCertificates.Count > 0 || (item.Product != null && item.Product.IsGiftCertificate))
                    {
                        hasGiftCertificate = true;
                    }
                }

                if (hasSubscription)
                {
                    menuLinks.Add("Subscriptions", "ViewSubscriptions.aspx");
                }

                if (DigitalGoodDataSource.CountForStore(AbleContext.Current.StoreId) > 0)
                {
                    menuLinks.Add("Digital Goods", "ViewDigitalGoods.aspx");
                }

                if (hasGiftCertificate)
                {
                    menuLinks.Add("Gift Certificates", "ViewGiftCertificates.aspx");
                }

                string        suffix     = "?OrderNumber=" + order.OrderNumber.ToString();
                string        activeMenu = GetActiveMenu(Request.Url);
                StringBuilder menu       = new StringBuilder();
                menu.AppendLine("<div class=\"secondaryMenu\">");
                menu.AppendLine("<ul>");
                foreach (string key in menuLinks.AllKeys)
                {
                    if (key == activeMenu)
                    {
                        menu.Append("<li class=\"active\">");
                    }
                    else
                    {
                        menu.Append("<li>");
                    }
                    menu.AppendLine("<a href=\"" + Page.ResolveUrl("~/Admin/Orders/" + menuLinks[key]) + suffix + "\">" + key + "</a></li>");
                }

                // customer profile link should only show if there is a user
                // and this link can never be active
                if (order.User != null)
                {
                    menu.AppendLine("<li><a href=\"" + Page.ResolveUrl("~/Admin/People/Users/EditUser.aspx?UserId=" + order.User.Id) + "\">Customer Profile</a></li>");
                }

                menu.AppendLine("</ul>");
                menu.AppendLine("</div>");
                MenuContent.Text = menu.ToString();
            }
            else
            {
                // no order, do not display menu
                this.Controls.Clear();
            }
        }