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; } }
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; } }