コード例 #1
0
		private void btnSave_Click(object sender, RoutedEventArgs e)
		{
			if(this.gPVM.PersonViewModel.IsModified == true)
			{
				using (var logic = new PersonalLogic())
				{
					try
					{
						if (this.gPVM.PersonViewModel.id_person != 0)
						{
							logic.UpdatePerson(this.gPVM.PersonViewModel);
						}
						else
						{
							logic.AddPerson(this.gPVM.PersonViewModel);
						}
						this.gPVM.PersonViewModel.IsModified = false;
					}
					catch(Zora.Core.Exceptions.ZoraException ex)
					{
						MessageBox.Show(ex.Result.Message);
					}
					catch(Exception ex)
					{
						MessageBox.Show(ex.Message);
					}
				}
			}
		}
コード例 #2
0
		private void RefreshGrid()
		{
			List<PersonnelViewModel> lstPersonnel = new List<PersonnelViewModel>();
			using (var plogic = new PersonalLogic())
			{
				lstPersonnel = plogic.GetPersonnel(this.chkShowInactive.IsChecked == true);
				this.grGridView.ItemsSource = lstPersonnel;
			}
		}
コード例 #3
0
		public PersonFolder(int id_person)
		{
			InitializeComponent();

			if(id_person != 0)
			{
				using (var logic = new PersonalLogic())
				{
					this.gPVM = logic.InitGPVM(id_person);
				}
			}
			else
			{
				this.gPVM = new GenericPersonViewModel();
				this.gPVM.PersonViewModel = new PersonViewModel();				
			}
			this.DataContext = this.gPVM;
		}