public App()
        {
            var viewModel = new MyViewModel ();
            var view = new MyPage ();
            view.BindingContext = viewModel;

            MainPage = new NavigationPage(view);
        }
        public void Initialize(Placeholder control)
        {
            control.Width = 150;
            control.Height = 150;
            viewModel = new MyViewModel();

            control.DataContext = viewModel;
            control.SetBinding(UIElement.OpacityProperty, new Binding("Opacity"));
        }
예제 #3
0
        public void ViewModel_Initialized()
        {
            var vm = new MyViewModel();

            Assert.AreEqual(null, vm.StringProperty);
            Assert.AreEqual("initial value", vm.InitializedStringProperty);
            Assert.AreEqual(null, vm.ViewModelProperty);

            vm.ViewModelProperty = new MyViewModel { StringProperty = "inner vm" };
            Assert.AreEqual("inner vm", vm.ViewModelProperty.StringProperty);
        }
        public void StateShouldBeCreatedAfterCreatingViewModelInstance()
        {
            // Arrange
            var viewModel = new MyViewModel();

            // Act
            var state = viewModel.State;

            // Assert
            Assert.AreEqual(ViewModelState.Created, state);
        }
예제 #5
0
        public MainWindow()
        {
            InitializeComponent();
            model = this.Resources["MyViewModel"] as MyViewModel;

            ColumnSortDescriptor csd = new ColumnSortDescriptor()
            {
                Column = this.clubsGrid.Columns["StadiumCapacity"],
                SortDirection = ListSortDirection.Descending
            };
            this.clubsGrid.SortDescriptors.Add(csd);
            model.MySortingToolTip = "Descending Order";

        }
예제 #6
0
        public void ViewModel_Observed()
        {
            var propertyNames = new List<string>();
            var vm = new MyViewModel();
            vm.PropertyChanged += (sender, args) => propertyNames.Add(args.PropertyName);
            vm.ViewModelProperty = new MyViewModel { StringProperty = "inner vm" };

            Assert.AreEqual(1, propertyNames.Count(s => s == "ViewModelProperty"));
            Assert.AreEqual(0, propertyNames.Count(s => s == "StringProperty"));

            vm.ViewModelProperty.StringProperty = "new value";
            Assert.AreEqual(2, propertyNames.Count(s => s == "ViewModelProperty"));
            Assert.AreEqual(0, propertyNames.Count(s => s == "StringProperty"));
        }
예제 #7
0
 public MyPage()
 {
     this.InitializeComponent();
     ViewModel = new MyViewModel();
     this.SizeChanged += (s, e) =>
     {
         var state = "VisualState000";
         if (e.NewSize.Width > 000 && e.NewSize.Width < 850)
         {
             //if (CommunityListView.SelectedIndex != -1)
             //{
             //    SystemNavigationManager.GetForCurrentView().BackRequested += App_BackRequested;
             //    SystemNavigationManager.GetForCurrentView().AppViewBackButtonVisibility = AppViewBackButtonVisibility.Visible;
             //    HubSectionKBTitle.Text = CommunityContentTitleTextBlock.Text;
             //}
             if (MyFrame.Visibility == Visibility.Visible || aboutMeGrid.Visibility == Visibility.Visible || myTidingsGrid.Visibility == Visibility.Visible)
             {
                 //JWBackAppBarButton.Visibility = Visibility.Visible;
                 //SystemNavigationManager.GetForCurrentView().BackRequested += App_BackRequested;
                 SystemNavigationManager.GetForCurrentView().AppViewBackButtonVisibility = AppViewBackButtonVisibility.Visible;
                 //MyRefreshAppBarButton.Visibility = Visibility.Collapsed;
             }
         }
         if (!App.showpane)
         {
             MyTitleGrid.Margin = new Thickness(48, 0, 0, 0);
         }
         else
         {
             MyTitleGrid.Margin = new Thickness(0);
         }
         if (e.NewSize.Width > 800 && aboutMeGrid.Visibility == Visibility.Collapsed && myTidingsGrid.Visibility == Visibility.Collapsed)
         {
             SystemNavigationManager.GetForCurrentView().BackRequested -= App_BackRequested;
             SystemNavigationManager.GetForCurrentView().AppViewBackButtonVisibility = AppViewBackButtonVisibility.Collapsed;
             HubSectionKBTitle.Text = "个人中心";
             //MyRefreshAppBarButton.Visibility = Visibility.Visible;
             //CommunityMyAppBarButton.Visibility = Visibility.Visible;
             state = "VisualState800";
         }
         else if (e.NewSize.Width > 800)
         {
             HubSectionKBTitle.Text = "个人中心";
             state = "VisualState800";
         }
         VisualStateManager.GoToState(this, state, true);
         cutoffLine.Y2 = e.NewSize.Height;
     };
 }
예제 #8
0
 public MainWindow()
 {
     InitializeComponent();
     DataContext = new MyViewModel();
 }
예제 #9
0
        protected MyViewModel define(MyViewModel model)
        {
            List <Image> images = new List <Image>()
            {
                new Image
                {
                    Url  = "/Contents/Images/image1.jpg",
                    Alt  = "1070",
                    Name = "Kastamonu Castle"
                },
                new Image
                {
                    Url  = "/Contents/Images/image2.jpg",
                    Alt  = "1068",
                    Name = "Nasrullah Mosque"
                },
                new Image
                {
                    Url  = "/Contents/Images/image3.jpg",
                    Alt  = "1071",
                    Name = "Clock Tower"
                },
                new Image
                {
                    Url  = "/Contents/Images/image4.jpg",
                    Alt  = "1067",
                    Name = "Lovers Bridge"
                }
            };

            List <Town> towns = new List <Town>()
            {
                new Town
                {
                    Name       = "Araç",
                    Population = 5000,
                    Url        = "/Home/index"
                },
                new Town
                {
                    Name       = "Azdavay",
                    Population = 3000,
                    Url        = "/Home/index"
                },
                new Town
                {
                    Name       = "Abana",
                    Population = 2500,
                    Url        = "/Home/index"
                },
                new Town
                {
                    Name       = "Bozkurt",
                    Population = 2000,
                    Url        = "/Home/index"
                },
                new Town
                {
                    Name       = "Cide",
                    Population = 5300,
                    Url        = "/Home/index"
                },
                new Town
                {
                    Name       = "Çatalzeytin",
                    Population = 1800,
                    Url        = "/Home/index"
                },
                new Town
                {
                    Name       = "Devrekani",
                    Population = 2200,
                    Url        = "/Home/index"
                },
                new Town
                {
                    Name       = "Doğanyurt",
                    Population = 1000,
                    Url        = "/Home/index"
                },
                new Town
                {
                    Name       = "Hanönü",
                    Population = 1100,
                    Url        = "/Home/index"
                },
                new Town
                {
                    Name       = "İhsangazi",
                    Population = 1800,
                    Url        = "/Home/index"
                },
                new Town
                {
                    Name       = "İnebolu",
                    Population = 6000,
                    Url        = "/Home/index"
                },
                new Town
                {
                    Name       = "Tosya",
                    Population = 25000,
                    Url        = "/Home/tosya"
                }
            };

            model.SetImages(images);
            model.SetTowns(towns);
            return(model);
        }
예제 #10
0
 partial void HandleButtonAddSubView2TouchUpInside(NSObject sender)
 {
     MyViewModel.AddSubViewTwo();
 }
 public MainWindow()
 {
     InitializeComponent();
     ViewModel   = new MyViewModel();
     DataContext = ViewModel;
 }
예제 #12
0
 public CollectionScreen(MyViewModel vm)
 {
     InitializeComponent();
     this.DataContext = vm;
 }
예제 #13
0
        public void GESTVAE016()
        {
            MyViewModel VM = new MyViewModel(true);

            VM.AjouteCandidat();
            CandidatVM oCan = VM.CurrentCandidat;

            oCan.Nom = "TEST1";
            VM.saveData();

            VM         = new MyViewModel(true);
            VM.rechNom = "TEST1";
            VM.Recherche();
            VM.CurrentCandidat = VM.lstCandidatVM[0];
            VM.LockCurrentCandidat();

            // Avant Verrouillage => Ajout L2 impossible
            Assert.IsFalse(VM.AjouteL2Command.CanExecute(null));

            // Ajout du Livret1 Favorable Date de validité > Aujourd'hui
            VM.AjouteL1();
            Livret1VM oL1 = (Livret1VM)VM.CurrentCandidat.CurrentLivret;

            VM.CurrentCandidat.CurrentLivret.FTO_SetDecisionJuryL1Favorable();
            // Date de validé > Ajourd'hui
            VM.CurrentCandidat.CurrentLivret.DateValidite = DateTime.Now.AddDays(1);
            VM.ValideretQuitterL1();

            // Ajout d'un Livret2 (non complet)
            VM.AjouteL2();
            Livret2VM oL2 = (Livret2VM)VM.CurrentCandidat.CurrentLivret;

            VM.CurrentCandidat.CurrentLivret.DateValidite = DateTime.Now.AddDays(1);
            oL2.lstDCLivret[0].IsAValider = true;
            oL2.lstDCLivret[1].IsAValider = true;
            oL2.lstDCLivret[2].IsAValider = true;
            oL2.lstDCLivret[3].IsAValider = true;
            VM.ValideretQuitterL2();
            //Ajout de L2 impossible car L2 en cours
            Assert.IsTrue(VM.CurrentCandidat.ISL2EnCours);
            Assert.IsFalse(VM.AjouteL2Command.CanExecute(null));

            // Le L2 est Validé Partiellement => on peut Ajouter un L2
            VM.CurrentCandidat.CurrentLivret.FTO_SetDecisionJuryL2Partielle();
            oL2.lstDCLivret[0].Decision = oL2.DecisionL2ModuleFavorable;
            oL2.lstDCLivret[1].Decision = oL2.DecisionL2ModuleDeFavorable;
            oL2.lstDCLivret[2].Decision = oL2.DecisionL2ModuleDeFavorable;
            oL2.lstDCLivret[3].Decision = oL2.DecisionL2ModuleDeFavorable;

            Assert.IsTrue(VM.AjouteL2Command.CanExecute(null));

            // Même Si le Livret1 est echue
            oL1.DateValidite = DateTime.Now.AddDays(-1);
            Assert.IsTrue(VM.IsCurrentCandidatAddL2Available);
            Assert.IsTrue(VM.AjouteL2Command.CanExecute(null));

            // Et même Si on Lui ajoute un L2 Refusé
            VM.AjouteL2();
            Livret2VM oL2bis = (Livret2VM)VM.CurrentCandidat.CurrentLivret;

            VM.CurrentCandidat.CurrentLivret.FTO_SetDecisionJuryL2DeFavorable();
            oL2bis.DateValidite = DateTime.Now.AddDays(1);
            VM.ValideretQuitterL2();

            Assert.IsTrue(VM.AjouteL2Command.CanExecute(null));
        }//GestVAE016
 public ActionResult Index(MyViewModel model)
 {
     // ... model.SelectedType will contain the selected value (0 or 1)
 }
 public MyViewModel get_my_view_model(MyViewModel input)
 {
     return input;
 }
예제 #16
0
 public MyWindow()
 {
     InitializeComponent();
     DataContext = new MyViewModel();
 }
 public MainPage()
 {
     InitializeComponent();
     myViewModel    = new MyViewModel();
     BindingContext = myViewModel;
 }
예제 #18
0
 public PractitionerRegistrationRepository(BaseConfiguration baseConfiguration, MyViewModel myViewModel)
     : base(baseConfiguration, myViewModel)
 {
     PractitionerRegistrationWebService = new PractitionerRegister.WebServices();
 }
 public string TestAction(MyViewModel model)
 {
     return("test");
 }
예제 #20
0
        public void TestStattusDCCand()
        {
            DiplomeCandVM oDiplome = null;
            MyViewModel   VM       = new MyViewModel();

            VM.IsInTest = true;
            VM.getData();

            VM.AddCandidatCommand.Execute(null);
            CandidatVM oCand = VM.CurrentCandidat;

            oCand.Nom = "TESTCAND";
            VM.AjouteL1();
            Livret1VM oL1 = (Livret1VM)VM.CurrentCandidat.CurrentLivret;

            oL1.Numero               = "TESTL1";
            oL1.DateJury             = new DateTime(2019, 04, 12);
            oL1.DateNotificationJury = new DateTime(2019, 04, 13, 0, 0, 0);
            oL1.DateEnvoiL2          = new DateTime(2019, 06, 13, 0, 0, 0);
            VM.CurrentCandidat.CurrentLivret.FTO_SetDecisionJuryL1Favorable();
            VM.ValideretQuitterL1();
            VM.saveData();
            VM.getData();
            Assert.IsTrue(VM.SetCurrentCandidat("TESTCAND"));
            VM.CurrentCandidat.CurrentLivret = VM.CurrentCandidat.lstLivrets[0];
            Assert.AreEqual("TESTL1", VM.CurrentCandidat.CurrentLivret.Numero);

            // Création du L2 Premier passage
            VM.CloturerL1etCreerL2();
            // le diplome du candidat passe à encours
            oDiplome = VM.CurrentCandidat.lstDiplomesCandVMs[0];
            Assert.AreEqual("En cours", oDiplome.StatutDiplome);
            Assert.AreEqual("", oDiplome.lstDCCands[0].Statut);
            Assert.AreEqual("", oDiplome.lstDCCands[1].Statut);
            Assert.AreEqual("", oDiplome.lstDCCands[2].Statut);
            Assert.AreEqual("", oDiplome.lstDCCands[3].Statut);

            Livret2VM oLiv = (Livret2VM)VM.CurrentCandidat.CurrentLivret;

            oLiv.lstDCLivret[0].IsAValider = true;
            oLiv.lstDCLivret[1].IsAValider = true;
            oLiv.lstDCLivret[2].IsAValider = false;
            oLiv.lstDCLivret[3].IsAValider = false;
            VM.ValideretQuitterL2();
            // Le diplome est en cours
            // les DC1 et DC2 sont encours, DC3 et DC4 non renseigné
            oDiplome = VM.CurrentCandidat.lstDiplomesCandVMs[0];
            Assert.AreEqual("En cours", oDiplome.StatutDiplome);
            Assert.AreEqual("En cours", oDiplome.lstDCCands[0].Statut);
            Assert.AreEqual("En cours", oDiplome.lstDCCands[1].Statut);
            Assert.AreEqual("", oDiplome.lstDCCands[2].Statut);
            Assert.AreEqual("", oDiplome.lstDCCands[3].Statut);

            //// DECISION PARTIELLE ////
            oLiv.FTO_SetDecisionJuryL2Partielle();
            oLiv.DateJury = new DateTime(2019, 08, 02);
            oLiv.lstDCLivret[0].Decision = String.Format("{0:D}-Validation", MyEnums.DecisionJuryL2.DECISION_L2_FAVORABLE);
            oLiv.lstDCLivret[1].Decision = String.Format("{0:D}-Refus de Validation", MyEnums.DecisionJuryL2.DECISION_L2_DEFAVORABLE);
            VM.ValideretQuitterL2();

            // Le diplome passe en Validé patiellement
            // DC1 = Validé, DC2 = Refusé
            oDiplome = VM.CurrentCandidat.lstDiplomesCandVMs[0];
            Assert.AreEqual("Validé Partiellement", oDiplome.StatutDiplome);
            Assert.AreEqual("Validé", oDiplome.lstDCCands[0].Statut);
            Assert.AreEqual(new DateTime(2019, 08, 02), oDiplome.lstDCCands[0].DateObtention);
            Assert.AreEqual("Refusé", oDiplome.lstDCCands[1].Statut);
            Assert.AreEqual("", oDiplome.lstDCCands[2].Statut);
            Assert.AreEqual("", oDiplome.lstDCCands[3].Statut);

            // 2nd passage
            //============
            VM.AjouteL2();
            oLiv = (Livret2VM)VM.CurrentCandidat.CurrentLivret;
            oLiv.lstDCLivret[0].IsAValider = false;
            oLiv.lstDCLivret[1].IsAValider = true;
            oLiv.lstDCLivret[2].IsAValider = true;
            oLiv.lstDCLivret[3].IsAValider = true;
            VM.ValideretQuitterL2();
            Assert.AreEqual("Validé Partiellement", oDiplome.StatutDiplome);
            Assert.AreEqual("Validé", oDiplome.lstDCCands[0].Statut);
            Assert.AreEqual("En cours", oDiplome.lstDCCands[1].Statut);
            Assert.AreEqual("En cours", oDiplome.lstDCCands[2].Statut);
            Assert.AreEqual("En cours", oDiplome.lstDCCands[3].Statut);

            //// DECISION PARTIELLE ////
            oLiv.FTO_SetDecisionJuryL2Partielle(new DateTime(2019, 08, 03));
            oLiv.lstDCLivret[1].Decision = String.Format("{0:D}-Validation", MyEnums.DecisionJuryL2.DECISION_L2_FAVORABLE);
            oLiv.lstDCLivret[2].Decision = String.Format("{0:D}-Validation", MyEnums.DecisionJuryL2.DECISION_L2_FAVORABLE);
            oLiv.lstDCLivret[3].Decision = String.Format("{0:D}-Refus de Validation", MyEnums.DecisionJuryL2.DECISION_L2_DEFAVORABLE);
            VM.ValideretQuitterL2();

            Assert.AreEqual("Validé Partiellement", oDiplome.StatutDiplome);
            Assert.AreEqual("Validé", oDiplome.lstDCCands[0].Statut);
            Assert.AreEqual(new DateTime(2019, 08, 02), oDiplome.lstDCCands[0].DateObtention);
            Assert.AreEqual("Validé", oDiplome.lstDCCands[1].Statut);
            Assert.AreEqual(new DateTime(2019, 08, 03), oDiplome.lstDCCands[1].DateObtention);
            Assert.AreEqual("Validé", oDiplome.lstDCCands[2].Statut);
            Assert.AreEqual(new DateTime(2019, 08, 03), oDiplome.lstDCCands[2].DateObtention);
            Assert.AreEqual("Refusé", oDiplome.lstDCCands[3].Statut);

            // 3eme passage
            //============
            VM.AjouteL2();
            oLiv = (Livret2VM)VM.CurrentCandidat.CurrentLivret;
            oLiv.lstDCLivret[0].IsAValider = false;
            oLiv.lstDCLivret[1].IsAValider = false;
            oLiv.lstDCLivret[2].IsAValider = false;
            oLiv.lstDCLivret[3].IsAValider = true;
            VM.ValideretQuitterL2();
            Assert.AreEqual("Validé Partiellement", oDiplome.StatutDiplome);
            Assert.AreEqual("Validé", oDiplome.lstDCCands[0].Statut);
            Assert.AreEqual("Validé", oDiplome.lstDCCands[1].Statut);
            Assert.AreEqual("Validé", oDiplome.lstDCCands[2].Statut);
            Assert.AreEqual("En cours", oDiplome.lstDCCands[3].Statut);

            //// DECISION PARTIELLE ////
            oLiv.FTO_SetDecisionJuryL2Favorable(new DateTime(2019, 08, 04), pMAJ_DC_AValider: false);
            VM.ValideretQuitterL2();

            Assert.AreEqual("Validé", oDiplome.StatutDiplome);
            Assert.AreEqual("Validé", oDiplome.lstDCCands[0].Statut);
            Assert.AreEqual(new DateTime(2019, 08, 02), oDiplome.lstDCCands[0].DateObtention);
            Assert.AreEqual("Validé", oDiplome.lstDCCands[1].Statut);
            Assert.AreEqual(new DateTime(2019, 08, 03), oDiplome.lstDCCands[1].DateObtention);
            Assert.AreEqual("Validé", oDiplome.lstDCCands[2].Statut);
            Assert.AreEqual(new DateTime(2019, 08, 03), oDiplome.lstDCCands[2].DateObtention);
            Assert.AreEqual("Validé", oDiplome.lstDCCands[3].Statut);
            Assert.AreEqual(new DateTime(2019, 08, 04), oDiplome.lstDCCands[3].DateObtention);
            VM.LockCurrentCandidat();
            VM.DeleteCurrentCandidat();
            VM.saveData();
        }
예제 #21
0
		public void DataContextChangedShouldFireWhenSettingContentAfterLoadedWithThemedControl()
		{
			int dataContextChanged = 0;
			int contentDataContextChanged = 0;
			MyViewModel dataContext = null;
			Shown(form =>
			{
				form.DataContextChanged += (sender, e) => dataContextChanged++;
				form.DataContext = dataContext = new MyViewModel();
				Assert.AreEqual(1, dataContextChanged);
				Assert.AreSame(dataContext, form.DataContext);
				return form;
			}, form =>
			{
				var c = new Panel();
				c.DataContextChanged += (sender, e) => contentDataContextChanged++;
				form.Content = new CustomExpander { Content = c };
				Assert.AreEqual(1, contentDataContextChanged);
				Assert.AreEqual(1, dataContextChanged);
				Assert.AreSame(dataContext, c.DataContext);
				Assert.AreSame(dataContext, form.DataContext);

				form.DataContext = dataContext = new MyViewModel();
				Assert.AreEqual(2, contentDataContextChanged);
				Assert.AreEqual(2, dataContextChanged);
				Assert.AreSame(dataContext, c.DataContext);
				Assert.AreSame(dataContext, form.DataContext);
			});
		}
    public ActionResult Index()
    {
        var model = new MyViewModel();

        return(View(model));
    }
예제 #23
0
		public void DataContextChangeShouldFireForControlInTableLayout()
		{
			int dataContextChanged = 0;
			MyViewModel dataContext = null;
			Panel c = null;
			Shown(form =>
			{
				c = new Panel();
				c.DataContextChanged += (sender, e) => dataContextChanged++;

				form.Content = new TableLayout
				{
					Rows = { c }
				};
				form.DataContext = dataContext = new MyViewModel();
				Assert.AreEqual(1, dataContextChanged);
				Assert.IsNotNull(c.DataContext);
				Assert.AreSame(dataContext, c.DataContext);
				Assert.AreSame(dataContext, form.DataContext);
				return form;
			}, form =>
			{
				Assert.AreEqual(1, dataContextChanged);
				Assert.IsNotNull(c.DataContext);
				Assert.AreSame(dataContext, c.DataContext);
				Assert.AreSame(dataContext, form.DataContext);
			});
		}
 public ActionResult Index(MyViewModel model)
 {
     return(View(model));
 }
 public MyModalPage()
 {
     InitializeComponent();
     Title          = "My Modal Fun";
     BindingContext = new MyViewModel();
 }
예제 #26
0
 public MainWindow(MyViewModel vm)
 {
     InitializeComponent();
     _viewModel  = vm;
     DataContext = _viewModel;
 }
 public AddAssignmentWindow(MyViewModel vm)
 {
     InitializeComponent();
     this.vm = vm;
 }
예제 #28
0
        public void TestDecisionL2Favorable()
        {
            DiplomeCandVM oDiplome = null;
            MyViewModel   VM       = new MyViewModel();

            VM.IsInTest = true;
            VM.getData();

            VM.AddCandidatCommand.Execute(null);
            CandidatVM oCand = VM.CurrentCandidat;

            oCand.Nom = "TESTCAND";
            VM.AjouteL1();
            Livret1VM oL1 = (Livret1VM)VM.CurrentCandidat.CurrentLivret;

            oL1.Numero               = "TESTL1";
            oL1.DateJury             = new DateTime(2019, 04, 12);
            oL1.DateNotificationJury = new DateTime(2019, 04, 13, 0, 0, 0);
            oL1.DateEnvoiL2          = new DateTime(2019, 06, 13, 0, 0, 0);
            VM.CurrentCandidat.CurrentLivret.FTO_SetDecisionJuryL1Favorable();
            VM.ValideretQuitterL1();
            VM.saveData();
            VM.getData();
            Assert.IsTrue(VM.SetCurrentCandidat("TESTCAND"));
            VM.CurrentCandidat.CurrentLivret = VM.CurrentCandidat.lstLivrets[0];
            Assert.AreEqual("TESTL1", VM.CurrentCandidat.CurrentLivret.Numero);

            // Création du L2 Premier passage
            VM.CloturerL1etCreerL2();
            // le diplome du candidat passe à encours
            oDiplome = VM.CurrentCandidat.lstDiplomesCandVMs[0];
            Assert.AreEqual("En cours", oDiplome.StatutDiplome);
            Assert.AreEqual("", oDiplome.lstDCCands[0].Statut);
            Assert.AreEqual("", oDiplome.lstDCCands[1].Statut);
            Assert.AreEqual("", oDiplome.lstDCCands[2].Statut);
            Assert.AreEqual("", oDiplome.lstDCCands[3].Statut);

            Livret2VM oLiv = (Livret2VM)VM.CurrentCandidat.CurrentLivret;

            oLiv.lstDCLivret[0].IsAValider = true;
            oLiv.lstDCLivret[1].IsAValider = true;
            oLiv.lstDCLivret[2].IsAValider = false;
            oLiv.lstDCLivret[3].IsAValider = false;
            VM.ValideretQuitterL2();
            // Le diplome est en cours
            // les DC1 et DC2 sont encours, DC3 et DC4 non renseigné
            oDiplome = VM.CurrentCandidat.lstDiplomesCandVMs[0];
            Assert.AreEqual("En cours", oDiplome.StatutDiplome);
            Assert.AreEqual("En cours", oDiplome.lstDCCands[0].Statut);
            Assert.AreEqual("En cours", oDiplome.lstDCCands[1].Statut);
            Assert.AreEqual("", oDiplome.lstDCCands[2].Statut);
            Assert.AreEqual("", oDiplome.lstDCCands[3].Statut);

            //// DECISION FAVORABLE => uniquement sur les DC AValider ////
            oLiv.FTO_SetDecisionJuryL2Favorable(pCreateAllDC: false);
            VM.ValideretQuitterL2();

            // Le diplome passe en Validé partiellement
            // DC1 = Validé, DC2 = Refusé
            oDiplome = VM.CurrentCandidat.lstDiplomesCandVMs[0];
            Assert.AreEqual("Validé Partiellement", oDiplome.StatutDiplome);
            Assert.AreEqual("Validé", oDiplome.lstDCCands[0].Statut);
            Assert.AreEqual("Validé", oDiplome.lstDCCands[1].Statut);
            Assert.AreEqual("", oDiplome.lstDCCands[2].Statut);
            Assert.AreEqual("", oDiplome.lstDCCands[3].Statut);

            VM.LockCurrentCandidat();
            VM.DeleteCurrentCandidat();
            VM.saveData();
        }
 public MainWindow()
 {
     ViewModel = new MyViewModel();
     InitializeComponent();
 }
예제 #30
0
        public ActionResult AddCustomerXE1(int type)
        {
            using (CamdoAnhTuEntities1 dbcontext = new CamdoAnhTuEntities1())
            {
                ViewBag.ListLoaiGiayTo = new SelectList(
                    new List <SelectListItem>
                {
                    new SelectListItem {
                        Text = "Giấy tờ chính chủ", Value = "1"
                    },
                    new SelectListItem {
                        Text = "Giấy tờ photo", Value = "2"
                    },
                    new SelectListItem {
                        Text = "Không có giấy tờ", Value = "3"
                    }
                }, "Value", "Text");
                MyViewModel mvViewModel = new MyViewModel();
                mvViewModel.model.type = type;

                int newId = 0;
                int id    = 0;

                var lstType = dbcontext.Customers.Where(p => p.type == type).ToList();
                if (lstType.Count <= 0)
                {
                    newId = 1;
                }
                else
                {
                    id    = lstType.Count;
                    newId = id + 1;
                }
                string temp = "";
                switch (type)
                {
                case 12:
                    temp = "BD" + newId;
                    break;

                case 13:
                    temp = "CD" + newId;
                    break;

                case 14:
                    temp = "MD" + newId;
                    break;

                case 15:
                    temp = "ZD" + newId;
                    break;

                case 16:
                    temp = "YD" + newId;
                    break;

                case 17:
                    temp = "TD" + newId;
                    break;

                default:
                    break;
                }

                mvViewModel.model.Code = temp.Trim();
                return(View(mvViewModel));
            }
        }
예제 #31
0
        public MyView()
        {
            InitializeComponent();

            viewModel = new MyViewModel(this);
        }
예제 #32
0
        public ActionResult UpdateXE1(MyViewModel myViewModel)
        {
            using (CamdoAnhTuEntities1 dbcontext = new CamdoAnhTuEntities1())
            {
                var model = myViewModel.model;

                if (model.DayBonus == null)
                {
                    model.DayBonus = 0;
                }

                Customer pro = dbcontext.Customers.Where(p => p.Code == model.Code).FirstOrDefault();
                pro.Name       = model.Name;
                pro.Phone      = model.Phone;
                pro.Address    = model.Address;
                pro.Note       = model.Note;
                pro.tentaisan  = model.tentaisan;
                pro.loaigiayto = myViewModel.SelectedLoaiGiayTo;
                pro.Price      = myViewModel.model.Price;

                if (pro.StartDate != model.StartDate)
                {
                    List <Loan> lstLoan = new List <Loan>();
                    pro.StartDate = model.StartDate;

                    List <Loan> lstTong       = dbcontext.Loans.Where(p => p.IDCus == model.ID).ToList();
                    List <Loan> lstLoandadong = dbcontext.Loans.Where(p => p.IDCus == model.ID && p.Status == 1).ToList();
                    int         sldadong      = lstLoandadong.Count;

                    foreach (var item in lstTong)
                    {
                        dbcontext.Loans.Remove(item);
                    }

                    int      day = model.songayno.HasValue ? (int)model.songayno : 1;
                    DateTime k   = model.StartDate;

                    for (int i = 1; i <= 60; i++)
                    {
                        Loan temp = new Loan();
                        temp.Date   = k.AddDays(i);
                        temp.IDCus  = model.ID;
                        temp.Status = 0;
                        dbcontext.Loans.Add(temp);

                        k = temp.Date;
                        lstLoan.Add(temp);
                    }

                    for (int i = 0; i < sldadong; i++)
                    {
                        var temp = lstLoan.ElementAt(i);
                        temp.Status = 1;
                    }

                    dbcontext.SaveChanges();
                    ViewData["Loans"] = lstLoan;
                }

                dbcontext.SaveChanges();


                if (myViewModel.fuMain != null && myViewModel.fuMain.ContentLength > 0)
                {
                    string spDirPath     = Server.MapPath("~/image");
                    string targetDirPath = Path.Combine(spDirPath, myViewModel.model.Code.ToString());
                    Directory.CreateDirectory(targetDirPath);

                    string mainFileName = Path.Combine(targetDirPath, "main.jpg");
                    //myViewModel.fuMain.SaveAs(mainFileName);

                    Image bm = Image.FromStream(myViewModel.fuMain.InputStream);
                    bm = Helper.Helper.ResizeBitmap((Bitmap)bm, 160, 160);
                    bm.Save(Path.Combine(targetDirPath, "main.jpg"));
                }

                return(RedirectToAction("LoadCustomerXE1", "XE1", new { type = myViewModel.model.type }));
            }
        }
예제 #33
0
 // Do NOT remove this handler even if ReSharper cannot find it's usage. It is referred in BarCell.designer.cs file by its name. That's how Xamarin is linking the event on the button.
 partial void HandleButtonAddBarCellTouchUpInside(NSObject sender)
 {
     MyViewModel.AddBarCell();
 }
예제 #34
0
 public MyViewModelWithConstructorDependencies(MyViewModel argument1, MyViewModel argument2)
 {
     ConstructorArgument1 = argument1;
     ConstructorArgument2 = argument2;
 }
예제 #35
0
 protected override void Init()
 {
     BindingContext = new MyViewModel();
 }
예제 #36
0
		public void DataContextChangedShouldFireForThemedControl()
		{
			int dataContextChanged = 0;
			MyViewModel dataContext = null;
			Panel c = null;
			Shown(form =>
			{
				c = new Panel();
				c.DataContextChanged += (sender, e) => dataContextChanged++;
				form.Content = new CustomExpander { Content = c };
				form.DataContext = dataContext = new MyViewModel();
				Assert.AreEqual(1, dataContextChanged);
				Assert.IsInstanceOf<MyViewModel>(c.DataContext);
				Assert.IsInstanceOf<MyViewModel>(form.DataContext);
				Assert.AreSame(dataContext, c.DataContext);
				Assert.AreSame(dataContext, form.DataContext);
				Assert.AreSame(dataContext, form.Content.DataContext);
				return form;
			}, form =>
			{
				Assert.AreEqual(1, dataContextChanged);
				Assert.IsInstanceOf<MyViewModel>(c?.DataContext);
				Assert.IsInstanceOf<MyViewModel>(form.DataContext);
				Assert.AreSame(dataContext, c.DataContext);
				Assert.AreSame(dataContext, form.DataContext);
				Assert.AreSame(dataContext, form.Content.DataContext);
			});
		}
예제 #37
0
 public SignInC(MyViewModel vm)
 {
     InitializeComponent();
     this.vm = vm;
 }
 public MySecondPage()
 {
     InitializeComponent();
     Title          = "The Second page";
     BindingContext = new MyViewModel();
 }
예제 #39
0
        public void ObjectWithNonDefaultConstructorShouldHaveItsArgumentsForwardedFromProxy()
        {
            DispatcherManager.Current = new Dispatcher();
            var weaver = new NotifyingObjectWeaver();
            var type = weaver.GetProxyType<MyViewModelWithConstructorDependencies>();

            var argument1 = new MyViewModel();
            var argument2 = new MyViewModel();

            var instance = Activator.CreateInstance(type, argument1, argument2) as MyViewModelWithConstructorDependencies;

            Assert.That(instance.ConstructorArgument1, Is.Not.Null);
            Assert.That(instance.ConstructorArgument1, Is.EqualTo(argument1));
            Assert.That(instance.ConstructorArgument2, Is.Not.Null);
            Assert.That(instance.ConstructorArgument2, Is.EqualTo(argument2));
        }
예제 #40
0
 public EditPage()
 {
     this.InitializeComponent();
     DataContext = MyViewModel.I();
 }
예제 #41
0
		public void DataContextChangedShouldFireAfterSet()
		{
			int dataContextChanged = 0;
			MyViewModel dataContext;
			Shown(form =>
			{
				var c = new Panel();
				c.DataContextChanged += (sender, e) => dataContextChanged++;
				c.DataContext = dataContext = new MyViewModel();
				Assert.AreEqual(1, dataContextChanged);
				Assert.IsInstanceOf<MyViewModel>(c.DataContext);
				Assert.AreSame(dataContext, c.DataContext);

				c.DataContext = dataContext = new MyViewModel();
				Assert.AreEqual(2, dataContextChanged);
				Assert.IsInstanceOf<MyViewModel>(c.DataContext);
				Assert.AreSame(dataContext, c.DataContext);

				form.Content = c;
				Assert.AreEqual(2, dataContextChanged);
			}, () =>
			{
				Assert.AreEqual(2, dataContextChanged);
			});
		}
 public ClientAppointmentsRepository(BaseConfiguration baseConfiguration, MyViewModel myViewModel)
     : base(baseConfiguration, myViewModel)
 {
 }
예제 #43
0
		public void DataContextChangedShouldFireWhenSettingContentAfterLoaded()
		{
			int dataContextChanged = 0;
			int contentDataContextChanged = 0;
			MyViewModel dataContext = null;
			Shown(form =>
			{
				form.DataContextChanged += (sender, e) => dataContextChanged++;
				form.DataContext = dataContext = new MyViewModel();
				Assert.AreEqual(1, dataContextChanged);
				Assert.IsInstanceOf<MyViewModel>(form.DataContext);
				Assert.AreSame(dataContext, form.DataContext);
				return form;
			}, form =>
			{
				var c = new Panel();
				c.DataContextChanged += (sender, e) => contentDataContextChanged++;
				form.Content = c;
				Assert.AreEqual(1, contentDataContextChanged);
				Assert.AreEqual(1, dataContextChanged);
				Assert.IsInstanceOf<MyViewModel>(c.DataContext);
				Assert.IsInstanceOf<MyViewModel>(form.DataContext);
				Assert.AreSame(dataContext, c.DataContext);
				Assert.AreSame(dataContext, form.DataContext);

				form.DataContext = dataContext = new MyViewModel();
				Assert.AreEqual(2, contentDataContextChanged);
				Assert.AreEqual(2, dataContextChanged);
				Assert.AreSame(dataContext, c.DataContext);
				Assert.AreSame(dataContext, form.DataContext);
			});
		}
예제 #44
0
 public Login(MyViewModel vm)
 {
     InitializeComponent();
     this.vm = vm;
 }
예제 #45
0
		public void DataContextChangedShouldFireForChildWithCustomModel()
		{
			int dataContextChanged = 0;
			int childDataContextChanged = 0;
			MyViewModel dataContext;
			MyViewModel childDataContext;
			Shown(form =>
			{
				var container = new Panel();
				container.DataContextChanged += (sender, e) => dataContextChanged++;
				container.DataContext = dataContext = new MyViewModel();
				Assert.AreEqual(1, dataContextChanged);
				Assert.AreSame(dataContext, container.DataContext);

				var child = new Panel();
				child.DataContextChanged += (sender, e) => childDataContextChanged++;
				child.DataContext = childDataContext = new MyViewModel();
				container.Content = child;
				form.Content = container;

				Assert.AreEqual(1, childDataContextChanged);
				Assert.AreSame(dataContext, container.DataContext);
				Assert.AreSame(childDataContext, child.DataContext);
			}, () =>
			{
				Assert.AreEqual(1, dataContextChanged);
				Assert.AreEqual(1, childDataContextChanged);
			});
		}
예제 #46
0
 public ActionResult Index(MyViewModel model)
 {
     // TODO: Do something with model.SelectedValue
     return(RedirectToAction("index"));
 }
예제 #47
0
        static void DocumentReady()
        {                                                                                        
           Knockout.BindingHandlers["page-accordion-item"] = (dynamic) new PageAccordionItemBindingHandler();                                          

           MyViewModel mod = new MyViewModel();

           // if using History.js
           //Pager.UseHTML5history = true;
           //Pager.UseHistoryJsInHref5();

           Pager.ExtendWithPage(mod);                    

           Knockout.ApplyBindings(mod);
           
           // if using History.js
           //Pager.StartHistoryJs();

           // if using HashChange
           //Pager.StartHashChange();

           // if using HTML5 native history
           Pager.Start();                     
        }            
 private void Window_Loaded(object sender, RoutedEventArgs e)
 {
     vm          = new MyViewModel();
     DataContext = vm;
 }