예제 #1
0
        public static void ZapisiIzmenjenSadrzaj(string idStarog, SadrzajApartmana sadrzaj)
        {
            string[] lines = File.ReadAllLines(path);
            for (int i = 0; i < lines.Length; i++)
            {
                if (lines[i].Split('|')[0] == idStarog)
                {
                    var pom = sadrzaj.ToString();
                    lines[i] = pom;
                }
            }

            File.WriteAllLines(path, lines);
        }
예제 #2
0
        public static SadrzajApartmana GetSadrzajById(string id)
        {
            string[]         lines = File.ReadAllLines(path);
            SadrzajApartmana ret   = null;

            foreach (var line in lines)
            {
                if (string.IsNullOrEmpty(line) || string.IsNullOrWhiteSpace(line))
                {
                    continue;
                }
                if (id == line.Split('|')[0])
                {
                    if (line.Split('|')[2] != "OBRISAN")
                    {
                        ret = new SadrzajApartmana(line.Split('|')[0], line.Split('|')[1]);
                    }
                }
            }

            return(ret);
        }
예제 #3
0
        private static List <SadrzajApartmana> GetSadrzajApartmana(string idevi)
        {
            List <SadrzajApartmana> ret = new List <SadrzajApartmana>();
            SadrzajApartmana        pom;
            string putanjaSadrzaj = HostingEnvironment.MapPath("~/Files/SadrzajiApartmana.txt");

            string[] sadrzaji = File.ReadAllLines(putanjaSadrzaj);

            string[] ids = idevi.Split(',');
            foreach (var item in ids)
            {
                for (int i = 0; i < sadrzaji.Length; i++)
                {
                    if (item == sadrzaji[i].Split('|')[0])
                    {
                        pom = new SadrzajApartmana(item, sadrzaji[i].Split('|')[1]);
                        ret.Add(pom);
                    }
                }
            }

            return(ret);
        }
예제 #4
0
 public static void ZapisiSadrzaj(SadrzajApartmana sadrzaj)
 {
     File.AppendAllText(path, sadrzaj.ToString());
 }