public void loadplayer() { try { if (_isResultclick == false) { if (_IsClickedOnce == false) { ScoreCardBLL objscorecardplay = new ScoreCardBLL(); // SelectPlayers obselectjplayer = new SelectPlayers(); lblbat1.Content = tempvalues.teamA; lblbowl1.Content = tempvalues.teamB; lblbat2.Content = tempvalues.teamB; lblbowl2.Content = tempvalues.teamA; foreach (var abc in (TempValuesTeam1.team1)) { if (abc != null) { teamA.Add(abc.ToString()); } } foreach (var xyz in TempValuesTeam2.team2) { if (xyz != null) { teamB.Add(xyz.ToString()); } } //teamA (batting) teamB (bowling) if ((comboboxvalue.value[0] == "0" && comboboxvalue.value[1] == "0") || (comboboxvalue.value[0] == "1" && comboboxvalue.value[1] == "1")) { for (int i = 0; i <= teamA.Count - 1; i++) { KSCA.team1[i] = KSCAUID.teamA[i]; } for (int j = 0; j <= teamB.Count - 1; j++) { KSCA.team2[j] = KSCAUID.teamB[j]; } //dgvbat1.DataContext = objscorecardplay.batting1(teamA); //dgvbat2.DataContext = objscorecardplay.batting2(teamB); //dgvbowl1.DataContext = objscorecardplay.bowling1(teamB); //dgvbowl2.DataContext = objscorecardplay.bowling2(teamA); dgvbat1.ItemsSource = (objscorecardplay.batting1(teamA)).DefaultView; dgvbat2.ItemsSource = (objscorecardplay.batting2(teamB)).DefaultView; dgvbowl1.ItemsSource = (objscorecardplay.bowling1(teamB)).DefaultView; dgvbowl2.ItemsSource = (objscorecardplay.bowling2(teamA)).DefaultView; } //teamA (bowling) teamB (batting) if ((comboboxvalue.value[0] == "0" && comboboxvalue.value[1] == "1") || (comboboxvalue.value[0] == "1" && comboboxvalue.value[1] == "0")) { for (int i = 0; i <= teamB.Count - 1; i++) { KSCA.team1[i] = KSCAUID.teamB[i]; } for (int j = 0; j <= teamA.Count - 1; j++) { KSCA.team2[j] = KSCAUID.teamA[j]; } //dgvbat1.DataContext = objscorecardplay.batting1(teamB); //dgvbat2.DataContext = objscorecardplay.batting2(teamA); //dgvbowl1.DataContext = objscorecardplay.bowling1(teamA); //dgvbowl2.DataContext = objscorecardplay.bowling2(teamB); dgvbat1.ItemsSource = (objscorecardplay.batting1(teamB)).DefaultView; dgvbat2.ItemsSource = (objscorecardplay.batting2(teamA)).DefaultView; dgvbowl1.ItemsSource = (objscorecardplay.bowling1(teamA)).DefaultView; dgvbowl2.ItemsSource = (objscorecardplay.bowling2(teamB)).DefaultView; } } } _isResultclick = false; _IsClickedOnce = false; } catch (Exception ex) { throw ex; } }
public void btn1score_Click(object sender, RoutedEventArgs e) { try { if ((comboboxvalue.value[0] == "0" && comboboxvalue.value[1] == "0") || (comboboxvalue.value[0] == "1" && comboboxvalue.value[1] == "1")) { firstinngcount1 = teamA.Count; firstinngcount2 = teamB.Count; } else { firstinngcount1 = teamB.Count; firstinngcount2 = teamA.Count; } ScoreCardBLL objscorecardplay = new ScoreCardBLL(); if (txtbyes1.Text == "" || txtlegbyes1.Text == "" || txtpenalty1.Text == "" || txtrunout1.Text == "") { extras1_empty(); } else { for (int i = 0; i <= (firstinngcount1 - 1); i++) { if (!DBNull.Value.Equals((dgvbat1.Items[i] as DataRowView).Row.ItemArray[4]) && ((dgvbat1.Items[i] as DataRowView).Row.ItemArray[4]).ToString() != "") { R1 = Convert.ToInt16((dgvbat1.Items[i] as DataRowView).Row.ItemArray[4]); runs1 = objscorecardplay.runs1(R1); } } for (int j = 0; j <= (firstinngcount2 - 1); j++) { if (!DBNull.Value.Equals((dgvbowl1.Items[j] as DataRowView).Row.ItemArray[8]) && ((dgvbowl1.Items[j] as DataRowView).Row.ItemArray[8]).ToString() != "") { W1 = Convert.ToInt16((dgvbowl1.Items[j] as DataRowView).Row.ItemArray[8]); wides1 = objscorecardplay.wides1(W1); } } for (int k = 0; k <= (firstinngcount2 - 1); k++) { if (!DBNull.Value.Equals((dgvbowl1.Items[k] as DataRowView).Row.ItemArray[7]) && ((dgvbowl1.Items[k] as DataRowView).Row.ItemArray[7]).ToString() != "") { N1 = Convert.ToInt16((dgvbowl1.Items[k] as DataRowView).Row.ItemArray[7]); noballs1 = objscorecardplay.noball1(N1); } } for (int m = 0; m <= (firstinngcount2 - 1); m++) { if (!DBNull.Value.Equals((dgvbowl1.Items[m] as DataRowView).Row.ItemArray[6]) && ((dgvbowl1.Items[m] as DataRowView).Row.ItemArray[6]).ToString() != "") { Wkts1 = Convert.ToInt16((dgvbowl1.Items[m] as DataRowView).Row.ItemArray[6]); wickts1 = objscorecardplay.wickets1(Wkts1); } } int runout1 = Convert.ToInt16(txtrunout1.Text); wickts1 = wickts1 + runout1; for (int n = 0; n <= (firstinngcount2 - 1); n++) { if (!DBNull.Value.Equals((dgvbowl1.Items[n] as DataRowView).Row.ItemArray[5]) && ((dgvbowl1.Items[n] as DataRowView).Row.ItemArray[5]).ToString() != "") { BR1 = Convert.ToInt16((dgvbowl1.Items[n] as DataRowView).Row.ItemArray[5]); bruns1 = objscorecardplay.bowlerruns1(BR1); } } for (int ov = 0; ov <= (firstinngcount2 - 1); ov++) { if (!DBNull.Value.Equals((dgvbowl1.Items[ov] as DataRowView).Row.ItemArray[3]) && ((dgvbowl1.Items[ov] as DataRowView).Row.ItemArray[3]).ToString() != "") { O1 = Convert.ToDouble((dgvbowl1.Items[ov] as DataRowView).Row.ItemArray[3]); overs1 = objscorecardplay.overs1(O1); } } txttotalextras1.Text = (wides1 + noballs1 + Convert.ToInt16(txtpenalty1.Text) + Convert.ToInt16(txtbyes1.Text) + Convert.ToInt16(txtlegbyes1.Text)).ToString(); txtruns1.Text = (runs1 + wides1 + noballs1 + Convert.ToInt16(txtpenalty1.Text) + Convert.ToInt16(txtbyes1.Text) + Convert.ToInt16(txtlegbyes1.Text)).ToString(); txtwickets1.Text = wickts1.ToString(); txtovers1.Text = overs1.ToString(); } } catch (Exception ex) { throw ex; } }
public void btn2score_Click(object sender, RoutedEventArgs e) { try { if ((comboboxvalue.value[0] == "0" && comboboxvalue.value[1] == "0") || (comboboxvalue.value[0] == "1" && comboboxvalue.value[1] == "1")) { secondinngcount1 = teamB.Count; secondinngcount2 = teamA.Count; } else { secondinngcount1 = teamA.Count; secondinngcount2 = teamB.Count; } ScoreCardBLL objscorecardplay = new ScoreCardBLL(); if (txtbyes2.Text == "" || txtlegbyes2.Text == "" || txtpenalty2.Text == "" || txtrunout2.Text == "") { extras2_empty(); } else { for (int i = 0; i <= (secondinngcount1 - 1); i++) { if (!DBNull.Value.Equals((dgvbat2.Items[i] as DataRowView).Row.ItemArray[4]) && ((dgvbat2.Items[i] as DataRowView).Row.ItemArray[4]).ToString() != "") { R2 = Convert.ToInt16((dgvbat2.Items[i] as DataRowView).Row.ItemArray[4]); runs2 = objscorecardplay.runs2(R2); } } for (int j = 0; j <= (secondinngcount2 - 1); j++) { if (!DBNull.Value.Equals((dgvbowl2.Items[j] as DataRowView).Row.ItemArray[8]) && ((dgvbowl2.Items[j] as DataRowView).Row.ItemArray[8]).ToString() != "") { W2 = Convert.ToInt16((dgvbowl2.Items[j] as DataRowView).Row.ItemArray[8]); wides2 = objscorecardplay.wides2(W2); } } for (int k = 0; k <= (secondinngcount2 - 1); k++) { if (!DBNull.Value.Equals((dgvbowl2.Items[k] as DataRowView).Row.ItemArray[7]) && ((dgvbowl2.Items[k] as DataRowView).Row.ItemArray[7]).ToString() != "") { N2 = Convert.ToInt16((dgvbowl2.Items[k] as DataRowView).Row.ItemArray[7]); noballs2 = objscorecardplay.noball2(N2); } } for (int m = 0; m <= (secondinngcount2 - 1); m++) { if (!DBNull.Value.Equals((dgvbowl2.Items[m] as DataRowView).Row.ItemArray[6]) && ((dgvbowl2.Items[m] as DataRowView).Row.ItemArray[6]).ToString() != "") { Wkts2 = Convert.ToInt16((dgvbowl2.Items[m] as DataRowView).Row.ItemArray[6]); wickts2 = objscorecardplay.wickets2(Wkts2); } } int runout2 = Convert.ToInt16(txtrunout2.Text); wickts2 = wickts2 + runout2; for (int n = 0; n <= (secondinngcount2 - 1); n++) { if (!DBNull.Value.Equals((dgvbowl2.Items[n] as DataRowView).Row.ItemArray[5]) && ((dgvbowl2.Items[n] as DataRowView).Row.ItemArray[5]).ToString() != "") { BR2 = Convert.ToInt16((dgvbowl2.Items[n] as DataRowView).Row.ItemArray[5]); bruns2 = objscorecardplay.bowlerruns2(BR2); } } for (int ov = 0; ov <= (secondinngcount2 - 1); ov++) { if (!DBNull.Value.Equals((dgvbowl2.Items[ov] as DataRowView).Row.ItemArray[3]) && ((dgvbowl2.Items[ov] as DataRowView).Row.ItemArray[3]).ToString() != "") { O2 = Convert.ToDouble((dgvbowl2.Items[ov] as DataRowView).Row.ItemArray[3]); overs2 = objscorecardplay.overs2(O2); } } txttotalextras2.Text = (wides2 + noballs2 + Convert.ToInt16(txtpenalty2.Text) + Convert.ToInt16(txtbyes2.Text) + Convert.ToInt16(txtlegbyes2.Text)).ToString(); txtruns2.Text = (runs2 + wides2 + noballs2 + Convert.ToInt16(txtpenalty2.Text) + Convert.ToInt16(txtbyes2.Text) + Convert.ToInt16(txtlegbyes2.Text)).ToString(); txtwickets2.Text = wickts2.ToString(); txtovers2.Text = overs2.ToString(); } } catch (Exception ex) { throw ex; } }
private void btn1scoresecondinngs_Click(object sender, RoutedEventArgs e) { try { if (chkmatchnotplayed.IsChecked == false) { int runs1secondinngs = 0; int wides1secondinngs = 0; int noballs1secondinngs = 0; int wickts1secondinngs = 0; int bruns1secondinngs = 0; double overs1secondinngs = 0; int R1secondinngs = 0; int W1secondinngs = 0; int N1secondinngs = 0; int Wkts1secondinngs = 0; int BR1secondinngs = 0; double O1secondinngs = 0; if ((comboboxvalue.value[0] == "0" && comboboxvalue.value[1] == "0") || (comboboxvalue.value[0] == "1" && comboboxvalue.value[1] == "1")) { secondinng1count1 = teamA.Count; secondinng1count2 = teamB.Count; } else { secondinng1count1 = teamB.Count; secondinng1count2 = teamA.Count; } ScoreCardBLL objscorecardplay = new ScoreCardBLL(); if (txtbyes1secondinngs.Text == "" || txtlegbyes1secondinngs.Text == "" || txtpenalty1secondinngs.Text == "" || txtrunout1seccondinnings.Text == "") { extras1secondinngs_empty(); } else { for (int i = 0; i <= (secondinng1count1 - 1); i++) { if (!DBNull.Value.Equals((dgvbat1secondinngs.Items[i] as DataRowView).Row.ItemArray[4]) && ((dgvbat1secondinngs.Items[i] as DataRowView).Row.ItemArray[4]).ToString() != "") { R1secondinngs = Convert.ToInt16((dgvbat1secondinngs.Items[i] as DataRowView).Row.ItemArray[4]); runs1secondinngs = objscorecardplay.runs1(R1secondinngs); } } for (int j = 0; j <= (secondinng1count2 - 1); j++) { if (!DBNull.Value.Equals((dgvbowl1secondinngs.Items[j] as DataRowView).Row.ItemArray[8]) && ((dgvbowl1secondinngs.Items[j] as DataRowView).Row.ItemArray[8]).ToString() != "") { W1secondinngs = Convert.ToInt16((dgvbowl1secondinngs.Items[j] as DataRowView).Row.ItemArray[8]); wides1secondinngs = objscorecardplay.wides1(W1secondinngs); } } for (int k = 0; k <= (secondinng1count2 - 1); k++) { if (!DBNull.Value.Equals((dgvbowl1secondinngs.Items[k] as DataRowView).Row.ItemArray[7]) && ((dgvbowl1secondinngs.Items[k] as DataRowView).Row.ItemArray[7]).ToString() != "") { N1secondinngs = Convert.ToInt16((dgvbowl1secondinngs.Items[k] as DataRowView).Row.ItemArray[7]); noballs1secondinngs = objscorecardplay.noball1(N1secondinngs); } } for (int m = 0; m <= (secondinng1count2 - 1); m++) { if (!DBNull.Value.Equals((dgvbowl1secondinngs.Items[m] as DataRowView).Row.ItemArray[6]) && ((dgvbowl1secondinngs.Items[m] as DataRowView).Row.ItemArray[6]).ToString() != "") { Wkts1secondinngs = Convert.ToInt16((dgvbowl1secondinngs.Items[m] as DataRowView).Row.ItemArray[6]); wickts1secondinngs = objscorecardplay.wickets1(Wkts1secondinngs); } } int runout1 = Convert.ToInt16(txtrunout1seccondinnings.Text); wickts1secondinngs = wickts1secondinngs + runout1; for (int n = 0; n <= (secondinng1count2 - 1); n++) { if (!DBNull.Value.Equals((dgvbowl1secondinngs.Items[n] as DataRowView).Row.ItemArray[5]) && ((dgvbowl1secondinngs.Items[n] as DataRowView).Row.ItemArray[5]).ToString() != "") { BR1secondinngs = Convert.ToInt16((dgvbowl1secondinngs.Items[n] as DataRowView).Row.ItemArray[5]); bruns1secondinngs = objscorecardplay.bowlerruns1(BR1secondinngs); } } for (int ov = 0; ov <= (secondinng1count2 - 1); ov++) { if (!DBNull.Value.Equals((dgvbowl1secondinngs.Items[ov] as DataRowView).Row.ItemArray[3]) && ((dgvbowl1secondinngs.Items[ov] as DataRowView).Row.ItemArray[3]).ToString() != "") { O1secondinngs = Convert.ToDouble((dgvbowl1secondinngs.Items[ov] as DataRowView).Row.ItemArray[3]); overs1secondinngs = objscorecardplay.overs1(O1secondinngs); } } txttotalextras1secondinngs.Text = (wides1secondinngs + noballs1secondinngs + Convert.ToInt16(txtpenalty1secondinngs.Text) + Convert.ToInt16(txtbyes1secondinngs.Text) + Convert.ToInt16(txtlegbyes1secondinngs.Text)).ToString(); txtruns1secondinngs.Text = (runs1secondinngs + wides1secondinngs + noballs1secondinngs + Convert.ToInt16(txtpenalty1secondinngs.Text) + Convert.ToInt16(txtbyes1secondinngs.Text) + Convert.ToInt16(txtlegbyes1secondinngs.Text)).ToString(); txtwickets1secondinngs.Text = wickts1secondinngs.ToString(); txtovers1secondinngs.Text = overs1secondinngs.ToString(); } } } catch (Exception ex) { throw ex; } }