Beispiel #1
0
        public void Test()
        {
            bool success = true;

            NaiveApiConnector <RSStyle> ac1 = new NaiveApiConnector <RSStyle>();
            NaiveApiConnector <RSStyle> ac2 = new NaiveApiConnector <RSStyle>();

            ac1.AttachWebApiEndpoint("http://localhost:56345/Api/Styles/");
            ac2.AttachWebApiEndpoint("http://localhost:56345/Api/Styles/");

            RSStyle o1 = new RSStyle()
            {
                Notes = "Test-o1"
            };
            RSStyle o2 = new RSStyle()
            {
                Notes = "Test-o2"
            };
            RSStyle o3 = new RSStyle()
            {
                Notes = "Test-o3"
            };
            RSStyle o4 = new RSStyle()
            {
                Notes = "Test-o4"
            };

            ac1.Synchronize();
            ac2.Synchronize();

            ac1.Add(o1);
            o1 = ac1.LastInserted();
            ac2.Add(o2);
            o2 = ac2.LastInserted();

            ac1.Synchronize();
            ac2.Synchronize();

            ac1.Last().Notes += "Edited";


            List <RSStyle> toRemove = new List <RSStyle>();

            foreach (RSStyle s in ac1)
            {
                if (s.Notes.StartsWith("Test-"))
                {
                    toRemove.Add(s);
                }
            }

            foreach (RSStyle s in toRemove)
            {
                ac1.Remove(s);
            }

            ac1.Synchronize();
            ac2.Synchronize();
        }
Beispiel #2
0
        private string GetStyleCode(RSStyleType type)
        {
            RSStyle style = db.Styles.Where(s => s.Type == (int)type).FirstOrDefault(s => s.Selected);

            if (style == null)
            {
                return("");
            }

            if (System.IO.File.Exists(Server.MapPath(style.Path)))
            {
                using (StreamReader sr = new StreamReader(Server.MapPath(style.Path)))
                {
                    return(sr.ReadToEnd());
                }
            }
            else
            {
                return(style.Code);
            }
        }