コード例 #1
0
        protected async override void OnStart()
        {
            bitopiApplication.CurrentActivity = "Approval Detail Activity";
            base.OnStart();
            var progressDialog = ProgressDialog.Show(this, null, "", true);

            repo = new ApprovalRepository();

            List <ApprovalDetailsModel> aprovalList = await repo.GetPOApprovalDetails(bitopiApplication.User.UserCode, bitopiApplication.ApprovalRoleType,
                                                                                      bitopiApplication.ApprovalType);

            _approvalList.Clear();
            aprovalList.ForEach(s => _approvalList.Add(s));
            _approvalListAdapter = new ApprovalDetalisListAdapter(_approvalList, lvApprovalDetailList, this);
            lvApprovalDetailList.SetAdapter(_approvalListAdapter);
            _approvalListAdapter.NotifyDataSetChanged();
            _chkApproveAll.Click += (s, e) =>
            {
                _approvalList.ForEach(t => t.isApproved = _chkApproveAll.Checked);
                _approvalListAdapter.SetData(_approvalList);
                _approvalListAdapter.NotifyDataSetChanged();
            };
            lvApprovalDetailList.SetGroupIndicator(null);
            progressDialog.Dismiss();
        }
コード例 #2
0
            public bool OnClose()
            {
                _rltitle.Visibility = ViewStates.Visible;

                if (_approvalListAdapter != null)
                {
                    _approvalListAdapter.SetData(_list);
                    _approvalListAdapter.NotifyDataSetChanged();
                }

                return(false);
            }
コード例 #3
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            builder = new Android.App.AlertDialog.Builder(this);
            builder.SetMessage("Hello, World!");

            builder.SetNegativeButton("Cancel", (s, e) => { /* do something on Cancel click */ });


            base.OnCreate(savedInstanceState);
            _approvalList     = new ApprovalDetailList(this);
            _approvalType     = (ApprovalType)(Convert.ToInt16(Intent.GetStringExtra("ApprovalType")));
            _approvalRoleType = (ApprovalRoleType)(Convert.ToInt16(Intent.GetStringExtra("ApprovalRoleType")));

            SupportRequestWindowFeature(WindowCompat.FeatureActionBar);
            SupportActionBar.SetDisplayShowCustomEnabled(true);
            SupportActionBar.SetCustomView(Resource.Layout.custom_actionbar);
            rltitle = FindViewById <RelativeLayout>(Resource.Id.rltitle);


            SetContentView(Resource.Layout.ApprovalDetailList);

            lvApprovalDetailList = FindViewById <AnimatedExpandableListView>(Resource.Id.lvApprovalsDetails);
            _chkApproveAll       = FindViewById <CheckBox>(Resource.Id.chkSelectAll);
            rlMsg            = FindViewById <RelativeLayout>(Resource.Id.rlMsg);
            rlapprovalDetail = FindViewById <RelativeLayout>(Resource.Id.rlapprovalDetail);

            if (bitopiApplication.ApprovalRoleType == ApprovalRoleType.Recommend)
            {
                (FindViewById <Button>(Resource.Id.btnApproveAll)).Text    = "RECOMMEND SELECTED";
                (FindViewById <Button>(Resource.Id.btnNotApproveAll)).Text = "NOT RECOMMEND SELECTED";
            }
            else
            {
                (FindViewById <Button>(Resource.Id.btnApproveAll)).Text    = "APPROVE SELECTED";
                (FindViewById <Button>(Resource.Id.btnNotApproveAll)).Text = "NOT APPROVE SELECTED";
            }
            (FindViewById <Button>(Resource.Id.btnApproveAll)).Click += (s, e) =>
            {
                builder.SetMessage("Do you want to " + (bitopiApplication.ApprovalRoleType == ApprovalRoleType.Approve ? "Approve" : "Recommend ") + _approvalList.Where(t => t.isApproved == true).Count() + " Approval");

                builder.SetPositiveButton("OK", (sender, evnt) =>
                {
                    var progressDialog = ProgressDialog.Show(this, null, "", true);
                    _approvalList.SaveSelected((bitopiApplication.ApprovalRoleType == ApprovalRoleType.Approve ? "Approved" : "Recommended"), (numberOfSuccessFullOperation) =>
                    {
                        progressDialog.Dismiss();
                        var tempApprovalList = _approvalList.Where(t => t.isDeleted == false).ToList();
                        _approvalList        = new ApprovalDetailList(this);
                        tempApprovalList.ForEach(st => _approvalList.Add(st));
                        _approvalListAdapter.SetData(_approvalList);
                        _approvalListAdapter.NotifyDataSetChanged();
                        Toast.MakeText(this, "Total " + numberOfSuccessFullOperation + " Approval has been " + ((bitopiApplication.ApprovalRoleType == ApprovalRoleType.Approve) ? "Approved" : "Recommended"), ToastLength.Long).Show();
                        if (numberOfSuccessFullOperation > 0 && _approvalList.Count == 0)
                        {
                            rlMsg.Visibility            = ViewStates.Visible;
                            rlapprovalDetail.Visibility = ViewStates.Gone;
                        }
                    });

                    /* do something on OK click */
                });
                builder.Create().Show();
            };
            (FindViewById <Button>(Resource.Id.btnNotApproveAll)).Click += (s, e) =>
            {
                builder.SetMessage("Do you want to " + ((bitopiApplication.ApprovalRoleType == ApprovalRoleType.Approve) ? "Reject" : "Not Recommend ") + _approvalList.Where(t => t.isApproved == true).Count() + " Approval");

                builder.SetPositiveButton("OK", (sender, evnt) =>
                {
                    var progressDialog = ProgressDialog.Show(this, null, "", true);
                    _approvalList.SaveSelected((bitopiApplication.ApprovalRoleType == ApprovalRoleType.Approve) ? "Rejected" : "NotRecommend", (numberOfSuccessFullOperation) =>
                    {
                        progressDialog.Dismiss();
                        var tempApprovalList = _approvalList.Where(t => t.isDeleted == false).ToList();
                        _approvalList        = new ApprovalDetailList(this);
                        tempApprovalList.ForEach(st => _approvalList.Add(st));
                        _approvalListAdapter.SetData(_approvalList);
                        _approvalListAdapter.NotifyDataSetChanged();
                        Toast.MakeText(this, "Total " + numberOfSuccessFullOperation + " Approval has been " + ((bitopiApplication.ApprovalRoleType == ApprovalRoleType.Approve) ? "Rejected" : "Not Recommended"), ToastLength.Long).Show();
                        if (numberOfSuccessFullOperation > 0 && _approvalList.Count == 0)
                        {
                            rlMsg.Visibility            = ViewStates.Visible;
                            rlapprovalDetail.Visibility = ViewStates.Gone;
                        }
                    });
                });
                builder.Create().Show();
            };
            RLleft_drawer = FindViewById <RelativeLayout>(Resource.Id.RLleft_drawer);
            mDrawerLayout = FindViewById <DrawerLayout>(Resource.Id.drawer_layout);
            FindViewById <ImageButton>(Resource.Id.btnDrawermenu).Visibility = ViewStates.Visible;
            FindViewById <ImageButton>(Resource.Id.btnDrawermenu).Click     += (s, e) =>
            {
                if (mDrawerLayout.IsDrawerOpen(RLleft_drawer))
                {
                    mDrawerLayout.CloseDrawer(RLleft_drawer);
                }
                else
                {
                    mDrawerLayout.OpenDrawer(RLleft_drawer);
                }
            };

            //base.LoadDrawerView();
        }