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); }
public static void AddDoc(ManipulationConfig config, Func <tblDocumentCommon[]> DocFactory) { Eye xEye = config.Eye; Debug.Assert(xEye != Eye.No); tblManipulation xManipulation; Eye[] xEyes = (xEye == Eye.OU) ? new Eye[] { Eye.OS, Eye.OD } : new Eye[] { xEye }; foreach (Eye item in xEyes) { config.Eye = item; xManipulation = CreateManipulation(config); tblDocumentCommon[] xNewDocs = DocFactory(); foreach (tblDocumentCommon xNewDoc in xNewDocs) { ViewDataContext.PrepareDoc(xNewDoc, xManipulation); xManipulation.tblDocumentCommonsObs.Add(xNewDoc); Instance.Documents.Add(xNewDoc); } } }