Esempio n. 1
0
        private void lstView_ItemSelected(object sender, ItemTappedEventArgs e)
        {
            try
            {
                SubCategory.Clear();

                //   string itm = e.SelectedItem.ToString();
                var dataItem = e.Item as CategorySubC1;

                //  dataItem.TextColor = Color.Red;

                foreach (CategorySubC1 item in CategoryItems)
                {
                    item.TextColor = dataItem.Equals(item) ? Color.Red : Color.Gray;
                    item.OnPropertyChanged();
                }


                catsubcat1      = new CategorySubCat();
                memberDatabase1 = new MemberDatabase();
                var catesubcat = memberDatabase1.GetCatSubCat();

                foreach (var category in catesubcat.Where(x => x.CategoryID == dataItem.CategoryID))
                {
                    SubCategory.Add(new CategorySubC1 {
                        SubCategoryName = category.SubCategoryName, SubCategoryID = category.SubCategoryID, SubTextColor = Color.FromHex(category.SubTextColor), img = ImageSource.FromFile(category.img)
                    });
                }
            }
            catch (Exception ex)
            {
                System.Diagnostics.Debug.WriteLine(ex);
            }
        }
Esempio n. 2
0
        public void BindCategoryfromSqlite()
        {
            catsubcat1      = new CategorySubCat();
            memberDatabase1 = new MemberDatabase();

            var catesubcat = memberDatabase1.GetCatSubCat();

            List <CategorySubCat> list = catesubcat
                                         .GroupBy(a => a.CategoryName)
                                         .Select(g => g.First())
                                         .ToList();

            foreach (CategorySubCat var1 in list)
            {
                CategoryItems.Add(new CategorySubC1 {
                    CategoryID = var1.CategoryID, CategoryName = var1.CategoryName
                });
            }
        }
Esempio n. 3
0
        public async void GetJSON()
        {
            try
            {
                catsubcat      = new CategorySubCat();
                memberDatabase = new MemberDatabase();

                memberDatabase.DeleteCatSubCat();
                //  var client = new System.Net.Http.HttpClient();
                // var response = await client.GetStringAsync("http://elixirct.in/ShopRConservicePublish/api/Login/GetCatSubCatDataSet");

                Uri                 geturi      = new Uri("http://elixirct.in/ShopRConservicePublish/api/Login/GetCatSubCatDataSet"); //replace your xml url
                HttpClient          client      = new HttpClient();
                HttpResponseMessage responseGet = await client.GetAsync(geturi);

                string response = await responseGet.Content.ReadAsStringAsync();//Getting response

                var result = Newtonsoft.Json.JsonConvert.DeserializeObject <string>(response);

                ObjPizzaList1 = new List <NewDataSet2>();
                XDocument doc = XDocument.Parse(result);
                foreach (var item in doc.Descendants("Table"))
                {
                    NewDataSet2 ObjPizzaItem1 = new NewDataSet2();
                    ObjPizzaItem1.CategoryID      = item.Element("CategoryID").Value.ToString();
                    ObjPizzaItem1.CategoryName    = item.Element("CategoryName").Value.ToString();
                    ObjPizzaItem1.SubCategoryID   = item.Element("SubCategoryID").Value.ToString();
                    ObjPizzaItem1.SubCategoryName = item.Element("SubCategoryName").Value.ToString();
                    System.Diagnostics.Debug.WriteLine(item);
                    ObjPizzaList1.Add(ObjPizzaItem1);


                    catsubcat.CategoryID      = ObjPizzaItem1.CategoryID;
                    catsubcat.CategoryName    = ObjPizzaItem1.CategoryName;
                    catsubcat.SubCategoryID   = ObjPizzaItem1.SubCategoryID;
                    catsubcat.SubCategoryName = ObjPizzaItem1.SubCategoryName;
                    catsubcat.SubTextColor    = "#000000";
                    memberDatabase.AddCategorySub(catsubcat);



                    //if (members.Any())
                    //{
                    //    memberDatabase.UpdateCategorySub(catsubcat);
                    //}
                    //else
                    //{
                    //    memberDatabase.AddCategorySub(catsubcat);
                    //}
                }

                //foreach (var category in ObjPizzaList.Select(x => x.CategoryName).Distinct())
                //{
                //    CategoryItems.Add(new CategorySubC { CategoryName = category });
                //}
            }
            catch (Exception ex)
            {
                System.Diagnostics.Debug.WriteLine(ex);
            }
        }
Esempio n. 4
0
        private void lstView2_ItemTapped(object sender, ItemTappedEventArgs e)
        {
            var dataItem      = e.Item as CategorySubC1;
            var CategoryID    = dataItem.CategoryID;
            var SubCategory   = dataItem.SubCategoryName;
            var SubCategoryID = dataItem.SubCategoryID;

            var clr = dataItem.SubTextColor.ToString();


            if (clr == "[Color: A=1, R=0, G=0, B=0, Hue=0, Saturation=0, Luminosity=0]")
            {
                subcategory           = subcategory + "`" + dataItem.SubCategoryName;
                dataItem.SubTextColor = Color.Red;
                dataItem.img          = ImageSource.FromFile("TickRed.png");
                dataItem.OnPropertyChanged();

                catsubcat1      = new CategorySubCat();
                memberDatabase1 = new MemberDatabase();
                catsubcat1      = new CategorySubCat();
                var members = memberDatabase1.GetCatSubCa(SubCategoryID);

                foreach (var a in members)
                {
                    catsubcat1.Id              = a.Id;
                    catsubcat1.CategoryName    = a.CategoryName;
                    catsubcat1.CategoryID      = a.CategoryID;
                    catsubcat1.SubCategoryName = a.SubCategoryName;
                    catsubcat1.SubCategoryID   = a.SubCategoryID;
                    catsubcat1.img             = "TickRed.png";
                    catsubcat1.SubTextColor    = "#FF0000";
                }

                if (members.Any())
                {
                    memberDatabase1.UpdateCategorySub(catsubcat1);
                }
                else
                {
                    memberDatabase1.AddCategorySub(catsubcat1);
                }
            }
            else if (clr == "[Color: A=1, R=1, G=0, B=0, Hue=1, Saturation=1, Luminosity=0.5]")
            {
                subcategory           = subcategory + "`" + dataItem.SubCategoryName;
                dataItem.SubTextColor = Color.Black;
                dataItem.img          = ImageSource.FromFile("");
                dataItem.OnPropertyChanged();

                catsubcat1      = new CategorySubCat();
                memberDatabase1 = new MemberDatabase();
                catsubcat1      = new CategorySubCat();
                var members = memberDatabase1.GetCatSubCa(SubCategoryID);

                foreach (var a in members)
                {
                    catsubcat1.Id              = a.Id;
                    catsubcat1.CategoryName    = a.CategoryName;
                    catsubcat1.CategoryID      = a.CategoryID;
                    catsubcat1.SubCategoryName = a.SubCategoryName;
                    catsubcat1.SubCategoryID   = a.SubCategoryID;
                    catsubcat1.img             = "";
                    catsubcat1.SubTextColor    = "#000000";
                }

                if (members.Any())
                {
                    memberDatabase1.UpdateCategorySub(catsubcat1);
                }
                else
                {
                    memberDatabase1.AddCategorySub(catsubcat1);
                }
            }
        }