/// <summary> /// 判断当前用户是否对制定朋友圈信息收藏 /// </summary> /// <param name="momentsBehaviorView"></param> /// <returns></returns> public bool IsCollect(MyBehaviorView momentsBehaviorView) { Contract.Requires <ArgumentNullException>(momentsBehaviorView != null, "参数momentsBehaviorView:不能为空"); Contract.Requires <ArgumentNullException>(!string.IsNullOrEmpty(momentsBehaviorView.PublishID), "参数momentsBehaviorView.PublishID:不能为空"); bool result = false; string message = string.Empty; MiicConditionCollections condition = momentsBehaviorView.visitor(this); MiicColumn collectID = new MiicColumn(Config.Attribute.GetSqlTableNameByClassName <CollectInfo>(), Config.Attribute.GetSqlColumnNameByPropertyName <CollectInfo, string>(o => o.ID)); try { int count = dbService.GetCount <CollectInfo>(collectID, condition, out message); if (count > 0) { result = true; } } catch (Exception ex) { Config.IlogicLogService.Write(new LogicLog() { AppName = Config.AppName, ClassName = ClassName, NamespaceName = NamespaceName, MethodName = MethodBase.GetCurrentMethod().Name, Message = ex.Message, Oper = Config.Oper }); } return(result); }
/// <summary> /// 查询当前登录人员对指定朋友圈信息的点踩信息 /// </summary> /// <param name="momentsBehaviorView">用户行为(点踩)视图</param> /// <returns>点踩信息</returns> public TreadInfo GetUserTreadInfo(MyBehaviorView momentsBehaviorView) { Contract.Requires <ArgumentNullException>(momentsBehaviorView != null, "参数momentsBehaviorView:不能为空"); Contract.Requires <ArgumentNullException>(!string.IsNullOrEmpty(momentsBehaviorView.PublishID), "参数momentsBehaviorView.PublishID:不能为空"); TreadInfo result = null; string message = string.Empty; MiicConditionCollections condition = momentsBehaviorView.visitor(this); MiicColumn threadAll = new MiicColumn(Config.Attribute.GetSqlTableNameByClassName <TreadInfo>()); MiicColumnCollections columns = new MiicColumnCollections(); columns.Add(threadAll); try { result = items.Find(o => o.PublishID == momentsBehaviorView.PublishID && o.TreaderID == momentsBehaviorView.UserID); if (result == null) { DataTable dt = dbService.GetInformations <TreadInfo>(columns, condition, out message); if (dt != null && dt.Rows.Count == 1) { result = new TreadInfo() { ID = dt.Rows[0][Config.Attribute.GetSqlColumnNameByPropertyName <TreadInfo, string>(o => o.ID)].ToString(), TreaderID = dt.Rows[0][Config.Attribute.GetSqlColumnNameByPropertyName <TreadInfo, string>(o => o.TreaderID)].ToString(), TreaderName = dt.Rows[0][Config.Attribute.GetSqlColumnNameByPropertyName <TreadInfo, string>(o => o.TreaderName)].ToString(), TreadTime = (DateTime?)dt.Rows[0][Config.Attribute.GetSqlColumnNameByPropertyName <TreadInfo, DateTime?>(o => o.TreadTime)], PublishID = dt.Rows[0][Config.Attribute.GetSqlColumnNameByPropertyName <TreadInfo, string>(o => o.PublishID)].ToString(), SortNo = (int?)dt.Rows[0][Config.Attribute.GetSqlColumnNameByPropertyName <TreadInfo, int?>(o => o.SortNo)] }; } else { result = null; } if (result != null) { InsertCache(result); } } else { string serializer = Config.Serializer.Serialize(result); result = Config.Serializer.Deserialize <TreadInfo>(serializer); } } catch (Exception ex) { Config.IlogicLogService.Write(new LogicLog() { AppName = Config.AppName, ClassName = ClassName, NamespaceName = NamespaceName, MethodName = MethodBase.GetCurrentMethod().Name, Message = ex.Message, Oper = Config.Oper }); } return(result); }