public void DeleteSingleTreasureAttention(C_SingleTreasure_Attention entity) { DB.GetDal <C_SingleTreasure_Attention>().Delete(entity); }
/// <summary> /// 关注 /// </summary> public void BDFXAttention(string currUserId, string bgzUserId) { try { #region 关注 DB.Begin(); var manager = new BDFXManager(); if (string.IsNullOrEmpty(currUserId)) { throw new Exception("关注人编号不能为空"); } else if (string.IsNullOrEmpty(bgzUserId)) { throw new Exception("被关注人编号不能为空"); } var singleTreasureAttention = manager.QuerySingleTreasureAttentionByUserId(bgzUserId, currUserId); if (singleTreasureAttention != null && !string.IsNullOrEmpty(singleTreasureAttention.ConcernedUserId)) { throw new Exception("您已经关注了他"); } if (currUserId == bgzUserId) { throw new Exception("不能关注自己"); } singleTreasureAttention = new C_SingleTreasure_Attention(); singleTreasureAttention.BeConcernedUserId = bgzUserId; singleTreasureAttention.ConcernedUserId = currUserId; singleTreasureAttention.CreateTime = DateTime.Now; manager.AddSingleTreasureAttention(singleTreasureAttention); //修改被关注者信息 var BGZSummary = manager.QuerySingleTreasureAttentionSummaryByUserId(bgzUserId); if (BGZSummary != null && !string.IsNullOrEmpty(BGZSummary.UserId)) { BGZSummary.BeConcernedUserCount += 1; BGZSummary.UpdateTime = DateTime.Now; manager.UpdateSingleTreasureAttentionSummary(BGZSummary); } else { BGZSummary = new C_SingleTreasure_AttentionSummary(); BGZSummary.BeConcernedUserCount = 1; BGZSummary.ConcernedUserCount = 0; BGZSummary.SingleTreasureCount = 0; BGZSummary.UpdateTime = DateTime.Now; BGZSummary.UserId = bgzUserId; manager.AddSingleTreasureAttentionSummary(BGZSummary); } //修改关注者信息 var GZSummary = manager.QuerySingleTreasureAttentionSummaryByUserId(currUserId); if (GZSummary != null && !string.IsNullOrEmpty(GZSummary.UserId)) { GZSummary.ConcernedUserCount += 1; GZSummary.UpdateTime = DateTime.Now; manager.UpdateSingleTreasureAttentionSummary(GZSummary); } else { GZSummary = new C_SingleTreasure_AttentionSummary(); GZSummary.BeConcernedUserCount = 0; GZSummary.ConcernedUserCount = 1; GZSummary.SingleTreasureCount = 0; GZSummary.UpdateTime = DateTime.Now; GZSummary.UserId = currUserId; manager.AddSingleTreasureAttentionSummary(GZSummary); } DB.Commit(); #endregion } catch (Exception EX) { DB.Rollback(); throw EX; } }
public void AddSingleTreasureAttention(C_SingleTreasure_Attention entity) { DB.GetDal <C_SingleTreasure_Attention>().Add(entity); }