public static SESSION Login(string loginID, string password) { var inst = new SESSION(); var query = "{'Email':'" + loginID + "'}"; var res = EntityManager.GetInstance().Find <BaseItem>("WangJun", "Staff", query, "{}", "{}"); if (1 == res.Count) { inst.UserID = res[0].ID; inst.UserName = res[0].Name; inst.CompanyID = res[0].CompanyID; inst.CompanyName = res[0].CompanyName; inst.IsSuperAdmin = (16 == res[0].Level) ? true : false; } return(inst); }
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) { } }); }