Пример #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
        public PartnerChange(Partner Partner, PartnerListForm PartnerListForm, InsertedInformations_Partners InsertedInformations_Partners, bool JustShow)
        {
            InitializeComponent();

            this.PartnerListForm = PartnerListForm;
            this.InsertedInformations_Partners = InsertedInformations_Partners;
            this.JustShow = JustShow;
            this.Padding  = new Thickness(5, 10);

            EditingPartner = Partner;

            //این 2 گروه در گروه مشتری ها نمی آیند
            //مشتریان بدون گروه
            //پرسنل شرکت
            PartnerGroups       = App.DB.GetPartnerGroups().Where(a => a.Id != new Guid("00000000-0000-0000-0000-FFFFFFFFFFFF") && a.Id != new Guid("00000000-0000-0000-0000-EEEEEEEEEEEE")).ToArray();
            PartnerGroupSwitchs = new KeyValuePair <Label, Switch> [PartnerGroups.Length];
            for (int i = 0; i < PartnerGroups.Length; i++)
            {
                PartnerGroupSwitchs[i] = new KeyValuePair <Label, Switch>(new Label()
                {
                    Text = PartnerGroups[i].Name, HorizontalOptions = LayoutOptions.EndAndExpand
                }, new Switch()
                {
                    HorizontalOptions = LayoutOptions.End
                });
            }

            City_Label = new Label()
            {
                Text = "شهر:  ", LineBreakMode = LineBreakMode.NoWrap, HorizontalTextAlignment = TextAlignment.End, VerticalTextAlignment = TextAlignment.Center, HorizontalOptions = LayoutOptions.FillAndExpand
            };
            Zone_Label = new Label()
            {
                Text = "منطقه:  ", LineBreakMode = LineBreakMode.NoWrap, HorizontalTextAlignment = TextAlignment.End, VerticalTextAlignment = TextAlignment.Center, HorizontalOptions = LayoutOptions.FillAndExpand
            };
            Route_Label = new Label()
            {
                Text = "مسیر:  ", LineBreakMode = LineBreakMode.NoWrap, HorizontalTextAlignment = TextAlignment.End, VerticalTextAlignment = TextAlignment.Center, HorizontalOptions = LayoutOptions.FillAndExpand
            };
            FirstName_Label = new Label()
            {
                Text = "نام:  ", LineBreakMode = LineBreakMode.NoWrap, HorizontalTextAlignment = TextAlignment.End, VerticalTextAlignment = TextAlignment.Center, HorizontalOptions = LayoutOptions.FillAndExpand
            };
            LastName_Label = new Label()
            {
                Text = "نام خانوادگی:  ", LineBreakMode = LineBreakMode.NoWrap, HorizontalTextAlignment = TextAlignment.End, VerticalTextAlignment = TextAlignment.Center, HorizontalOptions = LayoutOptions.FillAndExpand
            };
            LegalName_Label = new Label()
            {
                Text = "نام حقوقی:  ", LineBreakMode = LineBreakMode.NoWrap, HorizontalTextAlignment = TextAlignment.End, VerticalTextAlignment = TextAlignment.Center, HorizontalOptions = LayoutOptions.FillAndExpand
            };
            Phone1_Label = new Label()
            {
                Text = "تلفن 1:  ", LineBreakMode = LineBreakMode.NoWrap, HorizontalTextAlignment = TextAlignment.End, VerticalTextAlignment = TextAlignment.Center, HorizontalOptions = LayoutOptions.FillAndExpand
            };
            Phone2_Label = new Label()
            {
                Text = "تلفن 2:  ", LineBreakMode = LineBreakMode.NoWrap, HorizontalTextAlignment = TextAlignment.End, VerticalTextAlignment = TextAlignment.Center, HorizontalOptions = LayoutOptions.FillAndExpand
            };
            Cell_Label = new Label()
            {
                Text = "تلفن همراه:  ", LineBreakMode = LineBreakMode.NoWrap, HorizontalTextAlignment = TextAlignment.End, VerticalTextAlignment = TextAlignment.Center, HorizontalOptions = LayoutOptions.FillAndExpand
            };
            Fax_Label = new Label()
            {
                Text = "فکس:  ", LineBreakMode = LineBreakMode.NoWrap, HorizontalTextAlignment = TextAlignment.End, VerticalTextAlignment = TextAlignment.Center, HorizontalOptions = LayoutOptions.FillAndExpand
            };
            Address_Label = new Label()
            {
                Text = "آدرس:  ", LineBreakMode = LineBreakMode.NoWrap, HorizontalTextAlignment = TextAlignment.End, VerticalTextAlignment = TextAlignment.Center, HorizontalOptions = LayoutOptions.FillAndExpand
            };
            Credit_Label = new Label()
            {
                Text = "اعتبار:  ", LineBreakMode = LineBreakMode.NoWrap, HorizontalTextAlignment = TextAlignment.End, VerticalTextAlignment = TextAlignment.Center, HorizontalOptions = LayoutOptions.FillAndExpand
            };
            IsPartnerLegal_Label = new Label()
            {
                Text = "مشتری حقوقی است.", LineBreakMode = LineBreakMode.NoWrap, HorizontalTextAlignment = TextAlignment.End, VerticalTextAlignment = TextAlignment.Center, HorizontalOptions = LayoutOptions.EndAndExpand
            };
            CalculateVATForThisPerson_Label = new Label()
            {
                Text = "محاسبه مالیات ا.ا. برای این مشتری", LineBreakMode = LineBreakMode.NoWrap, HorizontalTextAlignment = TextAlignment.End, VerticalTextAlignment = TextAlignment.Center, HorizontalOptions = LayoutOptions.EndAndExpand
            };
            PartnerGroup_Label = new Label()
            {
                Text = "گروه مشتری:  ", LineBreakMode = LineBreakMode.NoWrap, HorizontalTextAlignment = TextAlignment.End, VerticalTextAlignment = TextAlignment.Start, HorizontalOptions = LayoutOptions.FillAndExpand
            };

            City = new RightRoundedLabel()
            {
                Text = "", HorizontalTextAlignment = TextAlignment.End, HorizontalOptions = LayoutOptions.FillAndExpand, VerticalOptions = LayoutOptions.FillAndExpand, FontSize = 18
            };
            CityPicker = new Picker()
            {
            };
            CityChangeButton = new LeftEntryCompanionLabel()
            {
                VerticalOptions = LayoutOptions.FillAndExpand, HorizontalOptions = LayoutOptions.FillAndExpand, HorizontalTextAlignment = TextAlignment.Center, FontSize = 18, Text = "..."
            };

            Zone = new RightRoundedLabel()
            {
                Text = "", HorizontalTextAlignment = TextAlignment.End, HorizontalOptions = LayoutOptions.FillAndExpand, VerticalOptions = LayoutOptions.FillAndExpand, FontSize = 18
            };
            ZonePicker = new Picker()
            {
            };
            ZoneChangeButton = new LeftEntryCompanionLabel()
            {
                VerticalOptions = LayoutOptions.FillAndExpand, HorizontalOptions = LayoutOptions.FillAndExpand, HorizontalTextAlignment = TextAlignment.Center, FontSize = 18, Text = "..."
            };

            Route = new RightRoundedLabel()
            {
                Text = "", HorizontalTextAlignment = TextAlignment.End, HorizontalOptions = LayoutOptions.FillAndExpand, VerticalOptions = LayoutOptions.FillAndExpand, FontSize = 18
            };
            RoutePicker = new Picker()
            {
            };
            RouteChangeButton = new LeftEntryCompanionLabel()
            {
                VerticalOptions = LayoutOptions.FillAndExpand, HorizontalOptions = LayoutOptions.FillAndExpand, HorizontalTextAlignment = TextAlignment.Center, FontSize = 18, Text = "..."
            };

            FillZones(EditingPartner != null ? EditingPartner.ZoneId : new Nullable <Guid>(), EditingPartner != null ? EditingPartner.Groups.Select(a => a.Id).ToArray() : new Guid[] { });

            FirstName = new MyEntry()
            {
                Text = EditingPartner != null ? EditingPartner.FirstName : "", HorizontalTextAlignment = TextAlignment.End, HorizontalOptions = LayoutOptions.FillAndExpand, RightRounded = true, LeftRounded = true, Padding = new Thickness(30, 10)
            };
            LastName = new MyEntry()
            {
                Text = EditingPartner != null ? EditingPartner.LastName : "", HorizontalTextAlignment = TextAlignment.End, HorizontalOptions = LayoutOptions.FillAndExpand, RightRounded = true, LeftRounded = true, Padding = new Thickness(30, 10)
            };
            LegalName = new MyEntry()
            {
                Text = EditingPartner != null ? EditingPartner.LegalName : "", HorizontalTextAlignment = TextAlignment.End, HorizontalOptions = LayoutOptions.FillAndExpand, RightRounded = true, LeftRounded = true, Padding = new Thickness(30, 10)
            };
            Phone1 = new MyEntry()
            {
                Text = EditingPartner != null ? EditingPartner.Phone1 : "", HorizontalTextAlignment = TextAlignment.End, HorizontalOptions = LayoutOptions.FillAndExpand, RightRounded = true, LeftRounded = true, Padding = new Thickness(30, 10), Keyboard = Keyboard.Telephone
            };
            Phone2 = new MyEntry()
            {
                Text = EditingPartner != null ? EditingPartner.Phone2 : "", HorizontalTextAlignment = TextAlignment.End, HorizontalOptions = LayoutOptions.FillAndExpand, RightRounded = true, LeftRounded = true, Padding = new Thickness(30, 10), Keyboard = Keyboard.Telephone
            };
            Cell = new MyEntry()
            {
                Text = EditingPartner != null ? EditingPartner.Mobile : "", HorizontalTextAlignment = TextAlignment.End, HorizontalOptions = LayoutOptions.FillAndExpand, RightRounded = true, LeftRounded = true, Padding = new Thickness(30, 10), Keyboard = Keyboard.Telephone
            };
            Fax = new MyEntry()
            {
                Text = EditingPartner != null ? EditingPartner.Fax : "", HorizontalTextAlignment = TextAlignment.End, HorizontalOptions = LayoutOptions.FillAndExpand, RightRounded = true, LeftRounded = true, Padding = new Thickness(30, 10), Keyboard = Keyboard.Telephone
            };
            Address = new PlaceholderEditor()
            {
                Text = EditingPartner != null ? EditingPartner.Address : "", HorizontalOptions = LayoutOptions.FillAndExpand, Padding = new Thickness(30, 10)
            };

            Credit = new RightRoundedLabel()
            {
                Text = "", HorizontalTextAlignment = TextAlignment.End, HorizontalOptions = LayoutOptions.FillAndExpand, VerticalOptions = LayoutOptions.FillAndExpand, FontSize = 18
            };
            CreditPicker = new Picker()
            {
            };
            CreditChangeButton = new LeftEntryCompanionLabel()
            {
                VerticalOptions = LayoutOptions.FillAndExpand, HorizontalOptions = LayoutOptions.FillAndExpand, HorizontalTextAlignment = TextAlignment.Center, FontSize = 18, Text = "..."
            };

            FillCredits(EditingPartner != null ? EditingPartner.CreditId : new Nullable <Guid>());

            IsPartnerLegal = new Switch()
            {
                IsToggled = EditingPartner != null ? EditingPartner.IsLegal : false, HorizontalOptions = LayoutOptions.End
            };
            CalculateVATForThisPerson = new Switch()
            {
                IsToggled = EditingPartner != null ? EditingPartner.CalculateVATForThisPerson : false, HorizontalOptions = LayoutOptions.End
            };

            ToolbarItem_LocalSave          = new ToolbarItem();
            ToolbarItem_LocalSave.Text     = "ذخیره محلی";
            ToolbarItem_LocalSave.Icon     = "Save.png";
            ToolbarItem_LocalSave.Clicked += SubmitPartnerToStorage;
            ToolbarItem_LocalSave.Order    = ToolbarItemOrder.Primary;
            ToolbarItem_LocalSave.Priority = 0;
            if (!JustShow)
            {
                this.ToolbarItems.Add(ToolbarItem_LocalSave);
            }

            ToolbarItem_SendToServer            = new ToolbarItem();
            ToolbarItem_SendToServer.Text       = "ذخیره محلی";
            ToolbarItem_SendToServer.Icon       = "Upload.png";
            ToolbarItem_SendToServer.Activated += SubmitPartnerToServer;
            ToolbarItem_SendToServer.Order      = ToolbarItemOrder.Primary;
            ToolbarItem_SendToServer.Priority   = 0;
            if (!JustShow)
            {
                this.ToolbarItems.Add(ToolbarItem_SendToServer);
            }

            BusyIndicatorContainder.BackgroundColor = Color.FromRgba(255, 255, 255, 70);
            BusyIndicator.Color = Color.FromRgba(80, 100, 150, 255);
        }