Beispiel #1
0
        protected void RegEventsForComp_Click(object sender, EventArgs e)
        {
            Athl_CompetitorsInEvent       AthlCompetitorInEvRec = new Athl_CompetitorsInEvent();
            Athl_CompetitionEvents        AthlCompEvent         = new Athl_CompetitionEvents();
            Athl_CompetitorsInCompetition AthlCompetitorInComp  = new Athl_CompetitorsInCompetition();
            AthleticCompetitionCRUD       AthlCompCRUD          = new AthleticCompetitionCRUD();
            AthleticsEntities1            AthlEnt = new AthleticsEntities1();

            Int32       i;
            CheckBox    SelectedEvent;
            GridViewRow CurrRow;
            Int32       SelCellIndex = -1;
            Global      gl           = new Global();
            Int32       EventLine;
            bool        Res;
            string      CurrentUserID = Session["CurrentUserName"].ToString();

            AthlCompetitorInComp = AthlCompCRUD.InitCompetitorInComp();
            for (i = 0; i < AvailableEvents.Rows.Count; i++)
            {
                SelectedEvent = (CheckBox)AvailableEvents.Rows[i].FindControl("ValinChk");
                if (SelectedEvent.Checked)
                {
                    CurrRow = AvailableEvents.Rows[i];
                    if (SelCellIndex < 0)
                    {
                        SelCellIndex = gl.GetColumnIndexByName(CurrRow, "EventLine");
                    }
                    Res = int.TryParse(CurrRow.Cells[SelCellIndex].Text, out EventLine);
                    if (Res == false)
                    {
                        EventLine = -1;
                    }
                    else
                    {
                        if (AthlCompetitorInComp.rasnumer == 0)
                        {
                            AthlCompetitorInComp = AthlCompCRUD.GetCompetitorInComp(gl.GetCompetitionCode(), gl.GetBibNumber());
                        }

                        AthlCompetitorInEvRec = AthlCompCRUD.GetCompetitorInEvent(gl.GetCompetitionCode(), gl.GetBibNumber(), EventLine);
                        if (AthlCompetitorInEvRec == null)
                        {
                            AthlCompetitorInEvRec = AthlCompCRUD.InitCompetitorInEvent();
                        }
                        if (AthlCompetitorInEvRec.rasnumer == null)
                        {
                            AthlCompetitorInEvRec.rasnumer = 0;
                        }
                        if (AthlCompetitorInEvRec.rasnumer == 0)
                        {
                            AthlCompEvent = AthlCompCRUD.GetCompetitionEvent(gl.GetCompetitionCode(), EventLine);

                            AthlCompCRUD.RegisterCompetitorInEvent(gl.GetCompetitionCode(), AthlCompEvent, gl.GetBibNumber(), AthlCompetitorInComp,
                                                                   1, 999);
                            AthlEnt.InsertToLogFile(CurrentUserID, "Skráning í grein (b)", gl.GetCompetitionCode(), AthlCompetitorInComp.keppendanumer, AthlCompEvent.grein + ";" +
                                                    AthlCompEvent.kyn.ToString() + AthlCompEvent.flokkur);
                        }
                        else
                        if (AthlCompetitorInEvRec.rasnumer > 0)
                        {
                            AthlEnt.DeleteCompetitorInEvent(AthlCompetitorInEvRec.mot, AthlCompetitorInEvRec.greinarnumer, AthlCompetitorInEvRec.rasnumer);
                        }
                    }
                }
                //else
                //{
                //   if
                //}
            }

            //  Response.Redirect("~/NyttMot.aspx?Comp=" + gl.GetCompetitionCode());

            Response.Redirect("CompetitorsForUser.aspx");
        }
Beispiel #2
0
        protected void RelaysGrid_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            Global Gl = new Global();

            AthleticsEntities1 AthlEnt = new AthleticsEntities1();

            string CommandN   = e.CommandName;
            string CommandArg = e.CommandArgument.ToString();

            string[] EventNoAndBib = CommandArg.Split(';');

            if (CommandN == "DeleteTeam")
            {
                //                <script type="text/javascript">
                //    function myTestFunction()
                //    {
                //        if (confirm('Do you want to proceed ?'))
                //        {
                //            return true;
                //        }
                //        else
                //        {
                //            return false;
                //        }
                //    }
                //</script>

                //            ScriptManager.RegisterStartupScript(this, typeof(string), "confirm",
                //            "myTestFunction();", true);
                //Hér vantar confirm  Yes No !!!

                AthlEnt.DeleteCompetitorInEvent(CompCode.Text, Convert.ToInt32(EventNoAndBib[0]), Convert.ToInt32(EventNoAndBib[1]));
                //Eyða þarf Skipan boðhlaupssveitar hér
                AthlEnt.DeleteCompetitorInComp(CompCode.Text, CommandArg[1]);
                Response.Redirect("RegisterRelay.aspx");
            }

            if (CommandN == "Runners")
            {
                Gl.SetCompetitionCode(CompCode.Text);
                Gl.SetGlobalValue("EventLineNo", EventNoAndBib[0]);
                Gl.SetGlobalValue("SelectedClub", ClubDropDown.SelectedValue.ToString());
                Gl.SetGlobalValue("RelayTeamName", EventNoAndBib[2]);
                Gl.SetGlobalValue("CompetitorBibNo", EventNoAndBib[1]);
                Response.Redirect("RelayTeamNames.aspx");
            }

            Int32 EventLineNo = Convert.ToInt32(EventNoAndBib[0]);       //e.CommandArgument);
            AthleticCompetitionCRUD       AthlCRUD        = new AthleticCompetitionCRUD();
            Athl_CompetitionEvents        AthlEvent       = new Athl_CompetitionEvents();
            Athl_Competition              AthlCompetition = new Athl_Competition();
            Athl_CompetitorsInCompetition AthlCompInComp  = new Athl_CompetitorsInCompetition();
            Athl_CompetitorsInEvent       AthlCompInEv    = new Athl_CompetitorsInEvent();


            var RelayInfoDs = AthlEnt.PrepareToRegisterNewRelayTeam(
                CompCode.Text, EventLineNo, ClubDropDown.SelectedValue.ToString());

            ///     NewBibNoOut, GenderOut, TeamNameOut, YearOfBirthOut);
            Int32  NewBibNo          = 0;
            Int32  Gender            = 0;
            string TeamName          = "";
            Int32  YearOfBirth       = 0;
            Int32  LastLineNoInEvent = 0;

            foreach (var RelayInfoRec in RelayInfoDs)
            {
                NewBibNo          = Convert.ToInt32(RelayInfoRec.NewBibNoOut.ToString());
                Gender            = Convert.ToInt32(RelayInfoRec.GenderOut.ToString());
                TeamName          = RelayInfoRec.TeamNameOut.ToString();
                YearOfBirth       = Convert.ToInt32(RelayInfoRec.YearOfBirthOut.ToString());
                LastLineNoInEvent = Convert.ToInt32(RelayInfoRec.LastLineNoInEvent.ToString());
            }


            AthlEvent       = AthlCRUD.GetCompetitionEvent(CompCode.Text, EventLineNo);
            AthlCompetition = AthlCRUD.GetCompetitionRec(CompCode.Text);

            AthlCompInComp                = AthlCRUD.InitCompetitorInComp();
            AthlCompInComp.mot            = CompCode.Text;
            AthlCompInComp.rasnumer       = NewBibNo;
            AthlCompInComp.kyn            = Gender;
            AthlCompInComp.nafn           = TeamName;
            AthlCompInComp.faedingarar    = YearOfBirth;
            AthlCompInComp.felag          = ClubDropDown.SelectedValue.ToString();
            AthlCompInComp.aldurkeppanda  = AthlCompetition.Date.Year - YearOfBirth;
            AthlCompInComp.bodhlaupssveit = 1;
            AthlCRUD.InsertCompetitorInCompetition(AthlCompInComp);

            AthlCompInEv = AthlCRUD.InitCompetitorInEvent();

            AthlCompInEv.mot          = CompCode.Text;
            AthlCompInEv.greinarnumer = EventLineNo;
            AthlCompInEv.rasnumer     = NewBibNo;
            AthlCompInEv.nafn         = TeamName;
            AthlCompInEv.faedingarar  = YearOfBirth;
            AthlCompInEv.felag        = ClubDropDown.SelectedValue.ToString();
            AthlCRUD.RegisterCompetitorInEvent(CompCode.Text, AthlEvent, NewBibNo, AthlCompInComp, 0, 0);

            Response.Redirect("RegisterRelay.aspx?Club=" + ClubDropDown.SelectedValue.ToString());
        }
        protected void UpdateDatabase()
        {
            AthleticCompetitionCRUD AthlCRUD = new AthleticCompetitionCRUD();
            Global gl = new Global();
            Athl_CompetitorsInEvent       AthlCompInEvent          = new Athl_CompetitorsInEvent();
            Athl_CompetitorsInEvent       AthlCompInEventForDelete = new Athl_CompetitorsInEvent();
            Athl_CompetitionEvents        CompEvent         = new Athl_CompetitionEvents();
            Athl_CompetitorsInCompetition CompetitorsInComp = new Athl_CompetitorsInCompetition();

            CompetitorsInComp.rasnumer = -1;
            AthleticsEntities1 AthlEnt  = new AthleticsEntities1();
            string             CompCode = gl.GetCompetitionCode();
            Int32  EventLin             = 0;
            Int32  FjLin     = gl.GetNoOfArrayElements();
            Int32  BibNumber = 0;
            string EventType = gl.GetEventType();

            string[] CheckBoxParts     = new string[10];
            string[] CheckBoxValues    = new string[50];
            string[] TextBoxIDs        = new string[50];
            bool     NeedToRefreshPage = false;
            string   CurrentUserID     = Session["CurrentUserName"].ToString();

            foreach (Control item in PH1.Controls)
            {
                if (item is CheckBox)
                {
                    CheckBox Cb         = (CheckBox)PH1.FindControl(item.ID);
                    string   CheckBoxID = Cb.ID;
                    CheckBoxParts = CheckBoxID.Split('_');  //Chkb_BibNo_EventLineNo_TickedOrNot
                    bool CheckboxIsTicked  = Convert.ToBoolean(Cb.Checked);
                    bool CheckBoxWasTicked = CheckBoxParts[3] == "1";
                    if ((CheckboxIsTicked == true) && (CheckBoxWasTicked == false))
                    {
                        BibNumber       = Convert.ToInt32(CheckBoxParts[1]);
                        EventLin        = Convert.ToInt32(CheckBoxParts[2]);
                        AthlCompInEvent = AthlCRUD.InitCompetitorInEvent();
                        CompEvent       = AthlCRUD.GetCompetitionEvent(CompCode, EventLin);
                        if (CompetitorsInComp.rasnumer != BibNumber)
                        {
                            CompetitorsInComp = AthlCRUD.GetCompetitorInComp(CompCode, BibNumber);
                        }
                        AthlCRUD.RegisterCompetitorInEvent(CompCode, CompEvent, BibNumber, CompetitorsInComp, 0, 9999);
                        AthlEnt.InsertToLogFile(CurrentUserID, "Skráning í grein", CompCode, CompetitorsInComp.keppendanumer, CompEvent.grein + ";" + CompEvent.kyn.ToString() + ";" +
                                                CompEvent.flokkur);
                        NeedToRefreshPage = true;
                    }
                    if ((CheckboxIsTicked == false) && (CheckBoxWasTicked == true))
                    {
                        BibNumber = Convert.ToInt32(CheckBoxParts[1]);
                        EventLin  = Convert.ToInt32(CheckBoxParts[2]);
                        if (CompetitorsInComp.rasnumer != BibNumber)
                        {
                            CompetitorsInComp = AthlCRUD.GetCompetitorInComp(CompCode, BibNumber);
                        }
                        CompEvent = AthlCRUD.GetCompetitionEvent(CompCode, EventLin);
                        AthlCompInEventForDelete = AthlCRUD.GetCompetitorInEvent(CompCode, BibNumber, EventLin);
                        AthlCRUD.DeleteCompetitorInEvRec(AthlCompInEventForDelete);
                        AthlEnt.InsertToLogFile(CurrentUserID, "Afskráning í grein", CompCode, CompetitorsInComp.keppendanumer, CompEvent.grein + ";" + CompEvent.kyn.ToString() + ";" +
                                                CompEvent.flokkur);

                        NeedToRefreshPage = true;
                    }
                }
            }
            if (NeedToRefreshPage == true)
            {
                Response.Redirect("ClubCompetitorsWithReg.aspx");
            }
        }
Beispiel #4
0
        protected void SaveRaceResultOrder_Click(object sender, EventArgs e)
        {
            Global gl = new Global();
            string CompCode = gl.GetCompetitionCode();
            //Int32 EventLineNo = Convert.ToInt32(gl.GetCompetitionEventNo());
            string EventLineNoText = Request.QueryString.Get("Event");
            Int32 EventLineNo = Convert.ToInt32(EventLineNoText);
            AthleticsEntities1 AthlEnt = new AthleticsEntities1();
            AthleticCompetitionCRUD AthlCRUD = new AthleticCompetitionCRUD();
            Athl_CompetitorsInEvent AthlCompetitorsInEventRec = new Athl_CompetitorsInEvent();
            Athl_CompetitionEvents AthlCompEvent = new Athl_CompetitionEvents();
            string TextBoxID;
            string CurrValue;
            Int32 CurrValueInt;
            bool NeedToUpdateOrderByResults = false;
            string[] ControlNameParts;
            Int32 LineNoForTextBox;
            Int32 BibNo = 0;

            CurrValue = "";
            LineNoForTextBox = -1;
            AthlCompEvent = AthlCRUD.GetCompetitionEvent(CompCode, EventLineNo);

            foreach (Control item in PH1.Controls)
            {
                if (item is TextBox)
                {
                    TextBox t1 = (TextBox)PH1.FindControl(item.ID);
                    TextBoxID = t1.ID;
                    CurrValue = t1.Text;
                    ControlNameParts = TextBoxID.Split('_');
                    LineNoForTextBox = Convert.ToInt32(ControlNameParts[1]);
                    BibNo = gl.GetBibNoArrayElement(LineNoForTextBox);
                    bool res = Int32.TryParse(CurrValue, out CurrValueInt);
                    if (res == false)
                    {
                        CurrValueInt = 0;
                    }
                    if (CurrValueInt.ToString() != gl.GetArr1Value(LineNoForTextBox))
                    {
                        AthlCompetitorsInEventRec = AthlCRUD.GetCompetitorInEvent(CompCode, BibNo, EventLineNo);
                        
                        AthlCRUD.UpdCompetitorInEvent(AthlCompetitorsInEventRec.mot, AthlCompetitorsInEventRec.greinarnumer,
                            AthlCompetitorsInEventRec.rasnumer, AthlCompetitorsInEventRec.timi, AthlCompetitorsInEventRec.metrar,
                            AthlCompetitorsInEventRec.vindur, AthlCompetitorsInEventRec.arangur,
                            AthlCompetitorsInEventRec.tilraun1, AthlCompetitorsInEventRec.vindur1,
                            AthlCompetitorsInEventRec.tilraun2, AthlCompetitorsInEventRec.vindur2,
                            AthlCompetitorsInEventRec.tilraun3, AthlCompetitorsInEventRec.vindur3,
                            AthlCompetitorsInEventRec.tilraun4, AthlCompetitorsInEventRec.vindur4,
                            AthlCompetitorsInEventRec.tilraun5, AthlCompetitorsInEventRec.vindur5,
                            AthlCompetitorsInEventRec.tilraun6, AthlCompetitorsInEventRec.vindur6,
                            AthlCompetitorsInEventRec.seria,
                            AthlCompetitorsInEventRec.rafmagnstimataka, AthlCompetitorsInEventRec.merking1, AthlCompetitorsInEventRec.merking2,
                            AthlCompetitorsInEventRec.merking3, AthlCompetitorsInEventRec.merking4, AthlCompetitorsInEventRec.merking5,
                            AthlCompetitorsInEventRec.merking6, AthlCompetitorsInEventRec.sortorder1, AthlCompetitorsInEventRec.sortorder2,
                            CurrValueInt, "", AthlCompetitorsInEventRec.samasaetiognaestiaundan,
                            AthlCompetitorsInEventRec.athugasemd, AthlCompetitorsInEventRec.ridillnumer, 
                            AthlCompetitorsInEventRec.stokkkastrod, AthlCompetitorsInEventRec.IAAF_Stig,
                            AthlCompetitorsInEventRec.thrautarstig, AthlCompetitorsInEventRec.Unglingastig, 
                            AthlCompetitorsInEventRec.PerformaceRemarks);
                        NeedToUpdateOrderByResults = true;
                    }

                }
                //if (item is CheckBox)
                //{
                //    CheckBox c1 = (CheckBox)PH1.FindControl(item.ID);
                //    CheckBoxID = c1.ID;
                //    CurrChecked = (Boolean)(c1.Checked);
                //    ControlNameParts = CheckBoxID.Split('_');
                //    LineNoForCheckBox = Convert.ToInt32(ControlNameParts[1]);
                //}
                //if ((LineNoForTextBox > 0) && (LineNoForCheckBox > 0) && (LineNoForTextBox == LineNoForCheckBox))
                //{
                //    if (CurrChecked == true)
                //    {
                //        CurrCheckedInteger = 1;
                //    }
                //    else
                //    {
                //        CurrCheckedInteger = 0;
                //    }
                //    string Test = gl.GetArr1Value(LineNoForTextBox);
                //    Test = gl.GetArr2Value(LineNoForCheckBox);
                //    Test = CurrChecked.ToString();
                //    bool res = Int32.TryParse(CurrValue, out CurrValueInt);
                //    if (res == false)
                //    {
                //        CurrValueInt = 0;
                //    }
                //    if ((CurrValueInt.ToString() != gl.GetArr1Value(LineNoForTextBox)) || (CurrCheckedInteger.ToString() != gl.GetArr2Value(LineNoForCheckBox)))
                //    {
                //        AthlCompetitorsInEventRec = AthlCRUD.GetCompetitorInEvent(CompCode, BibNo, EventLineNo);
                //        AthlCRUD.UpdCompetitorInEvent(AthlCompetitorsInEventRec.mot, AthlCompetitorsInEventRec.greinarnumer,
                //            AthlCompetitorsInEventRec.rasnumer, AthlCompetitorsInEventRec.timi, AthlCompetitorsInEventRec.metrar,
                //            AthlCompetitorsInEventRec.vindur, AthlCompetitorsInEventRec.arangur,
                //            AthlCompetitorsInEventRec.tilraun1, AthlCompetitorsInEventRec.vindur1,
                //            AthlCompetitorsInEventRec.tilraun2, AthlCompetitorsInEventRec.vindur2,
                //            AthlCompetitorsInEventRec.tilraun3, AthlCompetitorsInEventRec.vindur3,
                //            AthlCompetitorsInEventRec.tilraun4, AthlCompetitorsInEventRec.vindur4,
                //            AthlCompetitorsInEventRec.tilraun5, AthlCompetitorsInEventRec.vindur5,
                //            AthlCompetitorsInEventRec.tilraun6, AthlCompetitorsInEventRec.vindur6,
                //            AthlCompetitorsInEventRec.seria,
                //            AthlCompetitorsInEventRec.rafmagnstimataka, AthlCompetitorsInEventRec.merking1, AthlCompetitorsInEventRec.merking2,
                //            AthlCompetitorsInEventRec.merking3, AthlCompetitorsInEventRec.merking4, AthlCompetitorsInEventRec.merking5,
                //            AthlCompetitorsInEventRec.merking6, AthlCompetitorsInEventRec.sortorder1, AthlCompetitorsInEventRec.sortorder2,
                //            CurrValueInt, "", CurrCheckedInteger,
                //            AthlCompetitorsInEventRec.athugasemd);
                //        NeedToUpdateOrderByResults = true;
                //    }
                //    LineNoForCheckBox = -1;
                //    LineNoForTextBox = -1;
                //}
            }
   //         if (NeedToUpdateOrderByResults == true)
           // {
            //    gl.UpdateResultOrderForEvent(CompCode, EventLineNo, AthlCompEvent.tegundgreinar, "%");
//                AthlCRUD.UpdateResultOrder(CompCode, EventLineNo, AthlCompEvent.tegundgreinar);
     //       }
            Response.Redirect("UpdateEventResults.aspx?Event=" + EventLineNoText);
        }