コード例 #1
0
        public InsertedInformations()
        {
            InitializeComponent();

            Partners = new InsertedInformations_Partners(this)
            {
                StartColor = Color.FromHex("E6EBEF"), EndColor = Color.FromHex("A6CFED")
            };
            FailedVisits = new InsertedInformations_FailedVisits(this)
            {
                StartColor = Color.FromHex("E6EBEF"), EndColor = Color.FromHex("A6CFED")
            };
            Orders = new InsertedInformations_Orders(this)
            {
                StartColor = Color.FromHex("E6EBEF"), EndColor = Color.FromHex("A6CFED")
            };
            App.InsertedInformations_Partners     = Partners;
            App.InsertedInformations_FailedVisits = FailedVisits;
            App.InsertedInformations_Orders       = Orders;
            Children.Add(Partners);
            Children.Add(FailedVisits);
            Children.Add(Orders);

            ToolbarItem_SearchBar          = new ToolbarItem();
            ToolbarItem_SearchBar.Text     = "جستجو";
            ToolbarItem_SearchBar.Icon     = "Search.png";
            ToolbarItem_SearchBar.Order    = ToolbarItemOrder.Primary;
            ToolbarItem_SearchBar.Priority = 10;

            ToolbarItem_SelectAll          = new ToolbarItem();
            ToolbarItem_SelectAll.Text     = "انتخاب همه";
            ToolbarItem_SelectAll.Icon     = "SelectAll_Empty.png";
            ToolbarItem_SelectAll.Order    = ToolbarItemOrder.Primary;
            ToolbarItem_SelectAll.Priority = 9;

            ToolbarItem_SendToServer          = new ToolbarItem();
            ToolbarItem_SendToServer.Text     = "ارسال";
            ToolbarItem_SendToServer.Icon     = "Upload.png";
            ToolbarItem_SendToServer.Order    = ToolbarItemOrder.Primary;
            ToolbarItem_SendToServer.Priority = 1;

            ToolbarItem_Delete          = new ToolbarItem();
            ToolbarItem_Delete.Text     = "حذف";
            ToolbarItem_Delete.Icon     = "Delete.png";
            ToolbarItem_Delete.Order    = ToolbarItemOrder.Primary;
            ToolbarItem_Delete.Priority = 2;

            ToolbarItem_Edit          = new ToolbarItem();
            ToolbarItem_Edit.Text     = "ویرایش";
            ToolbarItem_Edit.Icon     = "Edit.png";
            ToolbarItem_Edit.Order    = ToolbarItemOrder.Primary;
            ToolbarItem_Edit.Priority = 3;

            ToolbarItem_Show          = new ToolbarItem();
            ToolbarItem_Show.Text     = "نمایش";
            ToolbarItem_Show.Icon     = "ShowInvoice.png";
            ToolbarItem_Show.Order    = ToolbarItemOrder.Primary;
            ToolbarItem_Show.Priority = 4;

            this.CurrentPageChanged += (sender, e) => {
                if (this.CurrentPage == Orders)
                {
                    Orders.SetCurrentPage();
                    FailedVisits.UnsetCurrentPage();
                    Partners.UnsetCurrentPage();
                }
                if (this.CurrentPage == FailedVisits)
                {
                    Orders.UnsetCurrentPage();
                    FailedVisits.SetCurrentPage();
                    Partners.UnsetCurrentPage();
                }
                if (this.CurrentPage == Partners)
                {
                    Orders.UnsetCurrentPage();
                    FailedVisits.UnsetCurrentPage();
                    Partners.SetCurrentPage();
                }
            };
            CurrentPage = Orders;
        }
コード例 #2
0
        //Dictionary<Guid, decimal> PackagesQuantity;

        public OrderBeforePreviewForm
        (
            List <DBRepository.StuffListModel> AllStuffsData,
            Partner Partner,
            SaleOrder SaleOrder,
            PartnerListForm PartnerListForm,
            InsertedInformations_Orders OrdersForm,
            Guid?_SettlementTypeId,
            string Description,
            OrderInsertForm OrderInsertForm,
            bool CanChangePartner,
            Guid?WarehouseId
        )
        {
            InitializeComponent();

            this.WarehouseId = WarehouseId;

            this.OrderInsertForm = OrderInsertForm;

            EditingSaleOrderId = SaleOrder != null ? SaleOrder.Id : new Nullable <Guid>();

            this.AllStuffsData = AllStuffsData;

            this.PartnerListForm = PartnerListForm;
            this.OrdersForm      = OrdersForm;

            CustomStuffListCell.UnitNameTapEventHandler = (s, e) => {
                var Ids           = ((string)((TappedEventArgs)e).Parameter).Split(new string[] { "|" }, StringSplitOptions.RemoveEmptyEntries);
                var StuffId       = new Guid(Ids[0]);
                var BatchNumberId = Ids.Length == 2 ? new Guid(Ids[1]) : new Nullable <Guid>();
                UnitNameClicked(StuffId);
            };
            CustomStuffListCell.QuantityTextBoxTapEventHandler = (s, e) => {
                var Ids           = ((string)((TappedEventArgs)e).Parameter).Split(new string[] { "|" }, StringSplitOptions.RemoveEmptyEntries);
                var StuffId       = new Guid(Ids[0]);
                var BatchNumberId = Ids.Length == 2 ? new Guid(Ids[1]) : new Nullable <Guid>();
                FocusedQuantityTextBoxId = BatchNumberId.HasValue ? new Guid[] { StuffId, BatchNumberId.Value } : new Guid[] { StuffId };
            };
            CustomStuffListCell.QuantityPlusTapEventHandler = (s, e) => {
                var Ids           = ((string)((TappedEventArgs)e).Parameter).Split(new string[] { "|" }, StringSplitOptions.RemoveEmptyEntries);
                var StuffId       = new Guid(Ids[0]);
                var BatchNumberId = Ids.Length == 2 ? new Guid(Ids[1]) : new Nullable <Guid>();
                QuantityPlusClicked(StuffId, BatchNumberId);
            };
            CustomStuffListCell.QuantityMinusTapEventHandler = (s, e) => {
                var Ids           = ((string)((TappedEventArgs)e).Parameter).Split(new string[] { "|" }, StringSplitOptions.RemoveEmptyEntries);
                var StuffId       = new Guid(Ids[0]);
                var BatchNumberId = Ids.Length == 2 ? new Guid(Ids[1]) : new Nullable <Guid>();
                QuantityMinusClicked(StuffId, BatchNumberId);
            };
            StuffItems.ItemTemplate = new DataTemplate(typeof(CustomStuffListCell));

            SelectedPartner = Partner != null ? Partner : SaleOrder != null ? SaleOrder.Partner : null;
            if (CanChangePartner)
            {
                PartnerChangeButton.IsEnabled = true;
            }
            else
            {
                PartnerChangeButton.IsEnabled = false;
            }
            PartnerLabel.FontSize *= 1.5;

            var PartnerChangeButtonTapGestureRecognizer = new TapGestureRecognizer();

            PartnerChangeButtonTapGestureRecognizer.Tapped += (sender, e) => {
                if (PartnerChangeButton.IsEnabled)
                {
                    FocusedQuantityTextBoxId = null;
                    var PartnerListForm1 = new PartnerListForm();
                    PartnerListForm1.OrderBeforePreviewForm = this;
                    Navigation.PushAsync(PartnerListForm1);
                }
            };
            PartnerChangeButtonTapGestureRecognizer.SetBinding(TapGestureRecognizer.CommandParameterProperty, "Id");
            PartnerChangeButton.GestureRecognizers.Add(PartnerChangeButtonTapGestureRecognizer);
            PartnerChangeButton.WidthRequest = 150;

            StuffItems.HasUnevenRows       = true;
            StuffItems.SeparatorVisibility = SeparatorVisibility.None;
            StuffItems.ItemSelected       += StuffItems_ItemSelected;

            ToolbarItem_OrderPreviewForm            = new ToolbarItem();
            ToolbarItem_OrderPreviewForm.Text       = "پیش نمایش سفارش";
            ToolbarItem_OrderPreviewForm.Icon       = "ShowInvoice.png";
            ToolbarItem_OrderPreviewForm.Activated += ToolbarItem_OrderPreviewForm_Activated;
            ToolbarItem_OrderPreviewForm.Order      = ToolbarItemOrder.Primary;
            ToolbarItem_OrderPreviewForm.Priority   = 2;
            if (!this.ToolbarItems.Contains(ToolbarItem_OrderPreviewForm))
            {
                this.ToolbarItems.Add(ToolbarItem_OrderPreviewForm);
            }

            SettlementTypes = App.SettlementTypes.Where(a => a.Enabled).ToArray();
            foreach (var SettlementType in SettlementTypes)
            {
                SettlementTypePicker.Items.Add(SettlementType.Name);
            }

            if (SaleOrder != null)
            {
                _SettlementTypeId = SaleOrder.SettlementTypeId;
            }
            if (_SettlementTypeId.HasValue)
            {
                SettlementTypePicker.SelectedIndex = SettlementTypes.Select((a, index) => new { a, index }).Single(a => a.a.Id == _SettlementTypeId).index;
                SettlementTypeLabel.Text           = SettlementTypes[SettlementTypePicker.SelectedIndex].Name;
            }
            SettlementTypeId = _SettlementTypeId;

            SettlementTypePicker.SelectedIndexChanged += (sender, e) => {
                FocusedQuantityTextBoxId = null;

                SettlementTypeLabel.Text = SettlementTypes[SettlementTypePicker.SelectedIndex].Name;

                var SettlementType = SettlementTypePicker.SelectedIndex == -1 ? null : SettlementTypes[SettlementTypePicker.SelectedIndex];
                this.SettlementTypeId            = SettlementType == null ? new Nullable <Guid>() : SettlementType.Id;
                OrderInsertForm.SettlementTypeId = SettlementTypeId;
            };

            var _Description = SaleOrder != null ? SaleOrder.Description : Description;

            DescriptionEditor.Text = !string.IsNullOrEmpty(_Description) ? _Description : "";

            QuantityKeyboard = new MyKeyboard <QuantityEditingStuffModel, decimal>
                               (
                QuantityKeyboardHolder,
                new Command((parameter) => {        //OnOK
                FocusedQuantityTextBoxId = null;
                CheckToBackToOrderInsertFormIfStuffsEmpty();
            }),
                new Command((parameter) => {        //OnChange
                CheckToBackToOrderInsertFormIfStuffsEmpty();
            })
                //new Command((parameter) => {        //OnOK
                //    var Value = (decimal)parameter;
                //    //var StuffModel3 = OrderInsertForm.StuffsList.SingleOrDefault(a => a.StuffId == FocusedQuantityTextBoxId);
                //    var StuffModel4 = OrderInsertForm.AllStuffsData.Where(a => a.StuffId == FocusedQuantityTextBoxId).ToArray();
                //    //if (StuffModel3 != null)
                //    //    StuffModel3.Quantity = Value;
                //    foreach (var item in StuffModel4)
                //        item.Quantity = Value;
                //    FocusedQuantityTextBoxId = null;
                //    CheckToBackToOrderInsertFormIfStuffsEmpty();
                //}),
                //new Command((parameter) => {        //OnChange
                //    var Value = (decimal)parameter;
                //    //var StuffModel3 = OrderInsertForm.StuffsList.SingleOrDefault(a => a.StuffId == FocusedQuantityTextBoxId);
                //    var StuffModel4 = OrderInsertForm.AllStuffsData.Where(a => a.StuffId == FocusedQuantityTextBoxId).ToArray();
                //    //if (StuffModel3 != null)
                //    //    StuffModel3.Quantity = Value;
                //    foreach (var item in StuffModel4)
                //        item.Quantity = Value;
                //    CheckToBackToOrderInsertFormIfStuffsEmpty();
                //})
                               );
        }