예제 #1
0
        public OutletListItemViewHolder(View itemView, IOutletListItemClickListener listener, OutletListFragment fragment) : base(itemView)
        {
            this.mListener          = listener;
            this.outletListFragment = fragment;

            // Locate and cache view references:
            CustomerName   = itemView.FindViewById <TextView>(Resource.Id.outletitem_name_text);
            Project01      = itemView.FindViewById <TextView>(Resource.Id.outletitem_project_01);
            Project02      = itemView.FindViewById <TextView>(Resource.Id.outletitem_project_02);
            Project03      = itemView.FindViewById <TextView>(Resource.Id.outletitem_project_03);
            CustomerID     = itemView.FindViewById <TextView>(Resource.Id.outletitem_id);
            FISSalesTarget = itemView.FindViewById <TextView>(Resource.Id.outletitem_fis_sales_vs_target);
            FISPer         = itemView.FindViewById <TextView>(Resource.Id.outletitem_fis_per);
            FISBal         = itemView.FindViewById <TextView>(Resource.Id.outletitem_fis_bal);
            FISMr          = itemView.FindViewById <TextView>(Resource.Id.outletitem_fis_mr);
            FISMrPer       = itemView.FindViewById <TextView>(Resource.Id.outletitem_fis_mr_per);
            HPLabel        = itemView.FindViewById <TextView>(Resource.Id.outletitem_hp);
            HPSalesTarget  = itemView.FindViewById <TextView>(Resource.Id.outletitem_hp_sales_vs_target);
            HPPer          = itemView.FindViewById <TextView>(Resource.Id.outletitem_hp_per);
            HPBal          = itemView.FindViewById <TextView>(Resource.Id.outletitem_hp_bal);
            HPMr           = itemView.FindViewById <TextView>(Resource.Id.outletitem_hp_mr);
            HPMrPer        = itemView.FindViewById <TextView>(Resource.Id.outletitem_hp_mr_per);
            RemarkLabel    = itemView.FindViewById <TextView>(Resource.Id.outletitem_remark_label);
            Remark         = itemView.FindViewById <TextView>(Resource.Id.outletitem_remark);

            ListItemFrame = itemView.FindViewById <FrameLayout>(Resource.Id.fragment_outletlist_item);
            ListItemFrame.SetOnClickListener(this);
        }
예제 #2
0
 public OutletListAdapter(List <vwOutletListViewModel> outletList, OutletListFragment fragment)
 {
     this.mOutletList        = outletList;
     this.outletListFragment = fragment;
 }
예제 #3
0
        private void ListItemClicked(int position)
        {
            Android.Support.V4.App.Fragment fragment = null;
            switch (position)
            {
            case 0:
                this.Title = "Dashboard";
                fragment   = new DashboardFragment();
                break;

            case 1:
                this.Title = "Outlet List";
                fragment   = new OutletListFragment();
                break;

            case 2:
                this.Title = "Unit of Measurement";
                fragment   = new UOMFragment();
                break;

            case 3:
                this.Title = "Synchronization";
                fragment   = new SyncFragment();
                break;

            case 4:
                this.Title = "About";
                fragment   = new AboutFragment();
                break;

            case 5:
                Android.App.AlertDialog.Builder builder = new Android.App.AlertDialog.Builder(this);
                builder.SetTitle("Confirm");
                builder.SetMessage("Are you sure you want to log out?");
                builder.SetPositiveButton("NO", (sender, e) =>
                {
                });
                builder.SetNegativeButton("YES", (sender, e) =>
                {
                    var appPreferences = new AppPreferences(this.ApplicationContext);
                    appPreferences.SaveUsername("");
                    appPreferences.SavePassword("");
                    appPreferences.SaveMasterDBDownloaded(false);
                    appPreferences.SaveAuditDBDownloaded(false);

                    string masterDBPath = new FileUtil().GetMasterDBPath();
                    if (File.Exists(masterDBPath))
                    {
                        File.Delete(masterDBPath);
                    }

                    string auditDBPath = new FileUtil().GetAuditDBPath();
                    if (File.Exists(auditDBPath))
                    {
                        File.Delete(auditDBPath);
                    }

                    string auditDBBlankPath = new FileUtil().GetAuditDBBlankPath();
                    if (File.Exists(auditDBBlankPath))
                    {
                        File.Delete(auditDBBlankPath);
                    }

                    string tempZipFile = new FileUtil().GetTempZipFileName();
                    if (File.Exists(tempZipFile))
                    {
                        File.Delete(tempZipFile);
                    }

                    string tempDirectoryPath = new FileUtil().GetTempDirectoryPath();
                    string auditZipPath      = System.IO.Path.Combine(tempDirectoryPath, Core.Globals.LoginUsername + ".zip");
                    if (File.Exists(auditZipPath))
                    {
                        File.Delete(auditZipPath);
                    }

                    FileUtil.ClearCache();
                    FileUtil.DeleteCache(this.ApplicationContext);

                    GlobalsAndroid.masterDB = null;

                    GC.Collect();
                    GC.WaitForPendingFinalizers();

                    Finish();
                });
                builder.Show();
                return;
            }

            if (!IsFinishing)
            {
                SupportFragmentManager.BeginTransaction()
                .Replace(Resource.Id.content_frame, fragment)
                .CommitAllowingStateLoss();
            }
        }