private void GangList_FormClosing(object sender, FormClosingEventArgs e) { if (gangGridView.CurrentRow != null) { var g = gangGridView.CurrentRow.DataBoundItem as CriminalGang; if (DialogResult == DialogResult.OK) { Gang = g; } } }
public void TestIsGangMember() { var testGang = new CriminalGang("North Side Boys"); for (var i = 0; i < 55; i++) { testGang.Add(new NorthSideBoyEg()); } testGang.Idiosyncrasies.Add(new GangColors()); testGang.Idiosyncrasies.Add(new GangTatoo()); testGang.CriminalActivity.Add(new DrugDealin()); testGang.Add(new MikeWannbeEg()); Assert.IsTrue(testGang.IsGangMember(new MikeWannbeEg())); }
public GangInfo(CriminalGang gang) { InitializeComponent(); Gang = gang; FileCabinet = FileCabinet.GetInstance(); nameBox.Text = Gang.Name; foundationtimebox.Value = Gang.FoundationDate; countryBox.SelectedItem = Gang.Country; gangImageBox.Image = Gang.Image; featuresBox.Text = Gang.Features; IdLabelValue.Text = Gang.Id.ToString(); leaderlinkedLabel.Text = Gang.LeaderName == " " ? "None": Gang.LeaderName; if (User.Role == UserRole.User) { foreach (Control c in Controls) { if (c is TextBox t) { t.ReadOnly = true; } if (c is GroupBox g) { foreach (Control gc in g.Controls) { if (gc is RichTextBox rt) { rt.ReadOnly = true; } } } ComboBox cb = c as ComboBox; if (cb != null) { cb.Enabled = false; } DateTimePicker dt = c as DateTimePicker; if (dt != null) { dt.Enabled = false; } imageChoseButton.Hide(); addButton.Hide(); leaderChoseButton.Hide(); saveButton.Hide(); deleteButton.Hide(); } } }
public void TestIsCriminalGang() { var testGang = new CriminalGang("North Side Boys"); for (var i = 0; i < 55; i++) { testGang.Add(new NorthSideBoyEg()); } testGang.Idiosyncrasies.Add(new GangColors()); testGang.Idiosyncrasies.Add(new GangTatoo()); testGang.CriminalActivity.Add(new DrugDealin()); var testResult = testGang.IsValid(new MikeWannbeEg()); testGang.Add(new MikeWannbeEg()); Console.WriteLine(testGang.ToString()); Assert.IsTrue(testResult); }
//Constructors public GangInfo() { InitializeComponent(); Gang = new CriminalGang(); FileCabinet = FileCabinet.GetInstance(); }