Esempio n. 1
0
 partial void DeleteWikiContent(WikiContent instance);
Esempio n. 2
0
 partial void InsertWikiContent(WikiContent instance);
Esempio n. 3
0
 partial void UpdateWikiContent(WikiContent instance);
Esempio n. 4
0
		private void detach_WikiContents(WikiContent entity)
		{
			this.SendPropertyChanging();
			entity.Wiki = null;
		}
Esempio n. 5
0
		private void attach_WikiContents(WikiContent entity)
		{
			this.SendPropertyChanging();
			entity.Wiki = this;
		}
Esempio n. 6
0
        WikiContent CreateWikiContent(string username, string content, KEYID keyId, string reversion)
        {
            var wikiContent = new WikiContent()
            {
                WikiContentID = IDProvider.GetNewId("WikiContent"),
                KID = keyId.ToString(),
                Content = content,
                CrUserName = username,
                CreatedTime = TimeProvider.Now,
                Reversion = reversion
            };

            return wikiContent;
        }
Esempio n. 7
0
        internal void WriteWiki(WikiName name, WikiContent content)
        {
            Wiki wiki = new Wiki();
            wiki.Name = name;
            wiki.Content = content;

            WriteWiki(wiki);
        }
Esempio n. 8
0
        internal List<Wiki> GetWikisByName(WikiName name)
        {
            List<Wiki> list = new List<Wiki>();
            var con = ContextFactory.GetNewContext();
            list = (from wiki in con.Wikis
                    where wiki.Name == name.Text
                    select new Wiki()
                    {
                        Content = new WikiContent(wiki.Content),
                        Name = new WikiName(wiki.Name),
                        Version = new WikiVersion(wiki.Version),
                        CreatedAt = wiki.CreatedAt
                    }).ToList();
            return list;

            using (SqlConnection connection = new SqlConnection())
            {
                connection.ConnectionString = connectionString;

                SqlCommand cmd = connection.CreateCommand();

                cmd.CommandText = "SELECT * FROM [Wiki] WHERE name='" + name.Text + "'";

                logger.Info(cmd.CommandText);

                connection.Open();
                SqlDataReader reader = cmd.ExecuteReader();
                try
                {
                    while (reader.Read())
                    {
                        Wiki wiki = new Wiki();
                        WikiName n = new WikiName(reader.GetString(1));
                        WikiContent c = new WikiContent(reader.GetString(2));
                        WikiVersion v = new WikiVersion(reader.GetInt32(3));
                        wiki.Name = n;
                        wiki.Content = c;
                        wiki.Version = v;
                        wiki.CreatedAt = reader.GetDateTime(4);

                        list.Add(wiki);
                    }

                }
                finally
                {
                    if (!reader.IsClosed)
                    {
                        reader.Close();
                    }
                }

            }

            return list;
        }