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(); }
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); } } }