protected void Search_Click(object sender, EventArgs e)
    {
        CustomPrincipal cp         = (CustomPrincipal)HttpContext.Current.User;
        TeeTimes        teeTimeMGR = new TeeTimes();

        if (!cp.IsMember())
        {
            int selectedMember;
            if (int.TryParse(MemberSelection.Text, out selectedMember))
            {
                TeeTimesTable.DataSource = teeTimeMGR.GetTeeTimeByMemberAndDate(selectedMember, DatePicker.SelectedDate);
                TeeTimesTable.DataBind();
                Message.Text = "Search executed";
            }
            else
            {
                Message.Text = "Please select a valid member";
            }
        }
        else
        {
            TeeTimesTable.DataSource = teeTimeMGR.GetTeeTimeByMemberAndDate(cp.GetId(), DatePicker.SelectedDate);
            TeeTimesTable.DataBind();
        }
    }
    protected void Search_Click(object sender, EventArgs e)
    {
        CustomPrincipal cp         = (CustomPrincipal)HttpContext.Current.User;
        TeeTimes        teeTimeMGR = new TeeTimes();

        if (!cp.IsMember())
        {
            int selectedMember;
            if (int.TryParse(MemberSelection.Text, out selectedMember))
            {
                List <TeeTime> teeTimes = teeTimeMGR.GetTeeTimeByMember(selectedMember);
                TeeTimesTable.DataSource = teeTimes;
                MemberID.Text            = selectedMember.ToString();
                TeeTimesTable.DataBind();
                carts.Text = teeTimes[0].Carts.ToString();
            }
            else
            {
                Message.Text = "Please select a valid member";
            }
        }
        else
        {
            TeeTimesTable.DataSource = teeTimeMGR.GetTeeTimeByMember(cp.GetId());
            TeeTimesTable.DataBind();
        }
    }
Esempio n. 3
0
 protected void AddScore_Click(object sender, EventArgs e)
 {
     try
     {
         Handicaps       HandicapMgr = new Handicaps();
         CustomPrincipal cp          = (CustomPrincipal)HttpContext.Current.User;
         if (cp.IsMember())
         {
             HandicapMgr.AddPlayer(cp.GetId(), DatePicker.SelectedDate, int.Parse(HoleTextBox1.Text), int.Parse(HoleTextBox2.Text),
                                   int.Parse(HoleTextBox3.Text), int.Parse(HoleTextBox4.Text), int.Parse(HoleTextBox5.Text), int.Parse(HoleTextBox6.Text),
                                   int.Parse(HoleTextBox7.Text), int.Parse(HoleTextBox8.Text), int.Parse(HoleTextBox9.Text), int.Parse(HoleTextBox10.Text),
                                   int.Parse(HoleTextBox11.Text), int.Parse(HoleTextBox12.Text), int.Parse(HoleTextBox13.Text), int.Parse(HoleTextBox14.Text),
                                   int.Parse(HoleTextBox15.Text), int.Parse(HoleTextBox16.Text), int.Parse(HoleTextBox17.Text), int.Parse(HoleTextBox18.Text));
             MSG.Text = "Player score added successfully";
         }
         else
         {
             HandicapMgr.AddPlayer(int.Parse(MemberTextBox.Text), DatePicker.SelectedDate, int.Parse(HoleTextBox1.Text), int.Parse(HoleTextBox2.Text),
                                   int.Parse(HoleTextBox3.Text), int.Parse(HoleTextBox4.Text), int.Parse(HoleTextBox5.Text), int.Parse(HoleTextBox6.Text),
                                   int.Parse(HoleTextBox7.Text), int.Parse(HoleTextBox8.Text), int.Parse(HoleTextBox9.Text), int.Parse(HoleTextBox10.Text),
                                   int.Parse(HoleTextBox11.Text), int.Parse(HoleTextBox12.Text), int.Parse(HoleTextBox13.Text), int.Parse(HoleTextBox14.Text),
                                   int.Parse(HoleTextBox15.Text), int.Parse(HoleTextBox16.Text), int.Parse(HoleTextBox17.Text), int.Parse(HoleTextBox18.Text));
             MSG.Text = "Player score added successfully";
         }
     }
     catch (Exception ex)
     {
         MSG.Text = ex.Message;
     }
 }