예제 #1
0
        public void CheckWorkersRelashions()
        {
            // Arrange   -------------------------------------
            DbService.LoadSample();

            // Act   -----------------------------------------
            DbService.LoadAll();

            // Assert-----------------------------------------
            var worker = WorkerData.GetWorker("Celivans", "irina", "vasileva");

            Assert.AreEqual("202", worker.Room.Name);
        }
예제 #2
0
        public WorkerDetailPage(string[] words) : this()
        {
            StackLayout stackLayout = new StackLayout();

            stackLayout.Margin = 20;

            if (words.Length == 2)
            {
                Current = WorkerData.GetWorker(words[0], words[1]);
            }
            else
            {
                Current = WorkerData.GetWorker(words[0], words[1], words[2]);
            }

            Title = Current.FirstName + " " + Current.SecondName;
            Color backcolor = Color.FromHex("#FAFAFA");

            if (Current != null)
            {
                Label FIOlab = new Label
                {
                    Text              = Current.FirstName + " " + Current.SecondName + " " + Current.LastName,
                    TextColor         = Color.Black,
                    Style             = Device.Styles.TitleStyle,
                    HorizontalOptions = LayoutOptions.Center
                };
                stackLayout.Children.Add(FIOlab);
            }
            if (Current.Status != null)
            {
                Label Statuslab = new Label
                {
                    Text              = Current.Status,
                    TextColor         = Color.Black,
                    Style             = Device.Styles.BodyStyle,
                    HorizontalOptions = LayoutOptions.Center
                };
                stackLayout.Children.Add(Statuslab);
            }
            if (Current.Details != null)
            {
                Label Detailslab = new Label
                {
                    Text              = Current.Details,
                    TextColor         = Color.Black,
                    Style             = Device.Styles.BodyStyle,
                    HorizontalOptions = LayoutOptions.Fill
                };
                stackLayout.Children.Add(Detailslab);
            }
            if (Current.Email != null)
            {
                Button Emailbut = new Button
                {
                    Text            = "Написать " + Current.Email,
                    TextColor       = Color.Black,
                    BackgroundColor = backcolor,
                    VerticalOptions = LayoutOptions.Center,
                    Style           = Device.Styles.BodyStyle,
                    FontSize        = 12,
                    HeightRequest   = 40,
                };
                Emailbut.Clicked += clickmail;
                stackLayout.Children.Add(Emailbut);
            }
            if (Current.Phone != null)
            {
                Button Phonebut = new Button
                {
                    Text            = "Позвонить " + Current.Phone,
                    TextColor       = Color.Black,
                    BackgroundColor = backcolor,
                    VerticalOptions = LayoutOptions.Center,
                    Style           = Device.Styles.BodyStyle,
                    FontSize        = 12,
                    HeightRequest   = 40,
                };
                Phonebut.Clicked += clickphone;
                stackLayout.Children.Add(Phonebut);
            }
            if (Current.Site != null)
            {
                Button Sitebut = new Button
                {
                    Text            = "Открыть сайт",
                    TextColor       = Color.Black,
                    BackgroundColor = backcolor,
                    VerticalOptions = LayoutOptions.Center,
                    Style           = Device.Styles.BodyStyle,
                    FontSize        = 12,
                    HeightRequest   = 40,
                };
                Sitebut.Clicked += clickSite;
                stackLayout.Children.Add(Sitebut);
            }

            this.Content = new ScrollView {
                Content = stackLayout
            };
        }