Esempio n. 1
0
        protected override void OnAppearing()
        {
            base.OnAppearing();

            try {
                VMOperations vm = BindingContext as VMOperations;

                if (GlobalVariables.IsOffline)
                {
                    vm.IsVisibleBranchBtn = false;

                    List <DataSyncBranchModel> listDataSyncBranchModel = SQLiteDatabase.Instance.GetDataSyncBranch();
                    if (listDataSyncBranchModel != null)
                    {
                        GlobalVariables.BranchCode = listDataSyncBranchModel [0].BranchCode;
                        GlobalVariables.BranchName = listDataSyncBranchModel [0].BranchName;
                    }

                    listDataSyncBranchModel = null;
                }


                string CurrentBranch = GlobalVariables.BranchCode + "-" + GlobalVariables.BranchName;
                if (!string.IsNullOrEmpty(GlobalVariables.BranchCode.Trim()) && CurrentBranch != vm.PBranch)
                {
                    vm.PBranch = CurrentBranch;

                    GlobalVariables.CustomerEntityID = string.Empty;
                    GlobalVariables.CustomerID       = string.Empty;
                    GlobalVariables.CustomerName     = string.Empty;
                    vm.PCustomer = string.Empty;

                    GlobalVariables.AccountEntityID = "0";
                    vm.PAccountNo = string.Empty;
                }
                else if (CurrentBranch == vm.PBranch)
                {
                    string CurrentCustomer = GlobalVariables.CustomerID + "-" + GlobalVariables.CustomerName;

                    if (!string.IsNullOrEmpty(GlobalVariables.CustomerEntityID.Trim()) && CurrentCustomer != vm.PCustomer)
                    {
                        vm.PCustomer = CurrentCustomer;
                        GlobalVariables.AccountEntityID = "0";
                        vm.PAccountNo = string.Empty;
                    }
                    else if (CurrentCustomer == vm.PCustomer)
                    {
                        vm.PAccountNo = GlobalVariables.AccountID;
                    }
                }

                vm = null;
            } catch {
            }
        }
Esempio n. 2
0
        public void clearall()
        {
            VMOperations vm = BindingContext as VMOperations;

            if (GlobalVariables.BranchCode == null)
            {
                vm.PBranch = "";
            }
            if (GlobalVariables.CustomerID == null)
            {
                vm.PCustomer = "";
            }
            if (GlobalVariables.AccountID == null)
            {
                vm.PAccountNo = "";
            }
        }
Esempio n. 3
0
        public Operations()
        {
            InitializeComponent();
            clearall();

            VMOperations vma = BindingContext as VMOperations;

            if (GlobalVariables.UserLocation == "BO")
            {
                GlobalVariables.BranchCode = GlobalVariables.UserLocationCode;
                GlobalVariables.BranchName = GlobalVariables.UserLocationName;
                string CurrentBranch = GlobalVariables.BranchCode + "-" + GlobalVariables.UserLocationName;
                if (!string.IsNullOrEmpty(GlobalVariables.BranchCode.Trim()) && CurrentBranch != vma.PBranch)
                {
                    vma.PBranch            = CurrentBranch;
                    vma.IsVisibleBranchBtn = false;
                }
            }
            else
            {
                vma.IsVisibleBranchBtn = true;
            }

            btnSearchBranch.Clicked += async(object sender, EventArgs e) => {
                await Navigation.PushAsync(new BranchList());
            };

            btnCustomerList.Clicked += async(object sender, EventArgs e) => {
                await Navigation.PushAsync(new CustomerList());
            };

            btnACID.Clicked += async(object sender, EventArgs e) => {
                await Navigation.PushAsync(new AccountList());
            };

            btnOk.Clicked += async(object sender, EventArgs e) => {
                await Navigation.PopAsync();
            };

            btnCancel.Clicked += async(object sender, EventArgs e) => {
                await Navigation.PopAsync();
            };

            btnACIDClear.Clicked += (object sender, EventArgs e) => {
                VMOperations vm = BindingContext as VMOperations;
                vm.PAccountNo                   = "";
                GlobalVariables.AccountID       = null;
                GlobalVariables.AccountEntityID = "0";
                vm = null;
            };

            btnCancel.Clicked += (object sender, EventArgs e) => {
                VMOperations vm = BindingContext as VMOperations;
                vm.PAccountNo = "";

                GlobalVariables.AccountID = null;

                vm.PBranch = "";

                GlobalVariables.BranchCode = null;
                GlobalVariables.BranchName = "";

                vm.PCustomer = "";

                GlobalVariables.CustomerID   = null;
                GlobalVariables.CustomerName = "";

                vm = null;
            };
        }