Exemple #1
0
 /// <summary>
 /// 删除记录
 /// </summary>
 /// <param name="GroupId"></param>
 public static void Delete(int GroupId)
 {
     BlogDataDataContext BD = new BlogDataDataContext();
     var temp = BD.Weblog_Groups.Single(p => p.Group_Id == GroupId);
     BD.Weblog_Groups.DeleteOnSubmit(temp);
     BD.SubmitChanges();
 }
 public static void Edit(Weblog_Recommend WR)
 {
     BlogDataDataContext BD = new BlogDataDataContext();
    var temp= BD.Weblog_Recommends.Single(p=>p.Recommend_Id==WR.Recommend_Id);
    temp.Recommend_LogId = WR.Recommend_LogId;
    BD.SubmitChanges();
 }
 /// <summary>
 /// 插入新的RssLink
 /// </summary>
 /// <param name="WURL"></param>
 public static bool InsertRssLink(Weblog_UserRssLink WURL)
 {
     BlogDataDataContext BD = new BlogDataDataContext();
     BD.Weblog_UserRssLinks.InsertOnSubmit(WURL);
     BD.SubmitChanges();
     return true;
 }
 public static void DeleteById(int Id)
 {
     BlogDataDataContext BD = new BlogDataDataContext();
     var temp = BD.Weblog_CssFiles.Where(p => p.CssFile_Id == Id);
     BD.Weblog_CssFiles.DeleteAllOnSubmit(temp);
     BD.SubmitChanges();
 }
Exemple #5
0
 /// <summary>
 /// 删除主题
 /// </summary>
 /// <param name="Id"></param>
 public static void Delete(int Id)
 {
     BlogDataDataContext BD = new BlogDataDataContext();
     var temp = BD.Weblog_Themes.Single(p => p.Theme_Id == Id);
     BD.Weblog_Themes.DeleteOnSubmit(temp);
     BD.SubmitChanges();
 }
 /// <summary>
 /// 删除记录
 /// </summary>
 /// <param name="CssId"></param>
 public static void Delete(int CssId)
 {
     BlogDataDataContext BD = new BlogDataDataContext();
     var temp = BD.Weblog_UserCsses.Single(p => p.UserCss_Id == CssId);
     BD.Weblog_UserCsses.DeleteOnSubmit(temp);
     BD.SubmitChanges();
 }
Exemple #7
0
 public static void Edit(Weblog_Notice WN)
 {
     BlogDataDataContext BD = new BlogDataDataContext();
     Weblog_Notice notice = BD.Weblog_Notices.Where(p => p.Notice_Type == 1).First();
     notice.Notice_Content = System.Web.HttpContext.Current.Server.HtmlEncode(WN.Notice_Content).Replace("\n", "<br />");
     notice.Notice_CreateTime = DateTime.Now;
     BD.SubmitChanges();
 }
Exemple #8
0
 /// <summary>
 /// 修改主题
 /// </summary>
 /// <param name="WT"></param>
 public static void Update(Weblog_Theme WT)
 {
     BlogDataDataContext BD = new BlogDataDataContext();
     var temp = BD.Weblog_Themes.Single(p => p.Theme_Id == WT.Theme_Id);
     temp.Theme_Intro = WT.Theme_Intro;
     temp.Theme_Name = WT.Theme_Name;
     BD.SubmitChanges();
 }
        public static bool  Insert(Weblog_RecommendTheme WRT)
        {
            BlogDataDataContext BD = new BlogDataDataContext();
            BD.Weblog_RecommendThemes.InsertOnSubmit(WRT); 
            BD.SubmitChanges();
            return true;

        }
Exemple #10
0
 /// <summary>
 /// 更新记录
 /// </summary>
 /// <param name="WUC"></param>
 public static void Update(Weblog_UserCss WUC)
 {
     BlogDataDataContext BD = new BlogDataDataContext();
     var temp = BD.Weblog_UserCsses.Single(p => p.UserCss_Id == WUC.UserCss_Id);
     temp.UserCss_CssFileId = WUC.UserCss_CssFileId;
     temp.UserCss_Used = WUC.UserCss_Used;
     temp.UserCss_UserId = WUC.UserCss_UserId;
     BD.SubmitChanges();
 }
 /// <summary>
 /// 根据ID来删除RssLink
 /// </summary>
 /// <param name="ID"></param>
 /// <returns></returns>
 public static bool DeleteRssLinkByID(int UID,int ID)
 {
     BlogDataDataContext BD = new BlogDataDataContext();
     Weblog_UserRssLink temp = null;
     var WURL = BD.Weblog_UserRssLinks.Where(p => p.Weblog_UserRssLinkId == ID&&p.Weblog_UserId==UID);
     if (WURL.Count()>0)
     {
         temp = WURL.First();
         BD.Weblog_UserRssLinks.DeleteOnSubmit(temp);
         BD.SubmitChanges();
         return true;
     }
     return false;
 }
        /// <summary>
        /// 插入新的文章种类
        /// </summary>
        /// <param name="WC"></param>
        /// <returns></returns>
        public static bool Insert(Weblog_Category WC)
        {
            BlogDataDataContext BD = new BlogDataDataContext();

            try
            {
                BD.Weblog_Categorys.InsertOnSubmit(WC);
                BD.SubmitChanges();
            }
            catch (Exception)
            {
                return false;
            }
            return true;
        }
 /// <summary>
 /// 插入新的文章种类并返回CateID
 /// </summary>
 /// <param name="WC"></param>
 /// <param name="CateID"></param>
 public static void Insert(Weblog_Category WC, out int CateID)
 {
     BlogDataDataContext BD = new BlogDataDataContext();
     try
     {
         BD.Weblog_Categorys.InsertOnSubmit(WC);
         BD.SubmitChanges();
         CateID = WC.Cate_Id;
     }
     catch (Exception)
     {
         
         throw;
     }
 }
Exemple #14
0
 /// <summary>
 /// 修改数据
 /// </summary>
 /// <param name="WG"></param>
 public static void Update(Weblog_Group WG)
 {
     BlogDataDataContext BD = new BlogDataDataContext();
     var temp = BD.Weblog_Groups.Single(p=>p.Group_Id==WG.Group_Id);
     temp.Group_AdministratorsCount = WG.Group_AdministratorsCount;
     temp.Group_ClassId = WG.Group_ClassId;
     temp.Group_Competence = WG.Group_Competence;
     temp.Group_CreateTime = WG.Group_CreateTime;
     temp.Group_FounderId = WG.Group_FounderId;
     temp.Group_ImageUrl = WG.Group_ImageUrl;
     temp.Group_Introduce = WG.Group_Introduce;
     temp.Group_IsCertificateWhileJoin = WG.Group_IsCertificateWhileJoin;
     temp.Group_IsViewByStrangers = WG.Group_IsViewByStrangers;
     temp.Group_Keywords = WG.Group_Keywords;
     temp.Group_MembersCount = WG.Group_MembersCount;
     temp.Group_Name = WG.Group_Name;
     temp.Group_Notice = WG.Group_Notice;
     temp.Group_TopicCount = WG.Group_TopicCount;
     temp.Group_Url = WG.Group_Url;
     BD.SubmitChanges();
 }
 /// <summary>
 /// 更新RSS镜像是否审核通过
 /// </summary>
 /// <param name="ID">RssLinkID</param>
 /// <returns></returns>
 public static bool UpdateRssLinkByID(int ID)
 {
     BlogDataDataContext BD = new BlogDataDataContext();
     Weblog_UserRssLink temp = null;
     var WURL = BD.Weblog_UserRssLinks.Where(p => p.Weblog_UserRssLinkId == ID);
     if (WURL.Count()>0)
     {
         temp = WURL.First();
         if (temp.Weblog_UserRssIsPassed==true)
         {
             temp.Weblog_UserRssIsPassed = false;
         }
         else
         {
             temp.Weblog_UserRssIsPassed = true;
         }
         BD.SubmitChanges();
         return true;
     }
     return false;
 }
Exemple #16
0
 public static void Update(Weblog_Log WL)
 {
     BlogDataDataContext BD = new BlogDataDataContext();
     Weblog_Log temp = BD.Weblog_Logs.Single(p => p.Log_Id == WL.Log_Id);
     temp.Log_CateId = WL.Log_CateId;
     temp.Log_Title = WL.Log_Title;
     temp.Log_Content = WL.Log_Content;
     temp.Log_IsDraft = WL.Log_IsDraft;
     temp.Log_LastModiTime = WL.Log_LastModiTime;
     temp.Log_IsTop = WL.Log_IsTop;
     temp.Log_IsPasssword = WL.Log_IsPasssword;
     temp.Log_IsEnRePly = WL.Log_IsEnRePly;
     temp.Log_IsIndexShow = WL.Log_IsIndexShow;
     temp.Log_PassWord = WL.Log_PassWord;
     temp.Log_KeyWords = WL.Log_KeyWords;
     temp.Log_CreateTime = WL.Log_CreateTime;
     BD.SubmitChanges();
 }
Exemple #17
0
 /// <summary>
 /// 自动添加
 /// </summary>
 /// <param name="WL"></param>
 /// <returns></returns>
 public static void AutoInsert(Weblog_Log WL,out int LogId)
 {
     BlogDataDataContext BD = new BlogDataDataContext();
         BD.Weblog_Logs.InsertOnSubmit(WL);
     BD.SubmitChanges();
     LogId = WL.Log_Id; 
 }
Exemple #18
0
        public static bool Insert(Weblog_Log WL ,out int Log_Id)
        {
            BlogDataDataContext BD = new BlogDataDataContext();
            BD.Weblog_Logs.InsertOnSubmit(WL);
            BD.SubmitChanges();
            Log_Id = WL.Log_Id;
            return true;

        }
Exemple #19
0
 /// <summary>
 /// 移动单个日志到
 /// </summary>
 /// <param name="SourceCateId"></param>
 /// <param name="TagetCateId"></param>
 /// <param name="LogId"></param>
 public static void UpdateLogCateIdSingle( int TagetCateId, int LogId)
 {
     BlogDataDataContext BD = new BlogDataDataContext();
     var temp = BD.Weblog_Logs.Where(p => p.Log_Id == LogId);
     foreach (var ret in temp)
     {
         ret.Log_CateId = TagetCateId;
     }
  BD.SubmitChanges();
 }
Exemple #20
0
 public bool DeleteByID(int id)
 {
     using (BlogDataDataContext BDContext = new BlogDataDataContext())
     {
         try
         {
             Common_Friend friend = BDContext.Common_Friends.Select(f => f).Single(f => f.Frd_Id == id);
             BDContext.Common_Friends.DeleteOnSubmit(friend);
             BDContext.SubmitChanges();
             return true;
         }
         catch (InvalidOperationException)
         {
             return false;
         }
         catch (ChangeConflictException)
         {
             return false;
         }
     }
 }
Exemple #21
0
 /// <summary>
 /// 推荐减1
 /// </summary>
 /// <param name="ID"></param>
 /// <returns></returns>
 public static bool MinusRecommendCount(int ID)
 {
     BlogDataDataContext BD = new BlogDataDataContext();
     try
     {
         Weblog_Log up = BD.Weblog_Logs.Select(p => p).Single(p => p.Log_Id == ID);
         up.Log_RecommendCount = up.Log_RecommendCount - 1;
         BD.SubmitChanges();
     }
     catch
     { return false; }
     return true;
 }
Exemple #22
0
 /// <summary>
 /// 插入记录
 /// </summary>
 /// <param name="WG"></param>
 public static void Insert(Weblog_Group WG)
 {
     BlogDataDataContext BD = new BlogDataDataContext();
     BD.Weblog_Groups.InsertOnSubmit(WG);
     BD.SubmitChanges();
 }
Exemple #23
0
 public bool DeleteByTXZID(int txzID)
 {
     using (BlogDataDataContext BDContext = new BlogDataDataContext())
     {
         try
         {
             IQueryable<Common_Friend> friends = BDContext.Common_Friends.Select(f => f).Where(f => f.Frd_TxzUID == txzID);
             BDContext.Common_Friends.DeleteAllOnSubmit(friends);
             BDContext.SubmitChanges();
             return true;
         }
         catch (ChangeConflictException)
         {
             return false;
         }
     }
 }
Exemple #24
0
 /// <summary>
 /// 删除日志(根据log_ID)
 /// </summary>
 /// <param name="ID"></param>
 /// <returns></returns>
 public static bool DeleteByID(int ID)
 {
     BlogDataDataContext BD = new BlogDataDataContext();
     int? UserID = -1;
     try
     {
         Weblog_Log up = BD.Weblog_Logs.Select(p => p).Single(p => p.Log_Id == ID && p.Log_IsVisible == true);
      up.Log_IsVisible = false;
      UserID = up.Log_UserId;
      BD.SubmitChanges();
      
     }
     catch
     { return false; }
     BWeblog_User.MinusLogCount(UserID);
     return true;
 }
Exemple #25
0
 /// <summary>
 /// 删除日志(根据BlogUID)
 /// </summary>
 /// <param name="BlogUID"></param>
 /// <returns></returns>
 public static bool DeleteByBlogUID(int BlogUID)
 {
     BlogDataDataContext BD = new BlogDataDataContext();
     try
     {
         IEnumerable<Weblog_Log> up= BD.Weblog_Logs.Select(p=>p).Where(p=>p.Log_UserId==BlogUID);
         foreach (Weblog_Log u in up)
         {
             u.Log_IsVisible = false;
         }
         BD.SubmitChanges();
     }
     catch
     { return false; }
     return true;
 }
Exemple #26
0
 /// <summary>
 /// 插入UserCss记录
 /// </summary>
 /// <param name="WUC"></param>
 public static void Insert(Weblog_UserCss WUC)
 {
     BlogDataDataContext BD = new BlogDataDataContext();
     BD.Weblog_UserCsses.InsertOnSubmit(WUC);
     BD.SubmitChanges();
 }
Exemple #27
0
 /// <summary>
 /// 更新用户的日记数量统计
 /// </summary>
 /// <param name="UID"></param>
 public static void SetLogCountByUID(int UID)
 {
     BlogDataDataContext BD = new BlogDataDataContext();
     try
     {
         Weblog_User WU = null;
         var WUCount = BD.Weblog_Users.Select(p => p).Where(p => p.User_Id == UID);
         if (WUCount.Count()>0)
         {
             WU = WUCount.First();
             WU.User_LogCount = BWeblog_log.GetBLogCountByUID(UID);
             BD.SubmitChanges();
         }
         else
         {
             WU = null;
         }
     }
     catch (Exception)
     {
         
         throw;
     }
 }
Exemple #28
0
 /// <summary>
 /// 根据GroupId来获取模板的数量
 /// </summary>
 /// <param name="ThemeId"></param>
 /// <returns></returns>
 public static int GetCountByThemeId(int ThemeId)
 {
     BlogDataDataContext BD = new BlogDataDataContext();
     return BD.Weblog_CssFiles.Where(p => p.CssFile_ThemeId == ThemeId).Count();
     BD.SubmitChanges();
 }
Exemple #29
0
 /// <summary>
 /// myself:更改方法名
 /// </summary>
 /// <param name="wn"></param>
 public static void Insert(Weblog_Notice wn)
 {
     BlogDataDataContext BD = new BlogDataDataContext();
     BD.Weblog_Notices.InsertOnSubmit(wn);
     BD.SubmitChanges();
 }
Exemple #30
0
 public static void Insert(Weblog_CssFile WC)
 {
     BlogDataDataContext BD = new BlogDataDataContext();
     BD.Weblog_CssFiles.InsertOnSubmit(WC);
     BD.SubmitChanges();
 }