private void addUser() { List <string> users = new List <string>(); if (labLog.metaInformation.AllUsers != null) { foreach (LaborLog.UsersClass cc in labLog.metaInformation.AllUsers) { if (cc.Active) { users.Add(cc.Name); } } } PropertiesAdd uAdd = new PropertiesAdd("User", (string[])users.ToArray(), 15); if (uAdd.ShowDialog() == DialogResult.OK) { List <LaborLog.UsersClass> u = new List <UsersClass>(); if (labLog.metaInformation.AllUsers != null) { u = new List <LaborLog.UsersClass>(labLog.metaInformation.AllUsers); } bool existent = false; if (labLog.metaInformation.AllUsers != null) { for (int i = 0; i < labLog.metaInformation.AllUsers.Length; i++) { if (labLog.metaInformation.AllUsers[i].Name == uAdd.result) { labLog.metaInformation.AllUsers[i].Active = true; existent = true; } } } if (!existent) { u.Add(new LaborLog.UsersClass(uAdd.result, true)); labLog.metaInformation.AllUsers = u.ToArray(); } ModifiedDataBase = true; fillUsers(); } }
private void buttonAddCategorie_Click(object sender, EventArgs e) { List <string> c = new List <string>(); foreach (CategoryClass cc in labLog.metaInformation.Categories) { c.Add(cc.Name); } PropertiesAdd uAdd = new PropertiesAdd("Categories", (string[])c.ToArray(), 15); if (uAdd.ShowDialog() == DialogResult.OK) { List <CategoryClass> cC = new List <CategoryClass>(labLog.metaInformation.Categories); cC.Add(new CategoryClass(uAdd.result, true, true)); labLog.metaInformation.Categories = cC.ToArray(); ModifiedDataBase = true; fillCategories(); } }