Ejemplo n.º 1
0
        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");
            }
        }
Ejemplo n.º 2
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);
        }