protected bool CandidateIsUnice(string candidate, object obj) { //AuxVariables bool result; List <object> objects; //Run Method result = true; if (candidate != "") { switch (storage_controller.GetClassTypeOfObject(obj)) { case Controllers.ClassType.account: objects = Read(Controllers.ClassType.account); foreach (object obj2 in objects) { Models.Account temp = (Models.Account)obj2; if (temp.GetName() == candidate) { result = false; } } break; case Controllers.ClassType.accounting_record: objects = Read(Controllers.ClassType.accounting_record); foreach (object obj2 in objects) { Models.AccountingRecord temp = (Models.AccountingRecord)obj2; if (temp.GetName() == candidate) { result = false; } } break; case Controllers.ClassType.accounting_record_line: objects = Read(Controllers.ClassType.accounting_record_line); foreach (object obj2 in objects) { Models.AccountingRecordLine temp = (Models.AccountingRecordLine)obj2; if (temp.GetDescription() == candidate) { result = false; } } break; default: break; } } return(result); }