コード例 #1
0
//		void OnListItemClick(object sender, AdapterView.ItemClickEventArgs e) {
//			Invoice item = listData.ElementAt (e.Position);
//			//var intent = new Intent(this, typeof(InvItemActivity));
//			var intent =ActivityManager.GetActivity<InvItemActivity>(this.ApplicationContext);
//			intent.PutExtra ("invoiceno",item.invno );
//			intent.PutExtra ("custcode",item.custcode );
//			StartActivity(intent);
//		}

        void OnListItemLongClick(object sender, AdapterView.ItemClickEventArgs e)
        {
            Invoice   item = listData.ElementAt(e.Position);
            PopupMenu menu = new PopupMenu(e.Parent.Context, e.View);

            menu.Inflate(Resource.Menu.popupInv);
            var mitem = menu.Menu.FindItem(Resource.Id.poppay);

            mitem.SetVisible(true);
            menu.Menu.RemoveItem(Resource.Id.popInvdelete);
            menu.Menu.RemoveItem(Resource.Id.popInvadd);
            menu.Menu.RemoveItem(Resource.Id.poppay);
            bool isNotAllowEditAfterPrinted = DataHelper.GetCashBillPrintStatus(pathToDatabase, item.invno, rights);

            if (isNotAllowEditAfterPrinted)
            {
                menu.Menu.RemoveItem(Resource.Id.popInvedit);
            }

            if (!rights.CSAllowPrint)
            {
                menu.Menu.RemoveItem(Resource.Id.popInvprint);
                menu.Menu.RemoveItem(Resource.Id.popInvprint2);
            }

            if (DataHelper.GetCashBillPrintStatus(pathToDatabase, item.invno, rights))
            {
                menu.Menu.RemoveItem(Resource.Id.popInvdelete);
                menu.Menu.RemoveItem(Resource.Id.popInvedit);
            }
            menu.MenuItemClick += (s1, arg1) => {
                if (arg1.Item.ItemId == Resource.Id.popInvadd)
                {
                    CreateNewInvoice();
                }
                else if (arg1.Item.ItemId == Resource.Id.popInvprint)
                {
                    PrintInv(item, 1);
                }
                else if (arg1.Item.ItemId == Resource.Id.popInvprint2)
                {
                    PrintInv(item, 2);
                }
                else if (arg1.Item.ItemId == Resource.Id.popInvdelete)
                {
                    Delete(item);
                }
                else if (arg1.Item.ItemId == Resource.Id.popInvedit)
                {
                    Edit(item);
                }
                else if (arg1.Item.ItemId == Resource.Id.poppay)
                {
                    payment(item);
                }
            };
            menu.Show();
        }
コード例 #2
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);
            if (!((GlobalvarsApp)this.Application).ISLOGON)
            {
                Finish();
            }
            SetTitle(Resource.String.submenu_cash);
            //	this.RequestWindowFeature(WindowFeatures.NoTitle);
            INVOICENO = Intent.GetStringExtra("invoiceno") ?? "";
            INVACTION = Intent.GetStringExtra("action") ?? "";
            _date     = DateTime.Today;

            EventManagerFacade.Instance.GetEventManager().AddListener(this);
            pathToDatabase             = ((GlobalvarsApp)this.Application).DATABASE_PATH;
            rights                     = Utility.GetAccessRights(pathToDatabase);
            isNotAllowEditAfterPrinted = DataHelper.GetCashBillPrintStatus(pathToDatabase, invno, rights);

            SetContentView(Resource.Layout.POSCashEntry);
            _layoutParamsPortrait  = new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.FillParent, ViewGroup.LayoutParams.WrapContent);
            _layoutParamsLandscape = new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.FillParent, ViewGroup.LayoutParams.WrapContent);

            GetControls();
            LoadMasterTable();
            SpinnerHandling();
            ControlHandling();

            listData = new List <InvoiceDtls> ();
            //CreateCashBill ();
            LoadInvoice();
            populate(listData);
            SetViewDlg viewdlg = SetViewDelegate;

            listView.Adapter    = new GenericListAdapterEx <InvoiceDtls> (this, listData, Resource.Layout.InvDtlItemViewCS, viewdlg);
            listView.ItemClick += OnListItemClick;
        }