Example #1
0
        private async void OnSelectZone(ZoneDto obj)
        {
            if (IsBusy)
            {
                return;
            }

            IsBusy = true;

            try
            {
                // Thuc hien cong viec tai day
                var selectedZone = ListZoneBindProp.FindFirst(z => z.IsSelected);
                if (selectedZone != null)
                {
                    selectedZone.IsSelected = false;
                }
                obj.IsSelected                  = true;
                CurrentZone                     = obj;
                ZoneFrameVisibleBindProp        = true;
                ListInvoiceFrameVisibleBindProp = false;
            }
            catch (Exception e)
            {
                await ShowErrorAsync(e);
            }
            finally
            {
                IsBusy = false;
            }
        }
Example #2
0
        private async void OnSelectFrame(string obj)
        {
            if (IsBusy)
            {
                return;
            }

            IsBusy = true;

            try
            {
                // Thuc hien cong viec tai day
                var selectedCategory = ListCategoryBindProp.FirstOrDefault(z => z.IsSelected);
                var selectedZone     = ListZoneBindProp.FindFirst(z => z.IsSelected);
                switch (obj)
                {
                case "setting":
                    if (InvoiceBindProp != null)
                    {
                        var ok = await PageDialogService.DisplayAlertAsync("Cảnh báo", "Hủy hóa đơn?", "Đồng ý", "Không");

                        if (ok)
                        {
                            if (selectedCategory != null)
                            {
                                selectedCategory.IsSelected = false;
                            }
                            MenuFrameVisibleBindProp     = false;
                            InvoiceFrameVisibleBindProp  = false;
                            SettingFrameVisibleBindProp  = true;
                            DiscountFrameVisibleBindProp = false;
                            InvoiceBindProp     = null;
                            TempInvoiceBindProp = null;
                        }
                    }
                    else
                    {
                        MenuFrameVisibleBindProp     = false;
                        InvoiceFrameVisibleBindProp  = false;
                        SettingFrameVisibleBindProp  = true;
                        DiscountFrameVisibleBindProp = false;
                    }
                    break;

                case "invoice":
                    if (InvoiceBindProp != null)
                    {
                        var ok = await PageDialogService.DisplayAlertAsync("Cảnh báo", "Hủy hóa đơn?", "Đồng ý", "Không");

                        if (ok)
                        {
                            if (selectedZone != null)
                            {
                                selectedZone.IsSelected = false;
                            }
                            if (selectedCategory != null)
                            {
                                selectedCategory.IsSelected = false;
                            }
                            InvoiceBindProp                 = null;
                            TempInvoiceBindProp             = null;
                            MenuFrameVisibleBindProp        = false;
                            InvoiceFrameVisibleBindProp     = true;
                            SettingFrameVisibleBindProp     = false;
                            DiscountFrameVisibleBindProp    = false;
                            ListInvoiceFrameVisibleBindProp = true;
                            ZoneFrameVisibleBindProp        = false;
                        }
                    }
                    else
                    {
                        if (selectedCategory != null)
                        {
                            selectedCategory.IsSelected = false;
                        }
                        MenuFrameVisibleBindProp     = false;
                        InvoiceFrameVisibleBindProp  = true;
                        SettingFrameVisibleBindProp  = false;
                        DiscountFrameVisibleBindProp = false;
                    }
                    break;

                case "discount":
                    if (selectedCategory != null)
                    {
                        selectedCategory.IsSelected = false;
                    }
                    MenuFrameVisibleBindProp     = true;
                    InvoiceFrameVisibleBindProp  = false;
                    ItemFrameVisibleBindProp     = false;
                    DiscountFrameVisibleBindProp = true;
                    SettingFrameVisibleBindProp  = false;
                    break;

                case "invoicelist":
                    if (selectedZone != null)
                    {
                        selectedZone.IsSelected = false;
                    }
                    if (selectedCategory != null)
                    {
                        selectedCategory.IsSelected = false;
                    }
                    ListInvoiceFrameVisibleBindProp = true;
                    ZoneFrameVisibleBindProp        = false;
                    break;

                default:
                    break;
                }
            }
            catch (Exception e)
            {
                await ShowErrorAsync(e);
            }
            finally
            {
                IsBusy = false;
            }
        }