コード例 #1
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();
        }
コード例 #2
0
        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));
        }
コード例 #3
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);
        }
コード例 #4
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);
         }
     }
 }
コード例 #5
0
 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);
 }
コード例 #6
0
        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);
                }
            }
        }
コード例 #7
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.");
                }
            }
        }
コード例 #8
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();
            }
        }
コード例 #9
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();
     }
 }
コード例 #10
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();
            }
        }
コード例 #11
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);
            }
        }