Ejemplo n.º 1
0
        public static List <MenuResto> GetListByServerResponse(string response)
        {
            if (response == "")
            {
                return(null);
            }
            List <MenuResto> members = new List <MenuResto>();

            string[] lines = response.Split(new string[] { "<BR>" }, StringSplitOptions.None);
            foreach (string line in lines)
            {
                if (line.Trim() == "")
                {
                    continue;
                }
                string[]  datas = line.Split(';');
                MenuResto m     = new MenuResto();
                m.menu_id        = Convert.ToInt32(datas[0].Trim());
                m.menu_code      = datas[1];
                m.menu_name      = datas[2];
                m.menu_note      = datas[3];
                m.resto_id       = Convert.ToInt32(datas[4].Trim());
                m.menu_foodtype  = datas[5];
                m.menu_price     = Convert.ToDecimal(datas[6].Trim());
                m.menu_url_image = datas[7];
                members.Add(m);
            }
            return(members);
        }
Ejemplo n.º 2
0
        public override View GetView(int position, View convertView, ViewGroup parent)
        {
            if (position < 0)
            {
                return(null);
            }
            View view = (convertView ?? m_Context.LayoutInflater.Inflate(Resource.Layout.item_review_order, parent, false));

            if (view == null)
            {
                return(null);
            }
            var       wrapper = view.Tag as ItemReviewMenuAdapterWrapper;
            MenuResto resto   = this.m_restos.ElementAt(position);

            if (wrapper == null)
            {
                wrapper = new ItemReviewMenuAdapterWrapper
                {
                    TVNama    = view.FindViewById <TextView>(Resource.Id.textViewNama),
                    TVHarga   = view.FindViewById <TextView>(Resource.Id.textViewHarga),
                    TVJumlah  = view.FindViewById <TextView>(Resource.Id.textViewJumlah),
                    IVGambar  = view.FindViewById <ImageView>(Resource.Id.imageViewURL),
                    BtnTambah = view.FindViewById <Button>(Resource.Id.buttonTambah),
                    BtnKurang = view.FindViewById <Button>(Resource.Id.buttonKurang),
                    BtnHapus  = view.FindViewById <Button>(Resource.Id.buttonHapus)
                };
                view.Tag              = wrapper;
                wrapper.TVNama.Text   = resto.menu_name;
                wrapper.TVHarga.Text  = "Rp. " + resto.menu_price.ToString();
                wrapper.TVJumlah.Text = resto.menu_jumlah_pesan.ToString();
                wrapper.Jumlah        = resto.menu_jumlah_pesan;
                ImageLoader.DisplayImage(resto.menu_url_image, wrapper.IVGambar, -1);

                wrapper.BtnTambah.Click += BtnTambah_Click;
                wrapper.BtnKurang.Click += BtnKurang_Click;
                wrapper.BtnHapus.Click  += BtnHapus_Click;

                wrapper.BtnTambah.Tag = wrapper;
                wrapper.BtnKurang.Tag = wrapper;
                wrapper.BtnHapus.Tag  = wrapper;
                wrapper.IVGambar.Tag  = wrapper;
                wrapper.TVNama.Tag    = wrapper;
                wrapper.TVHarga.Tag   = wrapper;

                wrapper.MenuResto       = resto;
                wrapper.IVGambar.Click += IVGambar_Click;
                wrapper.TVNama.Click   += IVGambar_Click;
                wrapper.TVHarga.Click  += IVGambar_Click;

                if (m_viewOnly)
                {
                    wrapper.BtnTambah.Visibility = ViewStates.Gone;
                    wrapper.BtnKurang.Visibility = ViewStates.Gone;
                    wrapper.BtnHapus.Visibility  = ViewStates.Gone;
                }
            }

            return(view);
        }