Esempio n. 1
0
 public int Remove(BaseItem item)
 {
     if (StringChecker.IsNotEmptyObjectId(item.ID))
     {
         var db    = DataStorage.GetInstance(DBType.MongoDB);
         var query = MongoDBFilterCreator.SearchByObjectId(item.ID);
         db.Save3(item._DbName, item._CollectionName, "{StatusCode:" + CONST.APP.Status.除 + ",Status:'" + CONST.APP.Status.GetString(CONST.APP.Status.除) + "'}", query, false);
         ClientBehaviorItem.Save(item, ClientBehaviorItem.BehaviorType.移除, SESSION.Current);
     }
     return(0);
 }
Esempio n. 2
0
 public int Delete(BaseItem item)
 {
     if (StringChecker.IsNotEmptyObjectId(item.ID))
     {
         var db    = DataStorage.GetInstance(DBType.MongoDB);
         var query = MongoDBFilterCreator.SearchByObjectId(item.ID);
         db.Remove(item._DbName, item._CollectionName, query);
         ClientBehaviorItem.Save(item, ClientBehaviorItem.BehaviorType.除, SESSION.Current);
     }
     return(0);
 }
        public static void Save(BaseItem item, int behaviorType, SESSION session)
        {
            var task = new TaskFactory().StartNew(() => {
                try
                {
                    var inst = new ClientBehaviorItem();

                    inst.UserID         = Convertor.StringToObjectID(session.UserID);
                    inst.UserName       = session.UserName;
                    inst.CreateTime     = DateTime.Now;
                    inst.BehaviorCode   = behaviorType;
                    inst.Behavior       = BehaviorType.GetString(behaviorType);
                    inst.DbName         = item._DbName;
                    inst.CollectionName = item._CollectionName;
                    inst.DbID           = item._OID;
                    var db = DataStorage.GetInstance(DBType.MongoDB);

                    db.Save3(item._DbName, "ClientBehavior", inst);
                }
                catch (Exception e)
                {
                }
            });
        }