private async void pnlManipulations_RequareDocuments(tblManipulation manipulation)
        {
            tabDocuments.IsSelected = true;
            await FViewDataContext.SaveAllCangesAsync();

            await FViewDataContext.SetDocsByManipulation(manipulation);
        }
 internal static void PrepareDoc <TDoc>(TDoc document, tblManipulation manipulation) where TDoc : tblDocumentCommon
 {
     document.tblPatient      = manipulation.tblPatient;
     document.tblManipulation = manipulation;
     document.SetDefaultParams(); // selected = true и количестко коппий
     document.CopyPatientInfoToDocument();
     document.CopyManipulationToDocument();
 }
        public static tblManipulation CreateManipulation(ManipulationConfig config)
        {
            tblManipulation result = new tblManipulation()
            {
                tblPatient      = config.Patient,
                tblOffer        = config.Offer,
                OfferCustomText = config.Offer.DocName,
                Eye             = config.Eye,
                Price           = config.Price,
                DateRealization = config.DateRealisation,
            };

            config.Patient.tblManipulationsObs.Add(result);
            return(result);
        }
        private void AddManipulation(tblOffer offer, tblEmployee employee = null)
        {
            tblPatientInfo xPatientInfo = FViewDataContext.CurrentPatient;

            if (xPatientInfo == null)
            {
                System.Windows.MessageBox.Show("Не выбран пациент");
                return;
            }

            tblManipulation xManipulation = new tblManipulation()
            {
                tblPatient      = xPatientInfo,
                tblOffer        = offer,
                Price           = offer.DefaultPrice,
                DateRealization = DateTime.Now,
                Eye             = Eye.OU,
                tblEmployee     = employee
            };

            xPatientInfo.tblManipulationsObs.Add(xManipulation);
        }
        public Task SetDocsByManipulation(tblManipulation manipulation)
        {
            ObservableCollection <tblDocumentCommon> xDocs = PopulateCollection(DocsByManipulation(manipulation), RVDataContext.tblDocumentCommons);

            return(SetDocs(xDocs));
        }
 private IQueryable <tblDocumentCommon> DocsByManipulation(tblManipulation manipulation)
 {
     return(from doc in GetDocContext()
            where (doc.DateDelete == null) && (doc.ManipulationID == manipulation.ID)
            select doc);
 }