示例#1
0
文件: DataBLL.cs 项目: wwwK/2016
 public bool Add(object obj, out string msg)
 {
     msg = "";
     if (obj == null)
     {
         msg = "对象为空";
         return(false);
     }
     try
     {
         sqlHelper.Add(obj);
         return(true);
     }
     catch (Exception e)
     {
         msg = e.Message;
         return(false);
     }
 }
示例#2
0
        static void GetArticles(string channelUrl, int channelId)
        {
            var lstArticles = spider.GetArticles(channelUrl, channelId);

            foreach (var article in lstArticles)
            {
                if (article.excerpt.Length > 999)
                {
                    article.excerpt = article.excerpt.Substring(0, 999);
                }
                var insertedID = sqlhelperBackend.AddToGetInsertID("[Article]", new Dictionary <string, string> {
                    { "ChannelId", channelId.ToString() },
                    { "Title", article.title },
                    { "Thumbnail", article.lead_image_url },
                    { "Headlines", article.excerpt },
                    { "Content", article.content },
                    { "Keyword", "" },
                    { "Source", article.domain },
                    { "SourceUrl", article.url },
                    { "SourceType", "16" },
                    { "FriendlyTitle", VietCMS.Framework.Core.Common.WebControl.ToFriendlyString(article.title) },
                    { "TypeId", "1" },
                    { "AuthorAlias", article.author },
                    { "Status", "2" },
                    { "CreatedAt", DateTime.Now.ToString() },
                    { "CreatedBy", System.Configuration.ConfigurationManager.AppSettings.Get("User_ID") },
                    { "LastModifiedBy", System.Configuration.ConfigurationManager.AppSettings.Get("User_ID") },
                    { "LastModifiedAt", DateTime.Now.ToString() }
                }, "INSERTED.ArticleId");
                sqlhelperBackend.Add("[ArticleRoyalty]", new Dictionary <string, string> {
                    { "ArticleId", insertedID.ToString() },
                    { "RoyaltyStepId", "16" },
                    { "CreatedBy", System.Configuration.ConfigurationManager.AppSettings.Get("User_ID") },
                    { "CreatedAt", DateTime.Now.ToString() },
                    { "LastModifiedBy", System.Configuration.ConfigurationManager.AppSettings.Get("User_ID") },
                    { "LastModifiedAt", DateTime.Now.ToString() }
                });
            }
        }