public async Task <ActionResult <CTeam> > PostCTeam(CTeam cTeam) { _context.CTeam.Add(cTeam); await _context.SaveChangesAsync(); return(CreatedAtAction("GetCTeam", new { id = cTeam.Id }, cTeam)); }
public async Task <IActionResult> PutCTeam(int id, CTeam cTeam) { if (id != cTeam.Id) { return(BadRequest()); } _context.Entry(cTeam).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!CTeamExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
private void init_data() { try { dataGridViewAwardResult.Rows.Clear(); list = clWork.GetListData(IS.idseason, currdiv.id); if (list.Count > 0) { g_f = true; dataGridViewAwardResult.Rows.Add(list.Count); for (int i = 0; i < list.Count; i++) { STAward st = clAward.GetAward(list[i].idaward); dataGridViewAwardResult.Rows[i].Cells[0].Value = st.nameaward; clPlayer = new CPlayer(connect, list[i].idplayer); dataGridViewAwardResult.Rows[i].Cells[1].Value = string.Format("{0} {1}", clPlayer.stPlayer.name, clPlayer.stPlayer.family); clEP = new CEntryPlayers(connect); int x = clEP.IsEntryPlayer(IS.idseason, list[i].idplayer); if (x > 0) { clTeam = new CTeam(connect, x); dataGridViewAwardResult.Rows[i].Cells[2].Value = clTeam.stTeam.name; } if (list[i].result != null) { dataGridViewAwardResult.Rows[i].Cells[3].Value = string.Format("{0:f2}", list[i].result); } dataGridViewAwardResult.Rows[i].Cells[4].Value = list[i].idplayer; if (flawour.Equals(list[i])) { gpos = i; } } dataGridViewAwardResult.ClearSelection(); dataGridViewAwardResult.AllowUserToAddRows = false; } else { dataGridViewAwardResult.AllowUserToAddRows = false; } } catch (Exception ex) { MessageBox.Show(ex.Message, ex.Source); } }
private void ToolStripMenuItemDel_Click(object sender, EventArgs e) { string name; STCompositionGroup st; try { foreach (DataGridViewRow item in dataGridViewCGroups.SelectedRows) { name = item.Cells[1].Value.ToString(); clTeam = new CTeam(connect, name); st.idseason = stGroup.idseason; st.iddivision = stGroup.iddivision; st.idgroup = stGroup.idgroup; st.idteam = clTeam.stTeam.id; clCGroup.Delete(st); init_data(); } } catch (Exception ex) { MessageBox.Show(ex.Message, ex.Source); } }
private void buttonAdd_Click(object sender, EventArgs e) { string name; STCompositionGroup st; try { if (comboBoxTeam.Text.Length > 0) { name = comboBoxTeam.Text.Trim(); clTeam = new CTeam(connect, name); st.idseason = stGroup.idseason; st.iddivision = stGroup.iddivision; st.idgroup = stGroup.idgroup; st.idteam = clTeam.stTeam.id; clCGroup.Insert(st); init_data(); comboBoxTeam.Text = null; } } catch (Exception ex) { MessageBox.Show(ex.Message, ex.Source); } }
private void set_data() { CCity city; try { textBoxName.Text = gstTeam.name; textBoxLatinName.Text = gstTeam.latinname; city = new CCity(connect, gstTeam.idcity); comboBoxCity.Text = city.stCity.name; set_disl(city.stFullCity); if (gstTeam.idprev != null) { clTeam = new CTeam(connect, (int)gstTeam.idprev); comboBoxPrevTeam.Text = clTeam.stTeam.name; } textBoxIdGroupTeam.Text = gstTeam.idgroupteam.ToString(); } catch (Exception ex) { MessageBox.Show(ex.Message.ToString()); } }
private void CalendarGames_Load(object sender, EventArgs e) { try { clGame = new CGame(connect); clTeam = new CTeam(connect); clDivision = new CDivision(connect); clGroup = new CGroup(connect); // init_combo(); this.WindowState = FormWindowState.Maximized; gpos = 0; bDivision = false; bType = false; iIdDivision = -1; iIdType = -1; init_combo(); init_data(); recom = null; } catch (Exception ex) { MessageBox.Show(ex.Message, ex.Source); } }
private STEntryTeam GetSelectionData() { STEntryTeam ret = new STEntryTeam(); CTeam clTeam; string nameteam; try { foreach (DataGridViewRow item in dataGridViewTeamPart.SelectedRows) { nameteam = item.Cells[1].Value.ToString(); clTeam = new CTeam(connect, nameteam); foreach (STEntryTeam s in list) { if (clTeam.stTeam.id == s.idteam) { ret = s; } } } } catch (Exception ex) { MessageBox.Show(ex.Message); } return(ret); }
private void intit_data(DateTime dt) { CTeam clTeam; try { List <STRankingTeam> list = clRT.GetListRankingTeam(dt); // List<STRankingTeam> list_rt = Formed(list); dataGridViewRankingTeam.Rows.Clear(); if (list.Count > 0) { dataGridViewRankingTeam.Rows.Add(list.Count); for (int i = 0; i < list.Count; i++) { dataGridViewRankingTeam.Rows[i].Cells[0].Value = list[i].ranking.ToString(); clTeam = new CTeam(connect, list[i].idteam); dataGridViewRankingTeam.Rows[i].Cells[1].Value = clTeam.stTeam.name; dataGridViewRankingTeam.Rows[i].Cells[2].Value = list[i].points.ToString(); dataGridViewRankingTeam.Rows[i].Cells[3].Value = list[i].power.ToString(); dataGridViewRankingTeam.Rows[i].Cells[4].Value = list[i].game.ToString(); } dataGridViewRankingTeam.AllowUserToAddRows = false; } else { dataGridViewRankingTeam.AllowUserToAddRows = false; } } catch (Exception ex) { MessageBox.Show(ex.Message, ex.Source); } }
private List <STTeam> read_param() { List <STTeam> ret = new List <STTeam>(); try { for (int i = 0; i < checkedListBoxTeam.Items.Count; i++) { if (checkedListBoxTeam.GetItemChecked(i)) { clTeam = new CTeam(connect, checkedListBoxTeam.Items[i].ToString()); ret.Add(clTeam.stTeam); } } if (checkBoxAll.Checked == true) { prAll = true; } else { prAll = false; } } catch (Exception ex) { MessageBox.Show(ex.Message, ex.Source); } return(ret); }
/* инициализаци¤ списка команд */ private void init_combo_team() { try { comboBoxTeam1.Items.Clear(); comboBoxTeam2.Items.Clear(); clTeam = new CTeam(connect); List <STTeam> list = clTeam.GetListTeam(IS.idseason, gDiv, gGroup); if (list.Count > 0) { foreach (STTeam item in list) { comboBoxTeam1.Items.Add(item.name); comboBoxTeam2.Items.Add(item.name); } } else { comboBoxTeam1.Enabled = false; comboBoxTeam2.Enabled = false; } } catch (Exception ex) { MessageBox.Show(ex.Message, ex.Source); } }
private STEntryPlayers?GetSelectionData() { STEntryPlayers?ret = null; int idteam, idplayer; DateTime datein; string text; CTeam team; try { foreach (DataGridViewRow item in dataGridViewEntryPlayers.SelectedRows) { text = item.Cells[3].Value.ToString(); team = new CTeam(connect, text); idteam = team.stTeam.id; idplayer = int.Parse(item.Cells[9].Value.ToString().Trim()); datein = DateTime.Parse(item.Cells[7].Value.ToString().Trim()); ret = clWork.GetEntryPlayer(IS.idseason, idteam, idplayer, datein); } } catch (Exception ex) { MessageBox.Show(ex.Message, ex.Source); } return(ret); }
private void init_list_team(List <STEntryTeam> lst) { bool bp; try { checkedListBoxTeam.Items.Clear(); List <STEntryTeam> list_all = clET.GetTeamParticipant(IS.idseason); bp = false; foreach (STEntryTeam eteam in list_all) { foreach (STEntryTeam team in lst) { if (eteam.idteam == team.idteam) { bp = true; } } clTeam = new CTeam(connect, eteam.idteam); checkedListBoxTeam.Items.Add(clTeam.stTeam.name, bp); bp = false; } } catch (Exception ex) { MessageBox.Show(ex.Message, ex.Source); } }
private STFinalResult GetSelectionData() { STFinalResult ret = new STFinalResult(); ret.idseason = IS.idseason; ret.iddivision = currdiv.id; string n; CTeam clTeam; try { foreach (DataGridViewRow item in dataGridViewFinalResult.SelectedRows) { n = item.Cells[1].Value.ToString(); clTeam = new CTeam(connect, n); ret.idteam = clTeam.stTeam.id; string s = item.Cells[0].Value.ToString(); if (s.Length > 0) { ret.rang = int.Parse(s); } else { ret.rang = 0; } } } catch (Exception ex) { MessageBox.Show(ex.Message, ex.Source); } return(ret); }
private void textBoxNGame_TextChanged(object sender, EventArgs e) { int idgame = 0; STGame st; string name1, name2; string text; try { if (textBoxNGame.Text.Length > 0) { idgame = int.Parse(textBoxNGame.Text.Trim()); st = clGame.GetGame(idseason, idgame); clTeam = new CTeam(connect, (int)st.idteam1); name1 = clTeam.stTeam.name; clTeam = new CTeam(connect, (int)st.idteam2); name2 = clTeam.stTeam.name; text = string.Format("{0} - {1}", name1, name2); textBoxDescriptGame.Text = text; } } catch (Exception ex) { MessageBox.Show(ex.Message, ex.Source); } }
private void PreViewGame_Load(object sender, EventArgs e) { try { clTeam = new CTeam(connect); clGame = new CGame(connect); clIS = new CInfoSeason(connect); clDivision = new CDivision(connect); team1 = new STTeam(); team2 = new STTeam(); init_combo_season(); init_combo_division(); init_combo_group(); init_combo_team(); cnt = 0; } catch (Exception ex) { MessageBox.Show(ex.Message, ex.Source); } }
private void init_data() { CCity city = new CCity(connect); string text = null; try { f_g = false; dataGridViewTeam.Rows.Clear(); list = clTeam.GetListTeam(ps); if (list.Count > 0) { f_g = true; dataGridViewTeam.Rows.Add(list.Count); for (int i = 0; i < list.Count; i++) { dataGridViewTeam.Rows[i].Cells[0].Value = (i + 1).ToString(); if (list[i].idprev != null) { clTeam = new CTeam(connect, (int)list[i].idprev); text = string.Format("{0} (ex - {1})", list[i].name, clTeam.stTeam.name); dataGridViewTeam.Rows[i].Cells[1].Value = text; } else { dataGridViewTeam.Rows[i].Cells[1].Value = list[i].name; } city = new CCity(connect, list[i].idcity); dataGridViewTeam.Rows[i].Cells[2].Value = city.stCity.name; dataGridViewTeam.Rows[i].Cells[3].Value = city.stFullCity.nameregion; dataGridViewTeam.Rows[i].Cells[4].Value = city.stFullCity.namecountry; dataGridViewTeam.Rows[i].Cells[5].Value = list[i].id.ToString(); } dataGridViewTeam.AllowUserToAddRows = false; } else { dataGridViewTeam.AllowUserToAddRows = false; } toolStripStatusLabel1.Text = string.Format("Число команд: {0}", list.Count); } catch (Exception ex) { MessageBox.Show(ex.Message, ex.Source); } }
private void DlgTeam_Load(object sender, EventArgs e) { this.Text = caption; clTeam = new CTeam(connect); textBoxName.Focus(); }
private void comboBoxName_SelectedIndexChanged(object sender, EventArgs e) { try { if (comboBoxName.Text.Length > 0) { char[] del = { ' ', '(', ')' }; string s = comboBoxName.Text.Trim(); string[] words = s.Split(del); clPlayer = new CPlayer(connect, words[0].Trim(), words[1].Trim(), words[3].Trim()); CEntryPlayers cl = new CEntryPlayers(connect); int idt = cl.IsEntryPlayer(IS.idseason, clPlayer.stPlayer.idplayer); if (idt != 0) { CTeam tm = new CTeam(connect, idt); labelIsDemind.ForeColor = Color.Red; labelIsDemind.Text = string.Format("{0}", tm.stTeam.name); } else { labelIsDemind.ForeColor = Color.DarkGreen; labelIsDemind.Text = "свободен"; } string str1 = string.Format("{0} {1} {2}", clPlayer.stPlayer.family, clPlayer.stPlayer.name, clPlayer.stPlayer.payname); labelFIO.Text = str1; CAge age = new CAge(); if (clPlayer.stPlayer.datebirth != null) { DateTime dte = (DateTime)clPlayer.stPlayer.datebirth; string sm = age.GetFullAge(dte, datein); string str2 = string.Format("{0}, {1}", dte.ToLongDateString(), sm); labelDate.Text = str2; } CCountry clCountry = new CCountry(connect); string str3 = string.Format("{0}, {1}", clPlayer.stPlayer.personalnum, clCountry.stCountry.shortname); labelPersNum.Text = str3; } } catch (Exception ex) { MessageBox.Show(ex.Message.ToString()); } }
/* * Initialize the Team array. * * @param address If non-zero, the new location of the Team array. */ internal static void Team_Init() { for (var i = 0; i < g_teamArray.Length; i++) { g_teamArray[i] = new CTeam(); //memset(g_teamArray, 0, sizeof(g_teamArray)); } Array.Fill(g_teamFindArray, null, 0, g_teamFindArray.Length); //memset(g_teamFindArray, 0, sizeof(g_teamFindArray)); g_teamFindCount = 0; }
/* вставка данных */ private void set_data() { CCoach clCoach; CPlayer clPlayer; string text; try { team = new CTeam(connect, stTeamPart.idteam); comboBoxNameTeam.Text = team.stTeam.name; CCity city = new CCity(connect, team.stTeam.idcity); labelDisl.Text = string.Format("{0}, {1}", city.stFullCity.name, city.stFullCity.nameregion); dateTimePickerDateIn.Value = stTeamPart.datein; div = new CDivision(connect, (int)IS.idseason, stTeamPart.iddivision); comboBoxDivision.Text = div.stDiv.name; clTeamComposition = new CEntryPlayers(connect); team_composition = clTeamComposition.GetListEntryPlayers(IS.idseason, stTeamPart.idteam, "Number"); init_data(team_composition); init_combo_captain(); if (stTeamPart.idcoach1 != null) { clCoach = new CCoach(connect, (int)stTeamPart.idcoach1); text = string.Format("{0} {1}", clCoach.stCoach.family, clCoach.stCoach.name); comboBoxCoach1.Text = text; } if (stTeamPart.idcoach2 != null) { clCoach = new CCoach(connect, (int)stTeamPart.idcoach2); text = string.Format("{0} {1}", clCoach.stCoach.family, clCoach.stCoach.name); comboBoxCoach2.Text = text; } if (stTeamPart.idcoach3 != null) { clCoach = new CCoach(connect, (int)stTeamPart.idcoach3); text = string.Format("{0} {1}", clCoach.stCoach.family, clCoach.stCoach.name); comboBoxCoach3.Text = text; } if (stTeamPart.idcaptain != null) { clPlayer = new CPlayer(connect, (int)stTeamPart.idcaptain); string num = get_num_captain((int)stTeamPart.idcaptain); text = string.Format("#{0} {1} {2}", num, clPlayer.stPlayer.family, clPlayer.stPlayer.name); comboBoxCaptain.Text = text; } } catch (Exception ex) { MessageBox.Show(ex.Message, ex.Source); } }
private List <int> get_arr_team(int idteam) { List <int> ret = new List <int>(); List <int> arr1 = new List <int>(); List <int> arr2 = new List <int>(); ret.Add(idteam); arr1.Add(idteam); int id = idteam; try { do { clTeam = new CTeam(connect, id); if (clTeam.stTeam.idprev != null) { id = (int)clTeam.stTeam.idprev; } else { id = 0; } if (id > 0) { ret.Add(id); arr1.Add(id); } }while (id > 0); foreach (int i in arr1) { List <int> bt = clTeam.GetExId(i); foreach (int btt in bt) { if (!isarr(arr1, btt)) { arr2.Add(btt); } } } foreach (int i1 in arr2) { ret.Add(i1); } } catch (Exception ex) { MessageBox.Show(ex.Message, ex.Source); } return(ret); }
private void init_data_in() { CPlayer clP = new CPlayer(connect); CEntryPlayers clEP = new CEntryPlayers(connect); CInfoSeason clIS; CTeam clTeam; try { dataGridViewIn.Rows.Clear(); List <STEntryPlayers> list = clEP.GetListEntryPlayer(gstPlayer.idplayer); if (list.Count > 0) { dataGridViewIn.Rows.Add(list.Count); for (int i = 0; i < list.Count; i++) { dataGridViewIn.Rows[i].Cells[0].Value = list[i].idseason; clIS = new CInfoSeason(connect, list[i].idseason); STInfoSeason st = (STInfoSeason)clIS.s_IS; dataGridViewIn.Rows[i].Cells[1].Value = st.nameseason; clTeam = new CTeam(connect, list[i].idteam); dataGridViewIn.Rows[i].Cells[2].Value = clTeam.stTeam.name; int cnt = clP.GetCntGames(list[i].idseason, list[i].idteam, gstPlayer.idplayer); dataGridViewIn.Rows[i].Cells[3].Value = cnt.ToString(); dataGridViewIn.Rows[i].Cells[4].Value = list[i].datein.ToLongDateString(); if (list[i].dateout != null) { DateTime dt = (DateTime)list[i].dateout; dataGridViewIn.Rows[i].Cells[5].Value = dt.ToLongDateString(); } } dataGridViewIn.ClearSelection(); dataGridViewIn.AllowUserToAddRows = false; } else { dataGridViewIn.AllowUserToAddRows = false; } } catch (Exception ex) { MessageBox.Show(ex.Message, ex.Source); } }
public Team(SqlConnection cn, STInfoSeason inf, ushort md) { InitializeComponent(); connect = cn; IS = inf; mode = md; clTeam = new CTeam(connect); this.WindowState = FormWindowState.Maximized; }
private void DlgTeamsPlayer_Load(object sender, EventArgs e) { string text = null; try { clWork = new CEntryPlayers(connect); clTeam = new CTeam(connect); init_combo_players(); init_combo_team(); if (oldData != null) { mode = 1; } else { mode = 0; } if (mode == 0) { text = "Добавить заявку игрока"; dateTimePickerDate.Value = IS.datebegin; DateTime dttt = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day, 0, 0, 0, 0); dateTimePickerTimeIn.Value = dttt; if (recomendedteam != null) { clTeam = new CTeam(connect, recomendedteam); comboBoxTeam.Text = clTeam.stTeam.name; } checkBoxOut.CheckState = CheckState.Unchecked; dateTimePickerDateOut.Enabled = false; dateTimePickerTimeOut.Enabled = false; } if (mode == 1) { text = "Редактировать заявку игрока"; set_data((STEntryPlayers)oldData); } view_param.idseason = null; this.Text = text; } catch (Exception ex) { MessageBox.Show(ex.Message, ex.Source); } }
private void init_data() { try { dataGridViewStatReferee.Rows.Clear(); list = clWork.GetListData(IS.idseason); if (list.Count > 0) { dataGridViewStatReferee.Rows.Add(list.Count); for (int i = 0; i < list.Count; i++) { dataGridViewStatReferee.Rows[i].Cells[0].Value = list[i].idgame; clReferee = new CReferee(connect, list[i].idreferee); dataGridViewStatReferee.Rows[i].Cells[1].Value = string.Format("{0} {1}", clReferee.stRef.family, clReferee.stRef.name); CTeam clTeam = new CTeam(connect, list[i].idteam); dataGridViewStatReferee.Rows[i].Cells[2].Value = clTeam.stTeam.name; int sum = list[i].cntfoulsd + list[i].cntfoulsp + list[i].cntfoulst + list[i].cntfoulsu; dataGridViewStatReferee.Rows[i].Cells[3].Value = sum.ToString(); dataGridViewStatReferee.Rows[i].Cells[4].Value = list[i].cntfoulsp.ToString(); dataGridViewStatReferee.Rows[i].Cells[5].Value = list[i].cntfoulsu.ToString(); dataGridViewStatReferee.Rows[i].Cells[6].Value = list[i].cntfoulst.ToString(); dataGridViewStatReferee.Rows[i].Cells[7].Value = list[i].cntfoulsd.ToString(); dataGridViewStatReferee.Rows[i].Cells[8].Value = list[i].cntfoulsc.ToString(); dataGridViewStatReferee.Rows[i].Cells[9].Value = list[i].cntfoulsb.ToString(); dataGridViewStatReferee.Rows[i].Cells[10].Value = list[i].filename; dataGridViewStatReferee.Rows[i].Cells[11].Value = list[i].idreferee; if (flawour.idgame == list[i].idgame && flawour.idreferee == list[i].idreferee && flawour.idteam == list[i].idteam) { gpos = i; } } dataGridViewStatReferee.AllowUserToAddRows = false; } else { dataGridViewStatReferee.AllowUserToAddRows = false; } } catch (Exception ex) { MessageBox.Show(ex.Message, ex.Source); } }
private void AwardsResult_Load(object sender, EventArgs e) { try { clDiv = new CDivision(connect); clWork = new CAwarsResult(connect); clTeam = new CTeam(connect); clAward = new CAward(connect); init_combo(); } catch (Exception ex) { MessageBox.Show(ex.Message, ex.Source); } }
private STTeam read_data() { STTeam ret = new STTeam(); CCity city; try { if (gstTeam.id != 0) { ret.id = gstTeam.id; } else { ret.id = clTeam.GetFreeId(); } if (textBoxName.Text.Length > 0) { ret.name = textBoxName.Text.Trim(); } else { ret.name = null; } string str = comboBoxCity.Text.Trim(); if (str.Length > 0) { city = new CCity(connect, str); ret.idcity = city.stCity.id; } else { ret.idcity = 0; } if (comboBoxPrevTeam.Text.Length > 0) { clTeam = new CTeam(connect, comboBoxPrevTeam.Text.Trim()); ret.idprev = clTeam.stTeam.id; } else { ret.idprev = null; } } catch (Exception ex) { MessageBox.Show(ex.Message.ToString()); } return(ret); }
private void set_data() { string text; try { textBoxId.Text = gstTF.id.ToString(); clTeam = new CTeam(connect, gstTF.idteam); comboBoxTeam.Text = clTeam.stTeam.name; if (gstTF.typepart == 0) { radioButtonPlayer.Checked = true; clPlayer = new CPlayer(connect, gstTF.idpart); text = string.Format("{0} {1} ({2})", clPlayer.stPlayer.family, clPlayer.stPlayer.name, clPlayer.stPlayer.personalnum); comboBoxPart.Text = text; } if (gstTF.typepart == 1) { radioButtonCoach.Checked = true; clCoach = new CCoach(connect, gstTF.idpart); text = string.Format("{0} {1} ({2})", clCoach.stCoach.family, clCoach.stCoach.name, clCoach.stCoach.personalnum); comboBoxPart.Text = text; } textBoxNGame.Text = gstTF.idgame.ToString(); game = clGame.GetGame(gstTF.idseason, gstTF.idgame); clTeam = new CTeam(connect, (int)game.idteam1); name1 = clTeam.stTeam.name; clTeam = new CTeam(connect, (int)game.idteam2); name2 = clTeam.stTeam.name; text = string.Format("{0} - {1}", name1, name2); textBoxDescriptGame.Text = text; textBoxDescript.Text = gstTF.descript; if (gstTF.idreferee > 0) { clReferee = new CReferee(connect, (int)gstTF.idreferee); text = string.Format("{0} {1}", clReferee.stRef.family, clReferee.stRef.name); comboBoxReferee.Text = text; } } catch (Exception ex) { MessageBox.Show(ex.Message, ex.Source); } }
private void init_data() { CTeam clTeam; try { dataGridViewFinalResult.Rows.Clear(); list_team = clET.GetTeamParticipant(IS.idseason, currdiv.id); if (list_team.Count > 0) { g_f = true; dataGridViewFinalResult.Rows.Add(list_team.Count); for (int i = 0; i < list_team.Count; i++) { STFinalResult st = clWork.GetData(IS.idseason, currdiv.id, list_team[i].idteam); clTeam = new CTeam(connect, list_team[i].idteam); if (st.rang > 0) { dataGridViewFinalResult.Rows[i].Cells[0].Value = st.rang.ToString(); } else { dataGridViewFinalResult.Rows[i].Cells[0].Value = ""; } dataGridViewFinalResult.Rows[i].Cells[1].Value = clTeam.stTeam.name; if (flawour.idteam == list_team[i].idteam) { gpos = i; } } dataGridViewFinalResult.ClearSelection(); dataGridViewFinalResult.AllowUserToAddRows = false; } else { dataGridViewFinalResult.AllowUserToAddRows = false; } } catch (Exception ex) { MessageBox.Show(ex.Message, ex.Source); } }