Exemple #1
0
        public static bool TooEdit(TypeOfOwnership data)
        {
            if (TypeOfOwnerships == null)
            {
                TypeOfOwnerships = new List <TypeOfOwnership>();
            }
            if (TypeOfOwnerships.Count == 0)
            {
                TypeOfOwnerships.Add(data);
                return(true);
            }
            for (var i = 0; i < TypeOfOwnerships.Count; i++)
            {
                if (TypeOfOwnerships[i].Id == data.Id)
                {
                    TypeOfOwnerships[i] = data;
                    return(true);
                }
            }

            TypeOfOwnerships.Add(data);

            return(false);
        }
Exemple #2
0
        public static bool LoadTypeOfOwnership()
        {
            var path = FileHelper.GetDataFilesPath() + fileNameTypeOfOwnerships;

            TypeOfOwnerships = new List <TypeOfOwnership>();
            if (!File.Exists(path))
            {
                return(false);
            }

            var str   = FileHelper.LoadFile(path, 1251);
            var lines = str.Replace("\r\n", "\r").Split('\r');

            foreach (var line in lines)
            {
                if (string.IsNullOrEmpty(line))
                {
                    continue;
                }
                var obj = new TypeOfOwnership(line);
                TypeOfOwnerships.Add(obj);
            }
            return(true);
        }