示例#1
0
        protected void GridView3_RowDataBound(object sender, GridViewRowEventArgs e)
        {
            string[] WordsArray;
            string   AgeGr;
            Int32    Gend;
            Int32    AgeFr;
            Int32    AgeTo;
            Int32    ColNo;

            string EventLineNoText = "";
            bool   UserIsSignedin  = false;

            if (e.Row.RowType == DataControlRowType.Header)
            {
                AccessLevelText = Session["CurrentAccessLevel"].ToString();
                if ((AccessLevelText == "0") || (AccessLevelText == "") || (AccessLevelText == null))
                {
                    UserIsSignedin = false;
                    //ModifyDateTime.Visible = false;
                    SetPrizeCermonyColumnVisible = false;
                }
                else
                {
                    UserIsSignedin = true;
                    AthleticCompetitionCRUD AthlCompCRUD = new AthleticCompetitionCRUD();
                    Athl_Competition        AthlComp     = new Athl_Competition();
                    if (CompCode4.Text != "")
                    {
                        AthlComp = AthlCompCRUD.GetCompetitionRec(CompetitionCode.Text);
                        if (AthlComp.DisplayColumnForPrizeCeremony == 1)
                        {
                            SetPrizeCermonyColumnVisible = true;
                        }
                    }
                }
                ColNoForPrizeCeremony = GetColumnIndexByName(e.Row, "tilkynnaverdlaunaafhendingu");
            }
            if (e.Row.RowType == DataControlRowType.DataRow)
            {
                int RowIx = e.Row.RowIndex;
                EventLineNoText = GridView3.DataKeys[e.Row.RowIndex].Values[1].ToString();

                ColNo = GetColumnIndexByName(e.Row, "ShowCompetitors");
                HyperLink hp = new HyperLink();

                hp.Text        = "Keppendur"; //e.Row.Cells[ColNo].Text;
                hp.NavigateUrl = "UpdateEventResults.aspx?Event=" + EventLineNoText;

                e.Row.Cells[ColNo].Controls.Add(hp);

                ColNo      = GetColumnIndexByName(e.Row, "Aldursflokkur");
                AgeGr      = e.Row.Cells[ColNo].Text;
                WordsArray = AgeGr.Split(';');
                Gend       = Convert.ToInt32(WordsArray[0]);
                AgeFr      = Convert.ToInt32(WordsArray[1]);
                AgeTo      = Convert.ToInt32(WordsArray[2]);

                switch (Gend)
                {
                case 1:
                    if ((AgeFr == 0) & ((AgeTo == 0) | (AgeTo == 999)))
                    {
                        AgeGr = "Karlar";
                    }
                    else
                    {
                        if (AgeFr == 0)
                        {
                            if (AgeTo > 22)
                            {
                                AgeGr = "Karlar";
                            }
                            else
                            {
                                AgeGr = "Piltar " + AgeTo.ToString() + " og yngri";
                            }
                        }
                        else
                        {
                            if (AgeTo == 999)
                            {
                                AgeGr = "Karlar " + AgeFr.ToString() + " og eldri";
                            }
                            else
                            {
                                if (AgeFr == AgeTo)
                                {
                                    AgeGr = "Piltar " + AgeFr.ToString();
                                }
                                else
                                {
                                    AgeGr = "Piltar " + AgeFr.ToString() + "-" + AgeTo.ToString();
                                }
                            }
                        }
                    }
                    break;

                case 2:
                    if ((AgeFr == 0) && ((AgeTo == 0) || (AgeTo == 999)))
                    {
                        AgeGr = "Konur";
                    }
                    else
                    {
                        if (AgeFr == 0)
                        {
                            if (AgeTo > 22)
                            {
                                AgeGr = "Konur";
                            }
                            else
                            {
                                AgeGr = "Stúlkur " + AgeTo.ToString() + " og yngri";
                            }
                        }
                        else
                        {
                            if (AgeTo == 999)
                            {
                                AgeGr = "Konur " + AgeFr.ToString() + " og eldri";
                            }
                            else
                            {
                                if (AgeFr == AgeTo)
                                {
                                    AgeGr = "Stúlkur " + AgeFr.ToString();
                                }
                                else
                                {
                                    AgeGr = "Stúlkur " + AgeFr.ToString() + "-" + AgeTo.ToString();
                                }
                            }
                        }
                    }
                    break;
                }
                //e.Row.Cells[ColNo].Text = AgeGr;
            }
            if (SetPrizeCermonyColumnVisible == false)
            {
                e.Row.Cells[ColNoForPrizeCeremony].Visible     = false;
                e.Row.Cells[ColNoForPrizeCeremony + 1].Visible = false;
            }
        }
示例#2
0
        protected void GridView3_RowDataBound(object sender, GridViewRowEventArgs e)
        {
            string[] WordsArray;
            string   AgeGr;
            Int32    Gend;
            Int32    AgeFr;
            Int32    AgeTo;
            Int32    ColNo;

            if (e.Row.RowType == DataControlRowType.DataRow)
            {
                ColNo      = GetColumnIndexByName(e.Row, "Aldursflokkur");
                AgeGr      = e.Row.Cells[ColNo].Text;
                WordsArray = AgeGr.Split(';');
                Gend       = Convert.ToInt32(WordsArray[0]);
                AgeFr      = Convert.ToInt32(WordsArray[1]);
                AgeTo      = Convert.ToInt32(WordsArray[2]);

                switch (Gend)
                {
                case 1:
                    if ((AgeFr == 0) & ((AgeTo == 0) | (AgeTo == 999)))
                    {
                        AgeGr = "Karlar";
                    }
                    else
                    {
                        if (AgeFr == 0)
                        {
                            if (AgeTo > 22)
                            {
                                AgeGr = "Karlar";
                            }
                            else
                            {
                                AgeGr = "Piltar " + AgeTo.ToString() + " og yngri";
                            }
                        }
                        else
                        {
                            if (AgeTo == 999)
                            {
                                AgeGr = "Karlar " + AgeFr.ToString() + " og eldri";
                            }
                            else
                            {
                                if (AgeFr == AgeTo)
                                {
                                    AgeGr = "Piltar " + AgeFr.ToString();
                                }
                                else
                                {
                                    AgeGr = "Piltar " + AgeFr.ToString() + "-" + AgeTo.ToString();
                                }
                            }
                        }
                    }
                    break;

                case 2:
                    if ((AgeFr == 0) && ((AgeTo == 0) || (AgeTo == 999)))
                    {
                        AgeGr = "Konur";
                    }
                    else
                    {
                        if (AgeFr == 0)
                        {
                            if (AgeTo > 22)
                            {
                                AgeGr = "Konur";
                            }
                            else
                            {
                                AgeGr = "Stúlkur " + AgeTo.ToString() + " og yngri";
                            }
                        }
                        else
                        {
                            if (AgeTo == 999)
                            {
                                AgeGr = "Konur " + AgeFr.ToString() + " og eldri";
                            }
                            else
                            {
                                if (AgeFr == AgeTo)
                                {
                                    AgeGr = "Stúlkur " + AgeFr.ToString();
                                }
                                else
                                {
                                    AgeGr = "Stúlkur " + AgeFr.ToString() + "-" + AgeTo.ToString();
                                }
                            }
                        }
                    }
                    break;
                }
                e.Row.Cells[ColNo].Text = AgeGr;
            }
        }