Esempio n. 1
0
        public static void DownloadAllImages()
        {
            Task.Factory.StartNew(() =>
            {
                ServiceWrapper svc      = new ServiceWrapper();
                ItemListResponse myData = svc.GetItemLists(1, CurrentUser.RetreiveUserId()).Result;
                foreach (var wine in myData.ItemList)
                {
                    GetImageBitmapFromWineId(wine.Barcode);
                }

                myData = svc.GetItemLists(2, CurrentUser.RetreiveUserId()).Result;

                foreach (var wine in myData.ItemList)
                {
                    GetImageBitmapFromWineId(wine.Barcode);
                }
            });
        }
        public ItemListResponse GetItemList(int objectId)
        {
            ItemListResponse resp     = new ItemListResponse();
            IList <Item>     itemList = new List <Item>();

            itemList.Add(new Item {
                ItemId = 1, ItemName = "xxxxx1", Description = "xxxxDesc1", Price = 4.13
            });
            itemList.Add(new Item {
                ItemId = 2, ItemName = "xxxxx2", Description = "xxxxDesc2", Price = 4.23
            });
            itemList.Add(new Item {
                ItemId = 3, ItemName = "xxxxx3", Description = "xxxxDesc3", Price = 4.39
            });
            itemList.Add(new Item {
                ItemId = 4, ItemName = "xxxxx4", Description = "xxxxDesc4", Price = 4.49
            });
            resp.ItemList = itemList;
            return(resp);
        }
Esempio n. 3
0
 public HttpResponseMessage GetByDate(int accountId)
 {
     try
     {
         if (ModelState.IsValid)
         {
             UserService svc = new UserService();
             ItemListResponse <UserMeal> response = new ItemListResponse <UserMeal>();
             response.Items = svc.SelectByDate(accountId);
             return(Request.CreateResponse(HttpStatusCode.OK, response));
         }
         else
         {
             return(Request.CreateErrorResponse(HttpStatusCode.BadRequest, ModelState));
         }
     }
     catch (Exception ex)
     {
         return(Request.CreateResponse(HttpStatusCode.BadRequest, ex.Message));
     }
 }
Esempio n. 4
0
        public async Task <ItemListResponse> GetItemFavsUID(int userId)
        {
            sw.Start();
            ItemListResponse output = null;

            try
            {
                var uri      = new Uri(ServiceURL + "GetItemFavUID/" + userId);
                var response = await client.GetStringAsync(uri).ConfigureAwait(false);

                output = JsonConvert.DeserializeObject <ItemListResponse>(response);
            }
            catch (Exception ex)
            {
                LoggingClass.LogError(ex.ToString(), screen, ex.StackTrace);
            }
            sw.Stop();
            LoggingClass.LogServiceInfo("Service " + sw.Elapsed.TotalSeconds, "GetItemFavUID");
            //Console.WriteLine("GetItemFavUID service Time Elapsed"+sw.Elapsed.TotalSeconds);
            return(output);
        }
Esempio n. 5
0
        public async Task <ItemListResponse> GetItemList(int storeId, int userId)
        {
            ItemListResponse output = null;

            sw.Start();
            LoggingClass.LogServiceInfo("Service called", "GetItemList");
            try
            {
                var uri      = new Uri(ServiceURL + "GetItemLists/" + storeId + "/user/" + userId);
                var response = await client.GetStringAsync(uri).ConfigureAwait(false);

                output = JsonConvert.DeserializeObject <ItemListResponse>(response);
                LoggingClass.LogServiceInfo("Service Response", "GetItemList");
            }
            catch (Exception exe)
            {
                LoggingClass.LogError(exe.Message, screenid, exe.StackTrace.ToString());
            }
            sw.Stop();
            LoggingClass.LogTime("The total time to  start and end the service getItemList", "The timer ran for " + sw.Elapsed.TotalSeconds);
            return(output);
        }
        public override void ViewDidLoad()
        {
            //AboutController1.ViewDidLoad(base);

            ServiceWrapper svc = new ServiceWrapper();

            if (FaviouriteView)
            {
                myData = svc.GetItemFavsUID(CurrentUser.RetreiveUserId()).Result;
            }
            else
            {
                myData = svc.GetItemLists(storeId, CurrentUser.RetreiveUserId()).Result;
            }

            //View.BackgroundColor = UIColor.White;
            this.View.BackgroundColor = new UIColor(256, 256, 256, 0.8f);
            //this.View
            //this.CollectionView.BackgroundColor = UIColor.White;
            //this.CollectionView.InsertSubview(new UIImageView(UIImage.FromFile("placeholder.jpeg")), 0);
            //CollectionView.BackgroundColor = UIColor.FromPatternImage(UIImage.FromFile("eno.jpg"));
            CollectionView.RegisterClassForCell(typeof(BottleCell), "BottleCell");
        }
Esempio n. 7
0
        protected override void OnCreate(Bundle bundle)
        {
            Stopwatch st = new Stopwatch();

            st.Start();
            base.OnCreate(bundle);
            try
            {
                //SetContentView(Resource.Layout.MyFavoriteGridView);
                ActionBar.SetHomeButtonEnabled(true);
                ActionBar.SetDisplayHomeAsUpEnabled(true);
                if (StoreName == "")
                {
                    StoreName = Intent.GetStringExtra("MyData");
                }
                this.Title = StoreName;
                int              userId = Convert.ToInt32(CurrentUser.getUserId());
                ServiceWrapper   sw     = new ServiceWrapper();
                ItemListResponse output = new ItemListResponse();
                output = sw.GetItemFavsUID(userId).Result;
                List <Item> myArr;
                myArr = output.ItemList.ToList();
                if (output.ItemList.Count == 0)
                {
                    SetContentView(Resource.Layout.FavEmp);
                    TextView  txtName = FindViewById <TextView>(Resource.Id.textView1);
                    ImageView Imag    = FindViewById <ImageView>(Resource.Id.imageView1);
                    //AlertDialog.Builder aler = new AlertDialog.Builder(this, Resource.Style.MyDialogTheme);
                    ////aler.SetTitle("No Reviews Avalilable");
                    //aler.SetMessage("Sorry you didn't tell us your Favourite wines");
                    //LoggingClass.LogInfo("Sorry you didn't tell us your Favourite wines", screenid);
                    //aler.SetNegativeButton("Ok", delegate { Finish(); });
                    //LoggingClass.LogInfo("Clicked on Secaucus", screenid);
                    //Dialog dialog = aler.Create();
                    //dialog.Show();
                }
                else
                {
                    SetContentView(Resource.Layout.MyFavoriteGridView);
                    var gridview = FindViewById <GridView>(Resource.Id.gridviewfav);
                    MyFavoriteAdapter adapter = new MyFavoriteAdapter(this, myArr);
                    LoggingClass.LogInfo("Entered into Favourite Adapter", screenid);
                    gridview.SetNumColumns(2);
                    gridview.Adapter    = adapter;
                    gridview.ItemClick += delegate(object sender, AdapterView.ItemClickEventArgs args)
                    {
                        try
                        {
                            string WineBarcode = myArr[args.Position].Barcode;
                            int    storeid     = 1;// myArr[args.Position].PlantFinal;
                            //ProgressIndicator.Show(this);
                            AndHUD.Shared.Show(this, "Loading...", Convert.ToInt32(MaskType.Clear));
                            var intent = new Intent(this, typeof(DetailViewActivity));
                            LoggingClass.LogInfo("Clicked on " + myArr[args.Position].Barcode + " to enter into wine details", screenid);
                            intent.PutExtra("WineBarcode", WineBarcode);
                            intent.PutExtra("storeid", storeid);
                            StartActivity(intent);
                        }
                        catch (Exception)
                        {
                            string WineBarcode = myArr[args.Position].Barcode;
                            int    storeid     = myArr[args.Position].PlantFinal;
                            ProgressIndicator.Show(this);
                            AndHUD.Shared.Dismiss();
                            var intent = new Intent(this, typeof(DetailViewActivity));
                            LoggingClass.LogInfo("Clicked on " + myArr[args.Position].Barcode + " to enter into wine details", screenid);
                            intent.PutExtra("WineBarcode", WineBarcode);
                            intent.PutExtra("storeid", storeid);
                            StartActivity(intent);
                        }
                    };

                    LoggingClass.LogInfo("Entered into My Favorites Activity", screenid);
                }
                st.Stop();
                LoggingClass.LogTime("Favouriteactivity", st.Elapsed.TotalSeconds.ToString());
                ProgressIndicator.Hide();
            }

            catch (Exception exe)
            {
                LoggingClass.LogError(exe.Message, screenid, exe.StackTrace.ToString());
                ProgressIndicator.Hide();
                AlertDialog.Builder aler = new AlertDialog.Builder(this);
                aler.SetTitle("Sorry");
                aler.SetMessage("We're under maintainence");
                aler.SetNegativeButton("Ok", delegate { });
                Dialog dialog = aler.Create();
                dialog.Show();
            }
        }
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);
            try
            {
                SetContentView(Resource.Layout.MyFavoriteGridView);
                ActionBar.SetHomeButtonEnabled(true);
                ActionBar.SetDisplayHomeAsUpEnabled(true);
                if (StoreName == "")
                {
                    StoreName = Intent.GetStringExtra("MyData");
                }
                this.Title = StoreName;

                int StoreId = 0;
                if (StoreName == "My Favorites")
                {
                    StoreId = 1;
                }
                else if (StoreName == "Point Pleasent Store")
                {
                    StoreId = 2;
                }
                else if (StoreName == "Wall Store")
                {
                    StoreId = 3;
                }
                int              userId = Convert.ToInt32(CurrentUser.getUserId());
                ServiceWrapper   sw     = new ServiceWrapper();
                ItemListResponse output = new ItemListResponse();

                output = sw.GetItemFavsUID(userId).Result;


                List <Item> myArr;
                myArr = output.ItemList.ToList();
                var gridview = FindViewById <GridView>(Resource.Id.gridviewfav);
                MyFavoriteAdapter adapter = new MyFavoriteAdapter(this, myArr);
                gridview.SetNumColumns(2);
                gridview.Adapter = adapter;


                gridview.ItemClick += delegate(object sender, AdapterView.ItemClickEventArgs args)
                {
                    int WineID = myArr[args.Position].WineId;
                    var intent = new Intent(this, typeof(detailViewActivity));
                    intent.PutExtra("WineID", WineID);
                    StartActivity(intent);
                };
                ProgressIndicator.Hide();
            }

            catch (Exception exe)
            {
                AlertDialog.Builder aler = new AlertDialog.Builder(this);
                aler.SetTitle("Sorry");
                aler.SetMessage("We're under maintainence");
                aler.SetNegativeButton("Ok", delegate { });
                Dialog dialog = aler.Create();
                dialog.Show();
            }
        }
Esempio n. 9
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="bundle"></param>
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);
            try
            {
                if (StoreName == "")
                {
                    StoreName = Intent.GetStringExtra("MyData");
                }
                this.Title = StoreName;
                this.ActionBar.SetHomeButtonEnabled(true);
                this.ActionBar.SetDisplayShowTitleEnabled(true);//  ToolbartItems.Add(new ToolbarItem { Text = "BTN 1", Icon = "myicon.png" });

                int StoreId = 0;
                if (StoreName == "Wall Store")
                {
                    StoreId = 1;
                }
                else if (StoreName == "Point Pleasant Store")
                {
                    StoreId = 2;
                }
                else
                {
                    StoreId = 3;
                }

                int              userId = Convert.ToInt32(CurrentUser.getUserId());
                ServiceWrapper   sw     = new ServiceWrapper();
                ItemListResponse output = new ItemListResponse();

                output = sw.GetItemList(StoreId, userId).Result;

                SetContentView(Resource.Layout.Main);
                ActionBar.SetHomeButtonEnabled(true);
                ActionBar.SetDisplayHomeAsUpEnabled(true);
                //var listview = FindViewById<ListView>(Resource.Id.gridview);
                List <Item> myArr;
                //myArr = SampleData();
                myArr = output.ItemList.ToList();

                var gridview = FindViewById <GridView>(Resource.Id.gridview);
                //myArr = SampleData();

                GridViewAdapter adapter = new GridViewAdapter(this, myArr);
                gridview.SetNumColumns(2);
                gridview.Adapter = adapter;

                gridview.ItemClick += delegate(object sender, AdapterView.ItemClickEventArgs args)
                {
                    WineID = myArr[args.Position].WineId;
                    //detailViewActivity dva = new detailViewActivity();
                    //dva.downloadAsync(sender, args, WineID);
                    ProgressIndicator.Show(this);
                    var intent = new Intent(this, typeof(detailViewActivity));
                    intent.PutExtra("WineID", WineID);
                    StartActivity(intent);
                    //    ProgressDialog progressdialog = ProgressDialog.Show(this, "Please Wait", "We are loading it");
                    //    new Thread(new ThreadStart(delegate
                    //{
                    //        RunOnUiThread(() => progressdialog.Show());
                    //    Thread.Sleep(10000);


                    //    RunOnUiThread(() => progressdialog.Dismiss());
                    //        //RunOnUiThread(() => progressDialog.Wait(1000));
                    //        //RunOnUiThread(() => progressDialog.Hide());
                    //    })).Start();
                };
                ProgressIndicator.Hide();
            }
            catch (Exception ex)
            {
                AlertDialog.Builder aler = new AlertDialog.Builder(this);
                aler.SetTitle("Sorry");
                aler.SetMessage("We're under maintainence");
                aler.SetNegativeButton("Ok", delegate { });
                Dialog dialog = aler.Create();
                dialog.Show();
            }
        }