コード例 #1
0
 private void GetMedForMedEdit(object sender, object data)
 {
     currentMedPersonal = Data.MedPersonal.Get((int)data);
     Name         = currentMedPersonal.Name;
     Surname      = currentMedPersonal.Surname;
     Patronimic   = currentMedPersonal.Patronimic;
     nameOfButton = "К списку медперсонала";
 }
コード例 #2
0
        public ViewModelAddMedPersonal(NavigationController controller) : base(controller)
        {
            WidthOfBtn         = 200;
            VisibilityOfGoBAck = Visibility.Visible;
            MessageBus.Default.Subscribe("RefreshDataForMedpersonalForEditUser", RefreshDataForMedpersonalForEditUser);
            MessageBus.Default.Subscribe("RefreshDataForMedpersonalForAddUser", RefreshDataForMedpersonalForAddUser);
            MessageBus.Default.Subscribe("RefreshDataForMedpersonal", RefreshDataForMedpersonal);

            base.HasNavigation = true;

            TextHeader = "Добавление медперсонала";

            nameOfButton = "Добавить";

            SetAllFieldsDefault();
            ToDashboardCommand = new DelegateCommand(
                () =>
            {
                Name       = "";
                Surname    = "";
                Patronimic = "";
            }
                );
            GoToDoctorListCommand = new DelegateCommand(
                () =>
            {
                MessageBus.Default.Call("OpenMeds", this, "");
                Controller.NavigateTo <ViewModelViewMedPatient>();
            }
                );
            SaveAndGoDoctorListCommand = new DelegateCommand(
                () =>
            {
                if (TestRequiredFields())
                {
                    currentMedPersonal            = new MedPersonal();
                    currentMedPersonal.Name       = Name;
                    currentMedPersonal.Surname    = Surname;
                    currentMedPersonal.Patronimic = Patronimic;
                    currentMedPersonal.isEnabled  = true;
                    Data.MedPersonal.Add(currentMedPersonal);
                    Data.Complete();


                    MessageBus.Default.Call("OpenMeds", this, "");
                    Controller.NavigateTo <ViewModelViewMedPatient>();
                }
                else
                {
                    MessageBox.Show("Не все поля заполнены");
                }
            }
                );
        }
コード例 #3
0
        public ViewModelEditMedPersonal(NavigationController controller) : base(controller)
        {
            WidthOfBtn = 300;

            VisibilityOfGoBAck = Visibility.Collapsed;
            base.HasNavigation = true;
            MessageBus.Default.Subscribe("GetMedForMedEdit", GetMedForMedEdit);

            TextHeader = "Добавление медперсонала";

            nameOfButton = "К списку медперсонала";

            SetAllFieldsDefault();
            ToDashboardCommand = new DelegateCommand(
                () =>
            {
                Name         = currentMedPersonal.Name;
                Surname      = currentMedPersonal.Surname;
                Patronimic   = currentMedPersonal.Patronimic;
                nameOfButton = "К списку медперсонала";
            }
                );

            SaveAndGoDoctorListCommand = new DelegateCommand(
                () =>
            {
                if (TestRequiredFields())
                {
                    MedPersonal currentMedPersonalBuf = Data.MedPersonal.Get(currentMedPersonal.Id);
                    currentMedPersonalBuf.Name        = Name;
                    currentMedPersonalBuf.Surname     = Surname;
                    currentMedPersonalBuf.Patronimic  = Patronimic;
                    //currentMedPersonal.isEnabled = true;

                    Data.Complete();


                    MessageBus.Default.Call("OpenMeds", this, "");
                    Controller.NavigateTo <ViewModelViewMedPatient>();
                }
                else
                {
                    MessageBox.Show("Не все поля заполнены");
                }
            }
                );
            GoToDoctorListCommand = new DelegateCommand(
                () =>
            {
                MessageBus.Default.Call("OpenMeds", this, "");
                Controller.NavigateTo <ViewModelViewMedPatient>();
            }
                );
        }
コード例 #4
0
        private void RefreshDataForMedpersonal(object sender, object data)
        {
            Name = "";

            Surname = "";

            Patronimic = "";

            GoToDoctorListCommand = new DelegateCommand(
                () =>
            {
                MessageBus.Default.Call("OpenMeds", this, "");
                Controller.NavigateTo <ViewModelViewMedPatient>();
            }
                );
            SaveAndGoDoctorListCommand = new DelegateCommand(
                () =>
            {
                if (TestRequiredFields())
                {
                    currentMedPersonal            = new MedPersonal();
                    currentMedPersonal.Name       = Name;
                    currentMedPersonal.Surname    = Surname;
                    currentMedPersonal.Patronimic = Patronimic;
                    currentMedPersonal.isEnabled  = true;
                    Data.MedPersonal.Add(currentMedPersonal);
                    Data.Complete();


                    MessageBus.Default.Call("OpenMeds", this, "");
                    Controller.NavigateTo <ViewModelViewMedPatient>();
                }
                else
                {
                    MessageBox.Show("Не все поля заполнены");
                }
            }
                );
        }