コード例 #1
0
ファイル: CNItemActivity.cs プロジェクト: mokth/merpV3
        void OnListItemClick(object sender, AdapterView.ItemClickEventArgs e)
        {
            CNNoteDtls item = listData.ElementAt(e.Position);

            if (item.icode.IndexOf("TAX") > -1)
            {
                return;
            }

            if (item.icode.IndexOf("AMOUNT") > -1)
            {
                return;
            }

            PopupMenu menu = new PopupMenu(e.Parent.Context, e.View);

            menu.Inflate(Resource.Menu.popupItem);
            if (!rights.CNAllowEdit)
            {
                menu.Menu.RemoveItem(Resource.Id.popedit);
            }
            if (!rights.CNAllowDelete)
            {
                menu.Menu.RemoveItem(Resource.Id.popdelete);
            }
            if (!rights.CNAllowAdd)
            {
                menu.Menu.RemoveItem(Resource.Id.popadd);
            }
            //if allow edit and Invoice printed, remove edit
            //printed invoice not allow to edit
            if (DataHelper.GetCNNotePrintStatus(pathToDatabase, invno, rights))
            {
                menu.Menu.RemoveItem(Resource.Id.popedit);
                menu.Menu.RemoveItem(Resource.Id.popdelete);
                menu.Menu.RemoveItem(Resource.Id.popadd);
            }

            menu.MenuItemClick += (s1, arg1) => {
                if (arg1.Item.ItemId == Resource.Id.popadd)
                {
                    NewItem(item.cnno);
                }
                else if (arg1.Item.ItemId == Resource.Id.popedit)
                {
                    Edit(item);
                }
                else if (arg1.Item.ItemId == Resource.Id.popdelete)
                {
                    Delete(item);
                }
            };
            menu.Show();
        }
コード例 #2
0
        void OnListItemLongClick(object sender, AdapterView.ItemLongClickEventArgs e)
        {
            CNNote    item = listData.ElementAt(e.Position);
            PopupMenu menu = new PopupMenu(e.Parent.Context, e.View);

            menu.Inflate(Resource.Menu.popupInv);

            //if (!compinfo.AllowDelete) {
            menu.Menu.RemoveItem(Resource.Id.poppay);
            menu.Menu.RemoveItem(Resource.Id.popInvdelete);
            //}
            if (!rights.CNAllowAdd)
            {
                menu.Menu.RemoveItem(Resource.Id.popInvadd);
            }
            if (!rights.CNAllowEdit)
            {
                menu.Menu.RemoveItem(Resource.Id.popInvedit);
            }

            if (!rights.CNAllowPrint)
            {
                menu.Menu.RemoveItem(Resource.Id.popInvprint);
                menu.Menu.RemoveItem(Resource.Id.popInvprint2);
            }
            if (DataHelper.GetCNNotePrintStatus(pathToDatabase, item.cnno, 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);
                }
            };
            menu.Show();
        }
コード例 #3
0
ファイル: CNItemActivity.cs プロジェクト: mokth/merpV3
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);
            if (!((GlobalvarsApp)this.Application).ISLOGON)
            {
                Finish();
            }
            SetTitle(Resource.String.title_creditnoteitems);
            SetContentView(Resource.Layout.InvDtlView);
            pathToDatabase = ((GlobalvarsApp)this.Application).DATABASE_PATH;
            rights         = Utility.GetAccessRights(pathToDatabase);

            invno    = Intent.GetStringExtra("invoiceno") ?? "AUTO";
            CUSTCODE = Intent.GetStringExtra("custcode") ?? "AUTO";
            EDITMODE = Intent.GetStringExtra("editmode") ?? "AUTO";

            isNotAllowEditAfterPrinted = DataHelper.GetCNNotePrintStatus(pathToDatabase, invno, rights);
            Button butNew = FindViewById <Button> (Resource.Id.butnewItem);

            butNew.Click += (object sender, EventArgs e) => {
                NewItem(invno);
            };
            if (isNotAllowEditAfterPrinted)
            {
                butNew.Enabled = false;
            }
            if (!rights.CNAllowAdd)
            {
                butNew.Enabled = false;
            }
            Button butInvBack = FindViewById <Button> (Resource.Id.butInvItmBack);

            butInvBack.Click += (object sender, EventArgs e) => {
                if (EDITMODE.ToLower() == "new")
                {
                    DeleteCNWithEmptyCNitem();
                }
                var intent = ActivityManager.GetActivity <CNNoteActivity>(this.ApplicationContext);
                StartActivity(intent);
            };


            populate(listData);
            listView            = FindViewById <ListView> (Resource.Id.invitemList);
            listView.ItemClick += OnListItemClick;
            //listView.Adapter = new CusotmItemListAdapter(this, listData);
            SetViewDlg viewdlg = SetViewDelegate;

            listView.Adapter = new GenericListAdapter <CNNoteDtls> (this, listData, Resource.Layout.InvDtlItemViewCS, viewdlg);
        }
コード例 #4
0
ファイル: CNItemActivity.cs プロジェクト: mokth/merpV3
        protected override void OnResume()
        {
            base.OnResume();
            pathToDatabase             = ((GlobalvarsApp)this.Application).DATABASE_PATH;
            rights                     = Utility.GetAccessRights(pathToDatabase);
            invno                      = Intent.GetStringExtra("invoiceno") ?? "AUTO";
            CUSTCODE                   = Intent.GetStringExtra("custcode") ?? "AUTO";
            isNotAllowEditAfterPrinted = DataHelper.GetCNNotePrintStatus(pathToDatabase, invno, rights);
            Button butNew = FindViewById <Button> (Resource.Id.butnewItem);

            if (isNotAllowEditAfterPrinted)
            {
                butNew.Enabled = false;
            }
            listData = new List <CNNoteDtls> ();
            populate(listData);
            listView = FindViewById <ListView> (Resource.Id.invitemList);
            SetViewDlg viewdlg = SetViewDelegate;

            listView.Adapter = new GenericListAdapter <CNNoteDtls> (this, listData, Resource.Layout.InvDtlItemViewCS, viewdlg);
        }