Ejemplo n.º 1
0
    private void SetAvailableData(bool LoadSavedData)
    {
        try
        {
            List <TrackableCouponProgram> filterlist   = new List <TrackableCouponProgram>();
            TrackableCouponProgram        includedprog = new TrackableCouponProgram();
            GetAllTCProgram();
            filterlist = AvailableFilteredTCProgram.ToList();

            if (LoadSavedData)
            {
                SetSavedOfferTCReward();
                IncludedTCProgram = AvailableFilteredTCProgram.Where(p => p.ProgramID == 0).ToList();
                foreach (CouponTier cTier in couponReward.CouponTiers)
                {
                    includedprog = AvailableFilteredTCProgram.Where(p => p.ProgramID == cTier.ProgramID).SingleOrDefault();
                    if (includedprog != null)
                    {
                        IncludedTCProgram.Add(includedprog);
                    }
                }
                if (NumTiers == 1)
                {
                    foreach (CouponTier cTier in couponReward.CouponTiers)
                    {
                        filterlist = filterlist.Where(p => p.ProgramID != cTier.ProgramID).ToList();
                    }
                }
            }
            else
            {
                if (NumTiers == 1)
                {
                    if (IncludedTCProgram != null)
                    {
                        foreach (TrackableCouponProgram prog in IncludedTCProgram)
                        {
                            filterlist = filterlist.Where(p => p.ProgramID != prog.ProgramID).ToList();
                        }
                    }
                }
            }

            filterlist = filterlist.OrderBy(o => o.Name).ToList();
            lstAvailable.DataSource = filterlist;
            lstAvailable.DataBind();
        }
        catch (Exception ex)
        {
            DisplayError(ex);
        }
    }
Ejemplo n.º 2
0
    protected void repTier_selectedTCP_ItemDataBound(object sender, RepeaterItemEventArgs e)
    {
        if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
        {
            Int32 TierLevel = e.Item.ItemIndex;
            ((Button)e.Item.FindControl("btnselect")).Text   = "▼" + " " + PhraseLib.Lookup("term.select", LanguageID);
            ((Button)e.Item.FindControl("btndeselect")).Text = "▲" + " " + PhraseLib.Lookup("term.deselect", LanguageID);
            List <TrackableCouponProgram> selectedList = new List <TrackableCouponProgram>();
            if (TCRewardID > 0)
            {
                GetAllTCProgram();
                selectedList = AvailableFilteredTCProgram.ToList();
                selectedList = selectedList.Where(p => p.ProgramID == ((CouponTier)e.Item.DataItem).ProgramID).ToList();
            }


            ((ListBox)e.Item.FindControl("lstSelected")).DataSource = selectedList;
            ((ListBox)e.Item.FindControl("lstSelected")).DataBind();
        }
    }
Ejemplo n.º 3
0
    private void SetAvailableData(bool ReloadData = false)
    {
        try {
            if (ReloadData)
            {
                GetAllTCProgram();
                AddSavedTCProgram();
            }
            string strFilter = functioninput.Text;

            List <TrackableCouponProgram> filterlist;

            filterlist = AvailableFilteredTCProgram.ToList();
            if (IncludedTCProgram != null)
            {
                filterlist = filterlist.Where(p => p.ProgramID != IncludedTCProgram.ProgramID).ToList();
            }

            filterlist = filterlist.OrderBy(o => o.Name).ToList();

            List <TrackableCouponProgram> inc = new List <TrackableCouponProgram>();
            if (IncludedTCProgram != null)
            {
                inc.Add(IncludedTCProgram);
            }
            lstSelected.DataSource = inc;
            lstSelected.DataBind();

            lstAvailable.DataSource = filterlist;
            lstAvailable.DataBind();
        }
        catch (Exception ex) {
            infobar.InnerText = ErrorHandler.ProcessError(ex);
            infobar.Visible   = true;
        }
    }