Ejemplo n.º 1
0
    protected void radGridEntry_ItemDataBound(object sender, GridItemEventArgs e)
    {
        if (e.Item.ItemType == GridItemType.Item || e.Item.ItemType == GridItemType.AlternatingItem)
        {
            Effie2017.App.Entry entry = (Effie2017.App.Entry)e.Item.DataItem;
            ScoreList           slist = GeneralFunction.GetAllScoreCache(false);
            Score score = GeneralFunction.GetScoreFromMatchingEntryCache(entry, jury.Id, round);
            if (entry == null)
            {
                return;
            }

            LinkButton lnkBtn = null;
            Label      lbl    = null;
            HyperLink  lnk    = null;

            //// Edit button
            //lnkBtn = (LinkButton)e.Item.FindControl("lnkBtnEdit");
            //Security.SecureControlByHiding(lnkBtn);

            // Entry Id
            lbl      = (Label)e.Item.FindControl("lbSerial");
            lbl.Text = entry.Serial;


            // Campaign title
            lbl      = (Label)e.Item.FindControl("lbCampaign");
            lbl.Text = entry.Campaign;


            // Category
            lbl = (Label)e.Item.FindControl("lbCategory");
            //lbl.Text = GeneralFunction.GetEntryMarket(entry.CategoryMarketFromRound(round)) + "<br/>" + entry.CategoryPSDetailFromRound(round);
            lbl.Text = entry.CategoryPSDetailFromRound(round);


            // submitted by
            lbl = (Label)e.Item.FindControl("lnkBtnBuSubmittedBy");
            Registration reg = GeneralFunction.GetRegistrationFromEntry(entry);
            lbl.Text = "-";
            if (reg != null)
            {
                lbl.Text = reg.Company;
                //lnkBtn.CommandArgument = reg.Id.ToString();
            }

            // client and agency
            CompanyCreditList cclist = CompanyCreditList.GetCompanyCreditList(entry.Id);
            try
            {
                lbl      = (Label)e.Item.FindControl("lbClient");
                lbl.Text = cclist[0].Company;

                //lbl = (Label)e.Item.FindControl("lbAgency1");
                //lbl.Text = cclist[1].Company;

                //lbl = (Label)e.Item.FindControl("lbAgency2");
                //lbl.Text = cclist[2].Company;

                //lbl = (Label)e.Item.FindControl("lbAgency3");
                //lbl.Text = cclist[3].Company;

                //lbl = (Label)e.Item.FindControl("lbAgency4");
                //lbl.Text = cclist[4].Company;

                //lbl = (Label)e.Item.FindControl("lbAgency5");
                //lbl.Text = cclist[5].Company;
            }
            catch { }

            // Brand
            lbl      = (Label)e.Item.FindControl("lbBrand");
            lbl.Text = entry.Brand;

            // Country
            lbl      = (Label)e.Item.FindControl("lbCountry");
            lbl.Text = "-";
            if (reg != null)
            {
                lbl.Text = reg.Country;
            }


            if (score != null)
            {
                // Raw score
                lbl      = (Label)e.Item.FindControl("lbScoreSCRaw");
                lbl.Text = score.ScoreSC.ToString();
                if (score.IsAdminRecuse || score.IsRecuse)
                {
                    lbl.Text = "X";
                }

                // ID
                lbl      = (Label)e.Item.FindControl("lbScoreIDRaw");
                lbl.Text = score.ScoreID.ToString();
                if (score.IsAdminRecuse || score.IsRecuse)
                {
                    lbl.Text = "X";
                }

                // IL
                lbl      = (Label)e.Item.FindControl("lbScoreILRaw");
                lbl.Text = score.ScoreIL.ToString();
                if (score.IsAdminRecuse || score.IsRecuse)
                {
                    lbl.Text = "X";
                }

                // RE
                lbl      = (Label)e.Item.FindControl("lbScoreRERaw");
                lbl.Text = score.ScoreRE.ToString();
                if (score.IsAdminRecuse || score.IsRecuse)
                {
                    lbl.Text = "X";
                }



                // Weighted scores
                // SC
                lbl      = (Label)e.Item.FindControl("lbScoreSC");
                lbl.Text = GeneralFunction.CalculateSC(score.ScoreSC).ToString("N");
                if (score.IsAdminRecuse || score.IsRecuse)
                {
                    lbl.Text = "X";
                }

                // ID
                lbl      = (Label)e.Item.FindControl("lbScoreID");
                lbl.Text = GeneralFunction.CalculateID(score.ScoreID).ToString("N");
                if (score.IsAdminRecuse || score.IsRecuse)
                {
                    lbl.Text = "X";
                }

                // IL
                lbl      = (Label)e.Item.FindControl("lbScoreIL");
                lbl.Text = GeneralFunction.CalculateIL(score.ScoreIL).ToString("N");
                if (score.IsAdminRecuse || score.IsRecuse)
                {
                    lbl.Text = "X";
                }

                // RE
                lbl      = (Label)e.Item.FindControl("lbScoreRE");
                lbl.Text = GeneralFunction.CalculateRE(score.ScoreRE).ToString("N");
                if (score.IsAdminRecuse || score.IsRecuse)
                {
                    lbl.Text = "X";
                }


                // composite score
                lbl      = (Label)e.Item.FindControl("lbScoreComposite");
                lbl.Text = score.ScoreComposite.ToString("N");
                if (score.IsAdminRecuse || score.IsRecuse)
                {
                    lbl.Text = "X";
                }



                // Status
                lbl           = (Label)e.Item.FindControl("lbScoreStatus");
                lbl.Text      = "Pending";
                lbl.ForeColor = System.Drawing.Color.Gray;
                if (score.IsSubmitted)
                {
                    lbl.Text      = "Completed";
                    lbl.ForeColor = System.Drawing.Color.Green;
                }
                if (score.IsAdminRecuse || score.IsRecuse)
                {
                    lbl.Text      = "Recused";
                    lbl.ForeColor = System.Drawing.Color.Gray;
                }


                // Flag
                lbl      = (Label)e.Item.FindControl("lbJuryFlag");
                lbl.Text = "-";
                if (score.Flag != "")
                {
                    lbl.Text = score.Flag;
                }


                // Jury Recuse Flag
                lbl      = (Label)e.Item.FindControl("lbJuryRecuse");
                lbl.Text = "";
                if (score.IsRecuse)
                {
                    lbl.Text = "Y";
                }


                // Recuse
                lbl      = (Label)e.Item.FindControl("lbRecuse");
                lbl.Text = "";
                if (score.IsAdminRecuse)
                {
                    lbl.Text = "Y";
                }


                // Advancement
                lbl      = (Label)e.Item.FindControl("lbAdvancement");
                lbl.Text = "-";
                lbl.Text = ((score.IsRecuse || score.IsAdminRecuse) ? "-" : ((score.IsAdvancement) ? "Y" : "N"));
            }


            //Action
            lnkBtn = (LinkButton)e.Item.FindControl("lnkScore");
            if (score != null)
            {
                lnkBtn.CommandArgument = score.EntryId.ToString();
                lnkBtn.Visible         = true;
            }

            // Reset
            lnkBtn = (LinkButton)e.Item.FindControl("lnkReset");
            if (score != null && score.IsSubmitted)
            {
                lnkBtn.CommandArgument = score.Id.ToString();
                lnkBtn.Visible         = true;
            }

            if (Security.IsReadOnlyAdmin())
            {
                lnkBtn.Visible = false;
            }

            // chkboxes
            //CheckBox chkbox = (CheckBox)e.Item.FindControl("chkbox");
            //Security.SecureControlByHiding(chkbox);
        }
    }
Ejemplo n.º 2
0
    protected void radGridEntry_ItemDataBound(object sender, GridItemEventArgs e)
    {
        if (e.Item.ItemType == GridItemType.Item || e.Item.ItemType == GridItemType.AlternatingItem)
        {
            Effie2017.App.Entry entry = (Effie2017.App.Entry)e.Item.DataItem;


            LinkButton lnkBtn, lnkBtn2 = null;
            Label      lbl = null;
            HyperLink  lnk = null;


            // Categories
            lbl      = (Label)e.Item.FindControl("lbCategory");//GeneralFunction.GetEntryMarket(entry.CategoryMarketFromRound(round)) + "<br/>" +
            lbl.Text = entry.CategoryPSDetailFromRound(round);


            // submitted by
            lbl = (Label)e.Item.FindControl("lnkBtnBuSubmittedBy");
            Registration reg = GeneralFunction.GetRegistrationFromEntry(entry);
            lbl.Text = "-";
            if (reg != null)
            {
                lbl.Text = reg.Company;
                //lnkBtn.CommandArgument = reg.Id.ToString();
            }

            // Country
            lbl      = (Label)e.Item.FindControl("lbCountry");
            lbl.Text = "-";
            if (reg != null)
            {
                lbl.Text = reg.Country;
            }

            // client and agency
            CompanyCreditList cclist = CompanyCreditList.GetCompanyCreditList(entry.Id);
            try
            {
                lbl      = (Label)e.Item.FindControl("lbClient");
                lbl.Text = cclist[0].Company;

                lbl      = (Label)e.Item.FindControl("lbAgency1");
                lbl.Text = cclist[1].Company;

                lbl      = (Label)e.Item.FindControl("lbAgency2");
                lbl.Text = cclist[2].Company;

                lbl      = (Label)e.Item.FindControl("lbAgency3");
                lbl.Text = cclist[3].Company;

                lbl      = (Label)e.Item.FindControl("lbAgency4");
                lbl.Text = cclist[4].Company;

                lbl      = (Label)e.Item.FindControl("lbAgency5");
                lbl.Text = cclist[5].Company;
            }
            catch { }


            //// submitted details
            //lbl = (Label)e.Item.FindControl("lblSubmittedDetails");
            //lbl.Text = reg.Firstname + " " + reg.Lastname + "<br/>" + reg.Job + "<br/>" + GeneralFunction.ShowFriendlyContact(reg.Contact) + "<br/>" + reg.Email;


            // Jury panel 1
            List <JuryPanelCategory> jcpList = GeneralFunction.GetJuryPanelCategoryFromCategoryPS(entry.CategoryMarketFromRound(round), entry.CategoryPSFromRound(round), entry.CategoryPSDetailFromRound(round), round);
            if (jcpList != null && jcpList.Count > 0)
            {
                lbl      = (Label)e.Item.FindControl("lbJuryPanel");
                lbl.Text = jcpList[0].PanelId;
            }


            // Jury panel round2



            // Jury
            List <EffieJuryManagementApp.Jury> jlist = GeneralFunction.GetJuryListFromEntryCategory(entry.CategoryMarketFromRound(round), entry.CategoryPSFromRound(round), entry.CategoryPSDetailFromRound(round), round);

            DisplayJury(e, "lbJury1", jlist, 0);
            DisplayJury(e, "lbJury2", jlist, 1);
            DisplayJury(e, "lbJury3", jlist, 2);
            DisplayJury(e, "lbJury4", jlist, 3);
            DisplayJury(e, "lbJury5", jlist, 4);
            DisplayJury(e, "lbJury6", jlist, 5);
            DisplayJury(e, "lbJury7", jlist, 6);
            DisplayJury(e, "lbJury8", jlist, 7);
            DisplayJury(e, "lbJury9", jlist, 8);
            DisplayJury(e, "lbJury10", jlist, 9);
            DisplayJury(e, "lbJury11", jlist, 10);
            DisplayJury(e, "lbJury12", jlist, 11);
            DisplayJury(e, "lbJury13", jlist, 12);
            DisplayJury(e, "lbJury14", jlist, 13);
            DisplayJury(e, "lbJury15", jlist, 14);
            DisplayJury(e, "lbJury16", jlist, 15);
            DisplayJury(e, "lbJury17", jlist, 16);
            DisplayJury(e, "lbJury18", jlist, 17);
            DisplayJury(e, "lbJury19", jlist, 18);
            DisplayJury(e, "lbJury20", jlist, 19);

            //// chkboxes
            //CheckBox chkbox = (CheckBox)e.Item.FindControl("chkbox");
            //Security.SecureControlByHiding(chkbox);
        }
        else if (e.Item.ItemType == GridItemType.Pager)
        {
            RadComboBox PageSizeCombo = (RadComboBox)e.Item.FindControl("PageSizeComboBox");

            PageSizeCombo.Items.Clear();
            //PageSizeCombo.Items.Add(new RadComboBoxItem("20", "20"));
            //PageSizeCombo.FindItemByText("20").Attributes.Add("ownerTableViewId", radGridEntry.MasterTableView.ClientID);
            PageSizeCombo.Items.Add(new RadComboBoxItem("50", "50"));
            PageSizeCombo.FindItemByText("50").Attributes.Add("ownerTableViewId", radGridEntry.MasterTableView.ClientID);
            PageSizeCombo.Items.Add(new RadComboBoxItem("100", "100"));
            PageSizeCombo.FindItemByText("100").Attributes.Add("ownerTableViewId", radGridEntry.MasterTableView.ClientID);
            PageSizeCombo.Items.Add(new RadComboBoxItem("200", "200"));
            PageSizeCombo.FindItemByText("200").Attributes.Add("ownerTableViewId", radGridEntry.MasterTableView.ClientID);
            PageSizeCombo.Items.Add(new RadComboBoxItem("All", "99999"));
            PageSizeCombo.FindItemByText("All").Attributes.Add("ownerTableViewId", radGridEntry.MasterTableView.ClientID);
            string PageSize = e.Item.OwnerTableView.PageSize.ToString();
            PageSizeCombo.FindItemByValue(PageSizeDefault.ToString()).Selected = true;
        }
    }