public CustomerSelectDialog(Activity context, int theme) : base(context, theme) { activity = context; //dialogCustomers.Window.SetLayout(Android.Widget.RelativeLayout.LayoutParams.FillParent, Android.Widget.RelativeLayout.LayoutParams.FillParent); // SetTitle(context.GetString(Resource.String.miCustomers)); SetContentView(Resource.Layout.dialog_customer_search); actionBar = (RetailMobile.Fragments.ItemActionBar)((Android.Support.V4.App.FragmentActivity)activity).SupportFragmentManager.FindFragmentById(Resource.Id.ActionBarDialogCust); actionBar.ActionButtonClicked += new RetailMobile.Fragments.ItemActionBar.ActionButtonCLickedDelegate(ActionBarButtonClicked); actionBar.ClearButtons(); actionBar.AddButtonRight(OK_BUTTON, activity.GetString(Resource.String.btnOK), Resource.Drawable.tick_16); actionBar.AddButtonLeft(CANCEL_BUTTON, activity.GetString(Resource.String.btnClose), Resource.Drawable.close_icon64); actionBar.SetTitle(activity.GetString(Resource.String.miCustomers)); lvCustomers = FindViewById <ListView>(Resource.Id.lvCustomers); tbCustCode = FindViewById <EditText>(Resource.Id.tbCustCode); tbCustName = FindViewById <EditText>(Resource.Id.tbCustName); tbCustCode.AfterTextChanged += new EventHandler <Android.Text.AfterTextChangedEventArgs>(tbSearch_AfterTextChanged); tbCustName.AfterTextChanged += new EventHandler <Android.Text.AfterTextChangedEventArgs>(tbSearch_AfterTextChanged); lvCustomers.ChoiceMode = ChoiceMode.Single; lvCustomers.ItemClick += new EventHandler <AdapterView.ItemClickEventArgs>(lvCustomers_ItemClick); Library.CustomerInfoList custInfoList = Library.CustomerInfoList.GetCustomerInfoList(activity, new Library.CustomerInfoList.Criteria() { CustCode = tbCustCode.Text, CustName = tbCustName.Text }); lvCustomers.Adapter = new CustomersAdapter(activity, custInfoList); GC.Collect(); }
public CustomersAdapter(Activity context, Library.CustomerInfoList _list) : base(context, Resource.Layout.CustomerInfoRow, _list) { this.context = context; customerInfoList = _list; }
public CustomersListAdapter(Activity context, int rowResourceID, Library.CustomerInfoList _list) : base(context, rowResourceID, _list) { this.context = context; customerInfoList = _list; }
void tbSearch_AfterTextChanged(object sender, Android.Text.AfterTextChangedEventArgs e) { Library.CustomerInfoList custInfoList = Library.CustomerInfoList.GetCustomerInfoList(activity, new Library.CustomerInfoList.Criteria() { CustCode = tbCustCode.Text, CustName = tbCustName.Text }); lvCustomers.Adapter = new CustomersAdapter(activity, custInfoList); }
public static CustomerInfoList GetCustomerInfoList(Context ctx, Criteria crit) { CustomerInfoList customers = new CustomerInfoList(); using (IConnection conn = Sync.GetConnection(ctx)) { string query = @" SELECT TOP 100 id, cst_cod, cst_desc FROM rcustomer WHERE 1=1 "; if (crit.CustCode != "") { query += " AND cst_cod like \'" + crit.CustCode + "%\'"; } if (crit.CustName != "") { query += " AND cst_desc like \'" + crit.CustName + "%\'"; } query += " ORDER BY cst_desc "; Log.Debug("GetCustomerInfoList", query); IPreparedStatement ps = conn.PrepareStatement(query); IResultSet result = ps.ExecuteQuery(); while (result.Next()) { CustomerInfo customer = new CustomerInfo(); customer.CustID = result.GetInt("id"); customer.Code = result.GetString("cst_cod"); customer.Name = result.GetString("cst_desc"); customers.Add(customer); } result.Close(); ps.Close(); conn.Release(); } return(customers); }
private void LoadData() { _customerInfoList = Library.CustomerInfoList.GetCustomerInfoList(this, new Library.CustomerInfoList.Criteria()); CustomersListAdapter adapter = new CustomersListAdapter(this, Resource.Layout.CustomerInfoRow, _customerInfoList); ListAdapter = adapter; /*DAL.CustomerInfoList.GetCustomerInfoList(new CriteriaJ(this), (o, e) => * { * if (e.Error != null) * { * Android.Util.Log.Error("GetCustomerInfoList", string.Format("An error has occurred: {0}", e.Error.Message)); * } * else * { * _customerInfoList = e.Object; * CustomersListAdapter adapter = new CustomersListAdapter(this, Resource.Layout.CustomerInfoRow, _customerInfoList); * ListAdapter = adapter; * } * });*/ }
public static IListAdapter LoadCustomerData(Activity context) { CustomersListAdapter adapter = null; Library.CustomerInfoList customerInfoList = Library.CustomerInfoList.GetCustomerInfoList(context, new Library.CustomerInfoList.Criteria()); adapter = new CustomersListAdapter(context, Resource.Layout.CustomerInfoRow, customerInfoList); /*Library.CustomerInfoList.GetCustomerInfoList(new CriteriaJ(context), (o, e) => * { * if (e.Error != null) * { * Android.Util.Log.Error("GetCustomerInfoList", string.Format("An error has occurred: {0}", e.Error.Message)); * } * else * { * DAL.CustomerInfoList customerInfoList = e.Object; * adapter = new CustomersListAdapter(context, Resource.Layout.CustomerInfoRow, customerInfoList); * } * });*/ return(adapter); }
public override void OnActivityCreated(Bundle savedInstanceState) { base.OnActivityCreated(savedInstanceState); if (savedInstanceState != null) { _currentObjId = savedInstanceState.GetInt("idLvl2", -1); } ListView.ChoiceMode = ChoiceMode.Single; switch (ParentObjId) { case (int)MainMenu.MenuItems.Items: actionBar.SetTitle(this.Activity.GetString(Resource.String.miItems)); Library.ItemInfoList itemInfoList = new RetailMobile.Library.ItemInfoList(); //Library.ItemInfoList itemInfoList = Library.ItemInfoList.GetItemInfoList(this.Activity); _list = itemInfoList; ListAdapter = new ItemsInfoAdapter(Activity, itemInfoList); ((IScrollLoadble)ListAdapter).LoadData(0); //Library.ItemInfoList.LoadAdapterItems(this.Activity, (ItemsInfoAdapter)ListAdapter); break; case (int)MainMenu.MenuItems.Customers: actionBar.SetTitle(this.Activity.GetString(Resource.String.miCustomers)); Library.CustomerInfoList custInfoList = Library.CustomerInfoList.GetCustomerInfoList(this.Activity, new Library.CustomerInfoList.Criteria()); _list = custInfoList; ListAdapter = new CustomersAdapter(Activity, custInfoList); break; case (int)MainMenu.MenuItems.Invoices: actionBar.SetTitle(this.Activity.GetString(Resource.String.miInvoice)); Library.TransHedList thedList = Library.TransHedList.GetTransHedList(this.Activity); _list = thedList; ListAdapter = new TransHedAdapter(Activity, thedList); break; } }
public void ShowDetails(int index) { if (index == -1) { return; } // We can display everything in place with fragments. // Have the list highlight this item and show the data. ListView.SetItemChecked(index, true); int currentFragmentID = 0; var detailFragment = (BaseFragment)FragmentManager.FindFragmentById(Resource.Id.fragment3); currentFragmentID = Resource.Id.fragment3; if (detailFragment == null) { detailFragment = (BaseFragment)FragmentManager.FindFragmentById(Resource.Id.fragment1); currentFragmentID = Resource.Id.fragment1; } switch (ParentObjId) { case (int)MainMenu.MenuItems.Items: long itemId = ((ItemsInfoAdapter)ListAdapter).GetItem(index).ItemId; // long itemId = (long)((Library.ItemInfoList)_list)[index].ItemId; if (detailFragment == null || detailFragment.ObjectId != itemId) { var ft = FragmentManager.BeginTransaction(); ft.Replace(currentFragmentID, ItemFragment.NewInstance(itemId)); ft.SetTransition(Android.Support.V4.App.FragmentTransaction.TransitFragmentFade); ft.Commit(); } break; case (int)MainMenu.MenuItems.Customers: long custId = (long)((Library.CustomerInfoList)_list)[index].CustID; if (detailFragment == null || detailFragment.ObjectId != custId) { Library.CustomerInfoList custList = (Library.CustomerInfoList)_list; System.Collections.Generic.List <string> custNamesList = new System.Collections.Generic.List <string>(custList.Count); custList.ForEach(c => custNamesList.Add(c.Name)); var ft = FragmentManager.BeginTransaction(); ft.Replace(currentFragmentID, CustomerFragment.NewInstance(custId, custNamesList.ToArray())); ft.SetTransition(Android.Support.V4.App.FragmentTransaction.TransitFragmentFade); ft.Commit(); } break; case (int)MainMenu.MenuItems.Invoices: //long invoiceId = (long)((Library.TransHedList)_list)[index].HtrnId;//? long invoiceId = (long)((TransHedAdapter)this.ListView.Adapter).GetItem(index).HtrnId; if (detailFragment == null || detailFragment.ObjectId != invoiceId) { var ft = FragmentManager.BeginTransaction(); //ft.Replace(Resource.Id.detailInfo_fragment, InvoiceFragment.NewInstance(invoiceId)); InvoiceInfoFragment invoiceFragment = InvoiceInfoFragment.NewInstance(invoiceId); ft.Replace(currentFragmentID, invoiceFragment); ft.SetTransition(Android.Support.V4.App.FragmentTransaction.TransitFragmentFade); ft.Commit(); invoiceFragment.InvoiceSaved += new InvoiceInfoFragment.InvoiceSavedDelegate(InvoiceSaved); } break; } }