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 init_combo() { CCity city; try { comboBoxCity.Items.Clear(); city = new CCity(connect); List <STCity> list_c = city.GetListCity(); string text = null; foreach (STCity item in list_c) { comboBoxCity.Items.Add(item.name); if (item.name == "Минск") { text = "Минск"; } } if (text != null) { comboBoxCity.Text = text;; CCity citys = new CCity(connect, text); set_disl(citys.stFullCity); } } catch (Exception ex) { MessageBox.Show(ex.Message.ToString()); } }
private void set_data() { CCity city; try { textBoxName.Text = gstPlace.name; city = new CCity(connect, gstPlace.idcity); comboBoxCity.Text = city.stCity.name; set_disl(city.stFullCity); textBoxAddress.Text = gstPlace.address; if (gstPlace.vf == 1) { checkBoxVisible.Checked = true; } else { checkBoxVisible.Checked = false; } } catch (Exception ex) { MessageBox.Show(ex.Message.ToString()); } }
private STPlace read_data() { STPlace ret = new STPlace(); CCity city; try { if (gstPlace.id != 0) { ret.id = gstPlace.id; } else { ret.id = clPlace.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 (textBoxAddress.Text.Length > 0) { ret.address = textBoxAddress.Text.Trim(); } else { ret.address = null; } if (checkBoxVisible.Checked == true) { ret.vf = 1; } else { ret.vf = 0; } } catch (Exception ex) { MessageBox.Show(ex.Message.ToString()); } return(ret); }
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 DlgCitys_Load(object sender, EventArgs e) { this.Text = caption; clCity = new CCity(connect); textBoxName.Focus(); }
/* вставка данных */ 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 void comboBoxCity_SelectedIndexChanged(object sender, EventArgs e) { CCity city; string str = comboBoxCity.Text.Trim(); if (str.Length > 0) { city = new CCity(connect, str); set_disl(city.stFullCity); } }
public Citys(SqlConnection cn, ushort md) { InitializeComponent(); connect = cn; mode = md; clCity = new CCity(connect); this.WindowState = FormWindowState.Maximized; gpos = 0; }
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 init_list() { list = clPlace.GetListPlace(); CCity city; dataGridViewPlace.Rows.Clear(); try { if (list.Count > 0) { g_f = true; dataGridViewPlace.Rows.Add(list.Count); for (int i = 0; i < list.Count; i++) { dataGridViewPlace.Rows[i].Cells[0].Value = (i + 1).ToString(); dataGridViewPlace.Rows[i].Cells[1].Value = list[i].name; city = new CCity(connect, list[i].idcity); dataGridViewPlace.Rows[i].Cells[2].Value = city.stCity.name; dataGridViewPlace.Rows[i].Cells[3].Value = list[i].address; if (list[i].vf != null) { if (list[i].vf == 1) { dataGridViewPlace.Rows[i].Cells[4].Value = "*"; } } if (flawour.Equals(list[i])) { gpos = i; } } dataGridViewPlace.AllowUserToAddRows = false; } else { dataGridViewPlace.AllowUserToAddRows = false; } } catch (Exception ex) { MessageBox.Show(ex.Message, ex.Source); } }
public void GenerateCommands(CGame _game, Dictionary <int, List <IGameCommand> > _cityGameCommands, int _cityID) { CCity city = _game.GetCityByID(_cityID); if (!_cityGameCommands.ContainsKey(_cityID)) { _cityGameCommands.Add(_cityID, new List <IGameCommand>()); } if (this.rand_.Next(10) < 5) { IGameCommand gameCmdAttack = new CGameCmdAttack(-1, null); // to implement ... // 1. randomly pick characters // 2. randomly pick soldier number for each troop // 3. randomly pick target city // defending army will be generated during command execution _cityGameCommands[_cityID].Add(gameCmdAttack); } foreach (CCharacter character in city.Characters) { int cmd = this.rand_.Next(4); switch (cmd) { case 0: _cityGameCommands[_cityID].Add(new CGameCmdDevelopAgriculture(character.City, character, 100)); break; case 1: _cityGameCommands[_cityID].Add(new CGameCmdDevelopCommerce(character.City, character, 100)); break; case 2: _cityGameCommands[_cityID].Add(new CGameCmdIncreaseCityDefence(character.City, character, 100)); break; case 3: _cityGameCommands[_cityID].Add(new CGameCmdRaiseTroop(character.City, character, 100)); break; } } }
void LoadCity() { cbCity.Items.Clear(); cbCity.Items.Add(new ListItem("请选择", "")); if (cbProvince.SelectedIndex == 0) { return; } CProvince province = (CProvince)Global.GetCtx().ProvinceMgr.Find(new Guid(cbProvince.SelectedItem.Value)); List <CBaseObject> lstObj = province.CityMgr.GetList(); foreach (CBaseObject obj in lstObj) { CCity city = (CCity)obj; ListItem item = new ListItem(city.Name, city.Id.ToString()); cbCity.Items.Add(item); } cbCity.SelectedIndex = 0; }
private STCity GetSelectionData() { STCity ret = new STCity(); string n; try { foreach (DataGridViewRow item in dataGridViewCity.SelectedRows) { n = item.Cells[1].Value.ToString(); CCity ct = new CCity(connect, n); ret = ct.stCity; } } catch (Exception ex) { MessageBox.Show(ex.Message, ex.Source); } return(ret); }
public CGameCmdDevelopAgriculture(CCity _city, CCharacter _character, int _goldCost) { this.city_ = _city; this.character_ = _character; this.goldCost_ = _goldCost; }
private void Stats_Load(object sender, EventArgs e) { string text; CTeam cl; CCity clc; int idcity1 = 0, idcity2 = 0; try { cl = new CTeam(connect, (int)gSTGame.idteam1); nameteam1 = cl.stTeam.name; idcity1 = cl.stTeam.idcity; cl = new CTeam(connect, (int)gSTGame.idteam2); nameteam2 = cl.stTeam.name; idcity2 = cl.stTeam.idcity; text = string.Format("Статистика игры: {0} - {1} {2}:{3}", nameteam1, nameteam2, gSTGame.apoints, gSTGame.bpoints); this.Text = text; clc = new CCity(connect, idcity1); if (clc.stFullCity.name != null) { radioButtonTeam1.Text = string.Format("{0} ({1},{2})", nameteam1, clc.stFullCity.name, clc.stFullCity.namecountry); } else { radioButtonTeam1.Text = nameteam1; } clc = new CCity(connect, idcity2); if (clc.stFullCity.name != null) { radioButtonTeam2.Text = string.Format("{0} ({1},{2})", nameteam2, clc.stFullCity.name, clc.stFullCity.namecountry); } else { radioButtonTeam2.Text = nameteam2; } curridteam = (int)gSTGame.idteam1; currnameteam = nameteam1; currentpoints = (int)gSTGame.apoints; clTC = new CEntryPlayers(connect); List <STEntryPlayers> lst = clTC.GetListEntryPlayersReal(IS.idseason, (int)gSTGame.idteam1, (DateTime)gSTGame.datetime, null); team1 = lst; team1.Sort(clep); lst = clTC.GetListEntryPlayersReal(IS.idseason, (int)gSTGame.idteam2, (DateTime)gSTGame.datetime, null); team2 = lst; team2.Sort(clep); currteam = team1; init_data(); } catch (Exception ex) { MessageBox.Show(ex.Message, ex.Source); } }
private void Awake() { _city = GetComponent <CCity>(); }
public void CreateCity(string name) { CCity city = new CCity(name); city.Create(); }
public void UpdateCity(string id, string name) { CCity city = new CCity(Guid.Parse(id), name); city.Update(); }
public void DeleteCity(string id) { CCity city = new CCity(Guid.Parse(id)); city.Delete(); }
public CGameCmdIncreaseCityDefence(CCity _city, CCharacter _character, int _goldCost) { this.city_ = _city; this.character_ = _character; this.goldCost_ = _goldCost; }
public CGameCmdRaiseTroop(CCity _city, CCharacter _character, int _goldCost) { this.city_ = _city; this.character_ = _character; this.goldCost_ = _goldCost; }
/* вспомогательные функции виз. отображения календаря */ private void init_list_add_row(STGame item, int i) { CTeam clTeam = new CTeam(connect); CPlace clPlace = new CPlace(connect); CDivision clDivision = new CDivision(connect); CGroup clGroup = new CGroup(connect); CCity clCity; string text = null; string team1 = null; string team2 = null; Color color = Color.Black; try { if (item.apoints > 0 && item.bpoints > 0) { color = Color.Black; } else { color = Color.Red; } dataGridViewGames.Rows[i].DefaultCellStyle.ForeColor = color; /* вставляем номер игры */ dataGridViewGames.Rows[i].Cells[1].Value = item.idgame; /* игра и результат */ if (item.idteam1 != null) { clTeam = new CTeam(connect, (int)item.idteam1); team1 = clTeam.stTeam.name; } if (item.idteam2 != null) { clTeam = new CTeam(connect, (int)item.idteam2); team2 = clTeam.stTeam.name; } text = string.Format("{0} {1} - {2} {3}", team1, item.apoints, item.bpoints, team2); /* выводим команды которые играют */ dataGridViewGames.Rows[i].Cells[2].Value = text; /* дата и время игры */ if (item.datetime != null) { DateTime dt = (DateTime)item.datetime; text = string.Format("{0} {1}:{2:00}", dt.ToLongDateString(), dt.Hour, dt.Minute); dataGridViewGames.Rows[i].Cells[3].Value = text; } /* место игры */ if (item.idplace != null) { clPlace = new CPlace(connect, (int)item.idplace); clCity = new CCity(connect, clPlace.stPlace.idcity); text = clPlace.stPlace.name; if (clCity.stFullCity.name != null) { text += string.Format(" ({0},{1})", clCity.stFullCity.name, clCity.stFullCity.shortnamecountry); } dataGridViewGames.Rows[i].Cells[4].Value = text; } /* группа */ if (item.idgroup != null) { clGroup = new CGroup(connect, (int)IS.idseason, (int)item.iddivision, (int)item.idgroup); text = string.Format("{0}", clGroup.stGroup.namegroup); dataGridViewGames.Rows[i].Cells[5].Value = text; } } catch (Exception ex) { MessageBox.Show(ex.Message.ToString()); } }
public CGameCmdDevelopCommerce(CCity _city, CCharacter _character, int _goldCost) { this.city_ = _city; this.character_ = _character; this.goldCost_ = _goldCost; }