本文整理汇总了C#中Relation.GetCollectionName方法的典型用法代码示例。如果您正苦于以下问题:C# Relation.GetCollectionName方法的具体用法?C# Relation.GetCollectionName怎么用?C# Relation.GetCollectionName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Relation
的用法示例。
在下文中一共展示了Relation.GetCollectionName方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: UpdateLastMsger
public static CBB.ExceptionHelper.OperationResult UpdateLastMsger(Relation.LastMsger obj, out bool isFristConnect)
{
try
{
MongoDatabase md = MongoDBHelper.MongoDB;
MongoCollection<Relation.LastMsger> mc = md.GetCollection<Relation.LastMsger>(obj.GetCollectionName());
IMongoQuery qc =
Query.Or(
Query.And(Query.EQ("FromMember", obj.FromMember), Query.EQ("ToMember", obj.ToMember)),
Query.And(Query.EQ("FromMember", obj.ToMember), Query.EQ("ToMember", obj.FromMember))
);
Relation.LastMsger oObj = mc.FindOne(qc);
isFristConnect = false;
//如果第一次联系,则未读信息为1
if (oObj == null)
{
obj.UnReads = new List<UnRead>();
UnRead u = new UnRead();
u.SenderMid = obj.FromMember;
//如果没有屏蔽,增加未读数量
if (obj.Type != Activity.ActivityType.DisabledTalk & obj.Type != Activity.ActivityType.DisabledMsg)
u.UnReadCount = 1;
//如果是主动发起聊天
if (obj.Type == Activity.ActivityType.Talk)
{
//标记曾经有过主动聊天
obj.HasTalk = true;
MemberManager.MemberManager.ModifyTodayOutCallsCount(obj.FromMember, MemberManager.StatusModifyType.Add);
MemberManager.MemberManager.ModifyTodayInCallsCount(obj.ToMember, MemberManager.StatusModifyType.Add);
isFristConnect = true;
}
obj.UnReads.Add(u);
}
else
{
//赋值Key
obj._id = oObj._id;
obj.UnReads = oObj.UnReads;
obj.HasTalk = oObj.HasTalk;
bool flag = false;
foreach (UnRead u in obj.UnReads)
{
if (u.SenderMid == obj.FromMember)
{
//如果没有屏蔽,增加未读数量
if (obj.Type != Activity.ActivityType.DisabledTalk & obj.Type != Activity.ActivityType.DisabledMsg)
u.UnReadCount++;
flag = true;
}
}
if (!flag)
{
UnRead u = new UnRead();
u.SenderMid = obj.FromMember;
//如果没有屏蔽,增加未读数量
if (obj.Type != Activity.ActivityType.DisabledTalk & obj.Type != Activity.ActivityType.DisabledMsg)
u.UnReadCount = 1;
obj.UnReads.Add(u);
}
//如果以前没有用户主动聊过
if (obj.HasTalk == false)
{
//如果是主动发起聊天
if (obj.Type == Activity.ActivityType.Talk)
{
//标记曾经有过主动聊天
obj.HasTalk = true;
MemberManager.MemberManager.ModifyTodayOutCallsCount(obj.FromMember, MemberManager.StatusModifyType.Add);
MemberManager.MemberManager.ModifyTodayInCallsCount(obj.ToMember, MemberManager.StatusModifyType.Add);
isFristConnect = true;
}
}
}
mc.Save(obj);
return new CBB.ExceptionHelper.OperationResult(true);
}
catch (System.Exception err)
{
throw new CBB.ExceptionHelper.OperationException(
CBB.ExceptionHelper.ErrType.SystemErr,
CBB.ExceptionHelper.ErrNo.DBOperationError,
err);
}
}