private void IsItChecked(object dataElement, object isSelected)
        {
            string isS = isSelected.ToString();
            DiagnosisDataSource data = dataElement as DiagnosisDataSource;
            bool test = true;

            if (isS == "true")
            {
                foreach (var item in Sequence)
                {
                    if (item == data.Data.Id)
                    {
                        test = false;
                    }
                }
                if (test)
                {
                    Sequence.Add(data.Data.Id);
                }
            }
            else
            {
                Sequence.Remove(data.Data.Id);
            }
        }
        private void GetOperation(object sender, object data)
        {
            Operation = Data.Operation.Get((int)data);



            //DateTime bufTime = DateTime.Parse(Operation.Time);

            //Operation.Date = new DateTime(Operation.Date.Year, Operation.Date.Month, Operation.Date.Day, bufTime.Hour, bufTime.Minute, bufTime.Second);


            if (Operation.operation_result == null)
            {
                OperationResults            = "Операция еще не проведена";
                VisiBIlityOfAddResult       = Visibility.Visible;
                VisiBIlityOfAddCancle       = Visibility.Visible;
                ResultButtonName            = "Добавить итоги";
                ToAddOperationResultCommand = new DelegateCommand(() =>
                {
                    MessageBus.Default.Call("GetOperationIDForAddOperationResult", this, Operation.Id);
                    Controller.NavigateTo <ViewModelAddOperationResult>();
                });
            }
            else
            {
                OperationResults            = "Операция проведена";
                VisiBIlityOfAddResult       = Visibility.Visible;
                VisiBIlityOfAddCancle       = Visibility.Hidden;
                ResultButtonName            = "Добавить итоги";
                ToAddOperationResultCommand = new DelegateCommand(() =>
                {
                    MessageBus.Default.Call("GetOperationIDForAddOperationResult", this, Operation.Id);
                    Controller.NavigateTo <ViewModelAddOperationResult>();
                });
            }

            if (Operation.operation_result != null)
            {
                OperationResults            = "Итоги добавлены";
                VisiBIlityOfAddResult       = Visibility.Visible;
                VisiBIlityOfAddCancle       = Visibility.Hidden;
                ResultButtonName            = "Посмотреть итоги";
                ToAddOperationResultCommand = new DelegateCommand(() =>
                {
                    //MessageBus.Default.Call("GetOprForOprResultOverview", this, Operation.Id);
                    //Controller.NavigateTo<ViewModelOperationResultOverview>();
                    MessageBus.Default.Call("GetOperationIDForAddOperationResult", this, Operation.Id);
                    Controller.NavigateTo <ViewModelAddOperationResult>();
                });
            }

            if (Operation.cancel_operations != null)
            {
                OperationResults      = "Операция отменена";
                VisiBIlityOfAddResult = Visibility.Hidden;
                VisiBIlityOfAddCancle = Visibility.Hidden;
            }
            LeftDiagnosisList  = new List <DiagnosisDataSource>();
            RightDiagnosisList = new List <DiagnosisDataSource>();
            DoctorsSelected    = new List <DoctorDataSource>();
            RightOperationList = new List <OperationTypesDataSource>();
            LeftOperationList  = new List <OperationTypesDataSource>();
            AnesteticSelected  = Data.Anestethic.Get(Operation.AnestheticId).Str;


            //OprTypeSelected = OperationTypeRep.Get(Operation.OperationTypeId).LongName;


            CurrentPatient = Data.Patients.Get(Operation.PatientId);


            initials = " " + CurrentPatient.Name.ToCharArray()[0].ToString() + ". " + CurrentPatient.Patronimic.ToCharArray()[0].ToString() + ".";


            foreach (var Brigade in Data.Brigade.GetAll)
            {
                if (Brigade.id_operation == Operation.Id)
                {
                    var doctor = Data.Doctor.Get(Brigade.id_doctor.Value);
                    var buf    = new DoctorDataSource(doctor.Name, doctor.Sirname, doctor.Patronimic, true, doctor.Id);
                    buf.IsChecked = true;
                    DoctorsSelected.Add(buf);
                }
            }
            foreach (var Brigade in Data.BrigadeMedPersonal.GetAll)
            {
                if (Brigade.id_operation == Operation.Id)
                {
                    var medPersonal = Data.MedPersonal.Get(Brigade.id_med_staff.Value);
                    var buf         = new DoctorDataSource(medPersonal.Name, medPersonal.Surname, medPersonal.Patronimic, false, medPersonal.Id);
                    buf.IsChecked = true;
                    DoctorsSelected.Add(buf);
                }
            }



            foreach (var Diagnosis in Data.Diagnosis.GetAll)
            {
                if (Diagnosis.id_operation == Operation.Id)
                {
                    if (Diagnosis.isLeft == true)
                    {
                        var buf1 = new DiagnosisDataSource(Data.DiagnosisTypes.Get(Diagnosis.id_diagnosis.Value));
                        buf1.IsChecked = true;
                        LeftDiagnosisList.Add(buf1);
                    }
                    else
                    {
                        var buf2 = new DiagnosisDataSource(Data.DiagnosisTypes.Get(Diagnosis.id_diagnosis.Value));
                        buf2.IsChecked = true;
                        RightDiagnosisList.Add(buf2);
                    }
                }
            }



            foreach (var Diagnosis in Data.OperationTypeOperations.GetAll)
            {
                if (Diagnosis.id_operation == Operation.Id)
                {
                    if (Diagnosis.isLeft == true)
                    {
                        var buf1 = new OperationTypesDataSource(Data.OperationType.Get(Diagnosis.id_operation_type.Value));
                        buf1.IsChecked = true;
                        LeftOperationList.Add(buf1);
                    }
                    else
                    {
                        var buf2 = new OperationTypesDataSource(Data.OperationType.Get(Diagnosis.id_operation_type.Value));
                        buf2.IsChecked = true;
                        RightOperationList.Add(buf2);
                    }
                }
            }
            if (Operation.OnWhatLegOp == "0")
            {
                IsLeftLegInOperation  = Visibility.Visible;
                IsRightLegInOperation = Visibility.Collapsed;
            }
            if (Operation.OnWhatLegOp == "1")
            {
                IsLeftLegInOperation  = Visibility.Collapsed;
                IsRightLegInOperation = Visibility.Visible;
            }
            if (Operation.OnWhatLegOp == "2")
            {
                IsLeftLegInOperation  = Visibility.Visible;
                IsRightLegInOperation = Visibility.Visible;
            }
        }