public bool Delete(SoldierRecord soldier) { if (soldier.Id>0) { return dbConnection.Delete<SoldierRecord>(soldier.Id)==1; } return false; }
public PositionInfo(string name, string[] groups, int sequence, SoldierRecord assignedSoldier, XmlElement xml) { Sequence = sequence; Name = name; Groups = groups; AssignedSoldier = assignedSoldier; xmlElement = xml; BuildGroupPath(); }
public void CopyToSoldier(SoldierRecord soldier) { soldier.SeiraEmfanisis = Sequence; soldier.Kathikonta = Name; if (Groups.Length>=1) soldier.Group1 = Groups[0]; else soldier.Group1=""; if (Groups.Length>=2) soldier.Group2 = Groups[1]; else soldier.Group2=""; if (Groups.Length>=3) soldier.Group3 = Groups[2]; else soldier.Group3=""; if (Groups.Length>=4) soldier.Group4 = Groups[3]; else soldier.Group4=""; if (Groups.Length>=5) soldier.Group5 = Groups[4]; else soldier.Group5=""; }
public SoldierDetailsForm(SoldierRecord soldier, FieldFixtures fixtures) { // The InitializeComponent() call is required for Windows Forms designer support. InitializeComponent(); // TODO: Add constructor code after the InitializeComponent() call. // RecIdValueLabel.DataBindings.Add(new Binding("Text", soldier, "Id") ); OnomaTextBox.DataBindings.Add(new Binding("Text", soldier, "Onoma") ); EpithetoTextBox.DataBindings.Add(new Binding("Text", soldier, "Epitheto") ); ASMTextBox.DataBindings.Add(new Binding("Text", soldier, "Asm") ); KlasiTextBox.DataBindings.Add(new Binding("Text", soldier, "Klasi") ); SeiraTextBox.DataBindings.Add(new Binding("Text", soldier, "Seira") ); PolitikiTaytotitaTextBox.DataBindings.Add(new Binding("Text", soldier, "ArithmosPolitikisTaytotitas") ); ImerominiaGeniseosDateTimePicker.DataBindings.Add(new Binding("Text", soldier, "ImerominiaGenniseos") ); BathmosComboBox.DataSource = fixtures.Get("Bathmos"); BathmosComboBox.DataBindings.Add( new Binding("Text", soldier, "Bathmos")); IdikotitaComboBox.DataSource = fixtures.Get("Idikotita"); IdikotitaComboBox.DataBindings.Add( new Binding("Text", soldier, "Idikotita")); IneEfedrosComboBox.DataSource = fixtures.Get("IneEfedros"); IneEfedrosComboBox.DataBindings.Add( new Binding("Text", soldier, "EinaiEfedros")); TilefonoOikiasTextBox.DataBindings.Add(new Binding("Text", soldier, "Til_oikias") ); TilefonoErgasiasTextBox.DataBindings.Add(new Binding("Text", soldier, "Til_ergasias") ); TilefonoKinitoTextBox.DataBindings.Add(new Binding("Text", soldier, "Til_kinito") ); DieythinsiSpitiouTextBox.DataBindings.Add(new Binding("Text", soldier, "DieythinsiSpitiou") ); DieythinsiErgasiasTextBox.DataBindings.Add(new Binding("Text", soldier, "DieythinsiErgasias") ); Group1TextBox.DataBindings.Add( new Binding("Text",soldier, "Group1") ); Group2TextBox.DataBindings.Add( new Binding("Text",soldier, "Group2") ); Group3TextBox.DataBindings.Add( new Binding("Text",soldier, "Group3") ); Group4TextBox.DataBindings.Add( new Binding("Text",soldier, "Group4") ); Group5TextBox.DataBindings.Add( new Binding("Text",soldier, "Group5") ); KathikontaTextBox.DataBindings.Add( new Binding("Text",soldier, "Kathikonta") ); ArithmosOplouTextBox.DataBindings.Add(new Binding("Text", soldier, "ArithmosOplou") ); ArithmosKsifologxisTextBox.DataBindings.Add(new Binding("Text", soldier, "ArithmosXyfoloxis") ); AllosOplismosTextBox.DataBindings.Add(new Binding("Text", soldier, "AllosOplismos") ); SxoliaTextBox.DataBindings.Add(new Binding("Text", soldier, "Sxolia") ); LoipaStoixiaTextBox.DataBindings.Add(new Binding("Text", soldier, "LoipaStoixia") ); CreationDateTextBox.DataBindings.Add(new Binding("Text", soldier, "CreationDate") ); LastUpdateDateTextBox.DataBindings.Add(new Binding("Text", soldier, "LastUpdateDate") ); }
// // Button event handlers // void ButtonAddNewClick(object sender, EventArgs e) { SoldierRecord newSoldier = new SoldierRecord { CreationDate = DateTime.Now, LastUpdateDate = DateTime.Now, ImerominiaGenniseos = new DateTime(1900,1,1), }; SoldierDetailsForm form = new SoldierDetailsForm(newSoldier, fixtures); form.ShowDialog(this); if (form.DialogResult== DialogResult.OK) { dataManager.Insert(newSoldier); bindingSource1.Add(newSoldier); } }
void ButtonDiorthosiClick(object sender, EventArgs e) { if (personelGridView.SelectedRows.Count>0) { int idx = personelGridView.SelectedRows[0].Index; SoldierRecord soldier = (SoldierRecord) personelGridView.SelectedRows[0].DataBoundItem; SoldierRecord newSoldier = new SoldierRecord( soldier ); SoldierDetailsForm form = new SoldierDetailsForm(newSoldier, fixtures); form.ShowDialog(this); if (form.DialogResult== DialogResult.OK) { newSoldier.LastUpdateDate = DateTime.Now; dataManager.Update( newSoldier as SoldierRecord); soldier.CopyFrom(newSoldier); soldiersBindingList.ResetItem(idx); } } }
public void Update(SoldierRecord soldier) { dbConnection.Update(soldier, typeof(SoldierRecord)); }
public void Insert(SoldierRecord soldier) { dbConnection.Insert(soldier, typeof(SoldierRecord)); }
public SoldierRecord(SoldierRecord other) { CopyFrom(other); }
public void CopyFrom(SoldierRecord other) { Id = other.Id; Onoma = other.Onoma; Epitheto = other.Epitheto; Asm = other.Asm; Klasi = other.Klasi; Seira = other.Seira; ArithmosPolitikisTaytotitas = other.ArithmosPolitikisTaytotitas; ImerominiaGenniseos = other.ImerominiaGenniseos; Bathmos = other.Bathmos; Idikotita = other.Idikotita; EinaiEfedros = other.EinaiEfedros; DieythinsiSpitiou = other.DieythinsiSpitiou; DieythinsiErgasias = other.DieythinsiErgasias; Til_oikias = other.Til_oikias; Til_kinito = other.Til_kinito; Til_ergasias = other.Til_ergasias; SeiraEmfanisis = other.SeiraEmfanisis; Kathikonta = other.Kathikonta; Group1 = other.Group1; Group2 = other.Group2; Group3 = other.Group3; Group4 = other.Group4; Group5 = other.Group5; ArithmosOplou = other.ArithmosOplou; ArithmosXyfoloxis = other.ArithmosXyfoloxis; AllosOplismos = other.AllosOplismos; Sxolia = other.Sxolia; LoipaStoixia = other.LoipaStoixia; CreationDate = other.CreationDate; LastUpdateDate = other.LastUpdateDate; }