Exemple #1
0
        private void openHomeActivity()
        {
            Log.I(TAG, "openHomeActivity", "", "");

            Intent homeIntent = new Intent(mContext, typeof(HomeActivity));

            homeIntent.PutExtra("token", tokenObj);
            homeIntent.PutExtra("userID", userID);
            homeIntent.PutExtra("custID", custID);
            StartActivity(homeIntent);
        }
Exemple #2
0
 public void DbOperSuccess(int p0, Java.Lang.Object obj)
 {
     if (obj != null && obj.GetType().ToString() != "Java.Lang.Long" && obj.GetType().ToString() != "Java.Lang.Integer")
     {
         Java.Util.ArrayList lstJsonObj = (Java.Util.ArrayList)obj;
         for (int i = 0; i < lstJsonObj.Size(); i++)
         {
             JSONObject castedJObj = (JSONObject)lstJsonObj.Get(i);
             string     str        = castedJObj.GetString("username");
         }
     }
     Log.I("DB Oper", "Success " + p0);
 }
Exemple #3
0
 public void DbOperFailure(int p0)
 {
     Log.I("DB Oper", "Failure " + p0);
 }
Exemple #4
0
 public void OnError(Entity error)
 {
     Log.I(outerInstance.TAG, "initializeSDK - onError", "", "");
     outerInstance.openErrorActivity(error);
 }
Exemple #5
0
            public void OnSuccess(Java.Lang.Object responseObject)
            {
                Log.I(outerInstance.TAG, "initializeSDK - onSuccess", "", "");

//				// Retrieving data from existing table
//				IDictionary<string,SyncUtils.CLASSTYPE> colums = new Dictionary<string,SyncUtils.CLASSTYPE>();
//				colums.Add ("username", SyncUtils.CLASSTYPE.String);
//				colums.Add ("password",SyncUtils.CLASSTYPE.String);
//				colums.Add ("login_attempt",SyncUtils.CLASSTYPE.Int);
//
//				GenericDBManager gb = new GenericDBManager (outerInstance, "UserStorageDB", colums,new TjHandler(outerInstance));
//				gb.CreateTable ();
//				string query = "login_attempt=?";
//				string[] values = new string[] {
//					"1"
//				};
//
//				ContentValues Cv = new ContentValues ();
//				Cv.Put ("username", "brahmam");
//				Cv.Put ("password", "brahmam");
//				Cv.Put ("login_attempt", 1);
//
//				ContentValues Cobj = new ContentValues ();
//				Cobj.Put ("username", "record");
//				Cobj.Put ("password", "record");
//				Cobj.Put ("login_attempt", 2);
//				long count;
//
//
//				gb.InsertValues (Cv);
//
//
//
//				ContentValues Cvobj = new ContentValues ();
//				Cvobj.Put ("username", "test");
//				Cvobj.Put ("password", "test");
//				Cvobj.Put ("login_attempt", 1);
//
//				query = "login_attempt=?";
//				// string[] values = new string[] {
//				// "1"
//				// };
//				gb.UpdateValues(Cvobj,query,values);
//
//				//
//				gb.Select (null, null);
//				gb.DeleteValues (query, values);

                IDictionary <string, Java.Lang.Class> colums = new Dictionary <string, Java.Lang.Class>();

                colums.Add("username", Java.Lang.Class.FromType(typeof(Java.Lang.String)));
                colums.Add("password", Java.Lang.Class.FromType(typeof(Java.Lang.String)));
                colums.Add("login_attempt", Java.Lang.Class.FromType(typeof(Java.Lang.Integer)));

                GenericDBManager gb = new GenericDBManager(outerInstance, "UserStorageDB", colums);

                gb.CreateTable();
                string query = "login_attempt=?";

                string[] values = new string[] {
                    "1"
                };
                string strUserName;
                //Select is working in both following cases
                //select with query,values
//				IList<JSONObject> jsonObj = gb.Select(query, values);
//				string strUserName;
//				foreach (JSONObject obj in jsonObj) {
//					strUserName = obj.GetString ("username");
//				}
//				//Select with null,null
//				jsonObj = gb.Select (null, null);
//				foreach (JSONObject jsnObj in jsonObj) {
//					strUserName = jsnObj.GetString ("username");
//				}
                IList <JSONObject> jsonObj = null;
                ContentValues      Cv      = new ContentValues();

                Cv.Put("username", "brahmam");
                Cv.Put("password", "brahmam");
                Cv.Put("login_attempt", 1);

                ContentValues Cobj = new ContentValues();

                Cobj.Put("username", "record");
                Cobj.Put("password", "record");
                Cobj.Put("login_attempt", 2);
                long count;


                count = gb.InsertValues(Cv);

                count = gb.InsertValues(Cobj);

                jsonObj = gb.Select(query, values);
                foreach (JSONObject obj in jsonObj)
                {
                    strUserName = obj.GetString("username");
                }

                ContentValues Cvobj = new ContentValues();

                Cvobj.Put("username", "test");
                Cvobj.Put("password", "test");
                Cvobj.Put("login_attempt", 1);
                count = gb.UpdateValues(Cvobj, query, values);

                jsonObj = gb.Select(null, null);

                count = gb.DeleteValues(query, values);

                jsonObj = gb.Select(null, null);
                //count = 2;

                string responseStr = responseObject.ToString();

                Toast.MakeText(outerInstance, responseStr, ToastLength.Long).Show();

                outerInstance.startLoginProcess();
            }