Exemple #1
0
        private bool IsPasswordMatched(string appid, string username, string password)
        {
            bool isValidated = false;

            try
            {
                DefaultMongoDb logDB          = new DefaultMongoDb("Partners");
                var            msmqRecordColl = logDB.database.GetCollection("ApiUserInfo");

                List <IMongoQuery> qryList = new List <IMongoQuery>();

                qryList.Add(Query.EQ("appid", appid));
                qryList.Add(Query.NE("status", 0));

                IMongoQuery query = Query.And(qryList);

                var entity = msmqRecordColl.FindOne(query);
                if (entity != null)
                {
                    if (entity["username"].ToString() == username && entity["password"].ToString() == password)
                    {
                        isValidated = true;
                    }
                }
            }
            catch (Exception ex)
            {
            }

            return(isValidated);
        }
Exemple #2
0
        private bool IsValidatedAppKey(string appid, string appkey)
        {
            bool isValidated = false;

            try
            {
                DefaultMongoDb logDB          = new DefaultMongoDb("Partners");
                var            msmqRecordColl = logDB.database.GetCollection("ApiKeys");

                List <IMongoQuery> qryList = new List <IMongoQuery>();

                qryList.Add(Query.EQ("appid", appid));
                qryList.Add(Query.NE("status", 0));

                IMongoQuery query = Query.And(qryList);

                var entity = msmqRecordColl.FindOne(query);
                if (entity != null)
                {
                    if (entity["appkey"].ToString() == appkey)
                    {
                        isValidated = true;
                    }
                }
            }
            catch (Exception ex)
            {
            }

            return(isValidated);
        }