public void Execute(Shape s, string identifier) { RationallyModel model = Globals.RationallyAddIn.Model; VisioShape component = new VisioShape(Globals.RationallyAddIn.Application.ActivePage) { Shape = s }; int index = component.Index; RelatedDocument document = model.Documents[index]; DialogResult confirmResult = MessageBox.Show("Are you sure you want to delete " + document.Name + "?", "Confirm Deletion", MessageBoxButtons.YesNo); if (confirmResult == DialogResult.Yes) { Shape shapeToPass; if (RelatedDocumentContainer.IsRelatedDocumentContainer(s.Name)) { shapeToPass = s; } else //subpart of document container { //trace documents container RelatedDocumentsContainer documentsContainer = (RelatedDocumentsContainer)Globals.RationallyAddIn.View.Children.First(c => c is RelatedDocumentsContainer); //trace the correct document container RelatedDocumentContainer documentContainer = (RelatedDocumentContainer)documentsContainer.Children.First(c => c is RelatedDocumentContainer && (component.Index == c.Index)); shapeToPass = documentContainer.Shape; } //initiate a delete handler with the container's shape shapeToPass.Delete(); } }
public void Execute(Shape changedShape, string context) { RationallyModel model = Globals.RationallyAddIn.Model; OpenFileDialog openFileDialog = new OpenFileDialog { CheckFileExists = true, CheckPathExists = true }; if (openFileDialog.ShowDialog() == DialogResult.OK) { VisioShape comp = new VisioShape(Globals.RationallyAddIn.Application.ActivePage) { Shape = changedShape }; int index = comp.Index; //container of all related documents: RelatedDocumentsContainer relatedDocumentsContainer = (RelatedDocumentsContainer)Globals.RationallyAddIn.View.Children.First(c => c is RelatedDocumentsContainer); //find the the RelatedDocumentContainer of the selected file RelatedDocumentContainer documentContainer = (RelatedDocumentContainer)relatedDocumentsContainer.Children.First(f => f.Index == index); RelatedDocument doc = model.Documents[index]; doc.Name = openFileDialog.FileName; doc.Path = openFileDialog.FileName; documentContainer.EditFile(doc, index); RepaintHandler.Repaint(relatedDocumentsContainer); } }
/// <summary> /// Adds a related document to the sheet, with a specified document index /// </summary> /// <param name="document"></param> /// <param name="documentIndex"></param> public void InsertRelatedDocument(RelatedDocument document, int documentIndex) { //create a container that wraps the new document Children.Insert(Math.Min(documentIndex, Globals.RationallyAddIn.Model.Documents.Count - 1), new RelatedDocumentContainer(Globals.RationallyAddIn.Application.ActivePage, documentIndex, document, document.Id)); RepaintHandler.Repaint(this); }
/// <summary> /// Adds a related document to the sheet. /// </summary> /// <param name="document"></param> public void AddRelatedDocument(RelatedDocument document) { //create a container that wraps the new document Children.Add(new RelatedDocumentContainer(Globals.RationallyAddIn.Application.ActivePage, Globals.RationallyAddIn.Model.Documents.Count - 1, document, document.Id)); RepaintHandler.Repaint(this); }
public void Execute(Shape changedShape, string identifier) { RationallyModel model = Globals.RationallyAddIn.Model; RelatedDocumentsContainer docsContainer = (RelatedDocumentsContainer)Globals.RationallyAddIn.View.Children.First(c => c is RelatedDocumentsContainer); VisioShape currentComponent = new VisioShape(changedShape.ContainingPage) { Shape = changedShape }; int currentIndex = currentComponent.Index; //swap the forces in the model RelatedDocument currentDoc = model.Documents[currentIndex]; model.Documents[currentIndex] = model.Documents[currentIndex + 1]; model.Documents[currentIndex + 1] = currentDoc; RelatedDocumentContainer toMove = docsContainer.Children.Where(c => c is RelatedDocumentContainer).Cast <RelatedDocumentContainer>().First(c => c.Index == currentIndex); RelatedDocumentContainer toSwapWith = docsContainer.Children.Where(c => c is RelatedDocumentContainer).Cast <RelatedDocumentContainer>().First(c => c.Index == currentIndex + 1); //update the index of the component and his children toMove.SetDocumentIdentifier(currentIndex + 1); //same, for the other component toSwapWith.SetDocumentIdentifier(currentIndex); VisioShape temp = docsContainer.Children[currentIndex]; docsContainer.Children[currentIndex] = docsContainer.Children[currentIndex + 1]; docsContainer.Children[currentIndex + 1] = temp; RepaintHandler.Repaint(docsContainer); }
public RelatedDocumentContainer(Page page, Shape containerShape) : base(page, false) { Shape = containerShape; Array ident = containerShape.ContainerProperties.GetMemberShapes((int)VisContainerFlags.visContainerFlagsExcludeNested); List <Shape> shapes = (new List <int>((int[])ident)).Select(i => page.Shapes.ItemFromID[i]).ToList(); string name = null, path = null; bool file = false; Shape titleShape = shapes.FirstOrDefault(shape => RelatedDocumentTitleComponent.IsRelatedDocumentTitleContainer(shape.Name)); if (titleShape != null) { Children.Add(new RelatedDocumentTitleComponent(page, titleShape)); name = titleShape.Text; } Shape fileShape = shapes.FirstOrDefault(shape => RelatedFileComponent.IsRelatedFileComponent(shape.Name)); if (fileShape != null) { RelatedFileComponent relatedFileComponent = new RelatedFileComponent(page, fileShape); Children.Add(relatedFileComponent); path = relatedFileComponent.FilePath; file = true; } else { Shape urlShape = shapes.FirstOrDefault(shape => RelatedUrlComponent.IsRelatedUrlComponent(shape.Name)); if (urlShape != null) { Children.Add(new RelatedUrlComponent(page, urlShape)); } Shape urlUrlShape = shapes.FirstOrDefault(shape => RelatedURLURLComponent.IsRelatedUrlUrlComponent(shape.Name)); if (urlUrlShape != null) { Children.Add(new RelatedURLURLComponent(page, urlUrlShape)); path = urlUrlShape.Text; } } if ((name != null) && (path != null)) { RelatedDocument doc = new RelatedDocument(path, name, file, Id); if (Index <= Globals.RationallyAddIn.Model.Documents.Count) { Globals.RationallyAddIn.Model.Documents.Insert(Index, doc); } else { Globals.RationallyAddIn.Model.Documents.Add(doc); } } MarginTop = Index == 0 ? 0.3 : 0.0; MarginBottom = 0; UsedSizingPolicy |= SizingPolicy.ExpandYIfNeeded; }
public void Execute(RationallyView view, Shape changedShape) { if (!Globals.RationallyAddIn.Application.IsUndoingOrRedoing) { //find shape in view tree RelatedURLURLComponent urlUrl = (RelatedURLURLComponent)Globals.RationallyAddIn.View.GetComponentByShape(changedShape); //locate connected model object RelatedDocument document = Globals.RationallyAddIn.Model.Documents[urlUrl.Index]; //update the url value document.Path = urlUrl.Text; } }
public void Execute(RationallyView view, Shape changedShape) { if (!Globals.RationallyAddIn.Application.IsUndoingOrRedoing) { //find shape in view tree RelatedDocumentTitleComponent relatedDocumentTitle = (RelatedDocumentTitleComponent)Globals.RationallyAddIn.View.GetComponentByShape(changedShape); //locate connected model object RelatedDocument document = Globals.RationallyAddIn.Model.Documents[relatedDocumentTitle.Index]; //update the document name document.Name = relatedDocumentTitle.Text; } }
public void Execute(Shape changedShape, string context) { RationallyModel model = Globals.RationallyAddIn.Model; UrlSelecter selectUrlDialog = new UrlSelecter(); if (selectUrlDialog.ShowDialog() == DialogResult.OK) { RelatedDocument document = new RelatedDocument(selectUrlDialog.urlTextBox.Text, selectUrlDialog.nameTextbox.Text, false); model.Documents.Add(document); (Globals.RationallyAddIn.View.Children.FirstOrDefault(c => c is RelatedDocumentsContainer) as RelatedDocumentsContainer)?.AddRelatedDocument(document); } selectUrlDialog.Dispose(); }
/// <summary> /// Creates a Related Document. /// </summary> /// <returns>RelatedDocument</returns> public static RelatedDocument CreateRelatedDocument(Boolean mandatorySectionsOnly) { // Related Document RelatedDocument relatedDocument = PathologyReportWithStructuredContent.CreateRelatedDocument(); // Examination Result Representation relatedDocument.ExaminationResultRepresentation = BaseCDAModel.CreateExternalData(MediaType.PDF, AttachmentFileNameAndPath, null);; // Document Provenance relatedDocument.DocumentDetails = CreateDocumentProvenance(mandatorySectionsOnly); return(relatedDocument); }
public void EditFile(RelatedDocument doc, int index) { List <RelatedFileComponent> comp = Children.Where(c => c is RelatedFileComponent).Cast <RelatedFileComponent>().ToList(); comp.ForEach(c => { Children.Remove(c); c.Shape.Delete(); }); //Make a shortcut to the file RelatedFileComponent relatedFileComponent = new RelatedFileComponent(Page, index, doc.Path); Children.Add(relatedFileComponent); Children.Where(c => c is RelatedDocumentTitleComponent).ToList().ForEach(x => x.Text = doc.Path); }
public override void Repaint() { if (!Globals.RationallyAddIn.Application.IsUndoingOrRedoing)//Visio does this for us { if (Globals.RationallyAddIn.Model.Documents.Count > Index) { RelatedDocument doc = Globals.RationallyAddIn.Model.Documents[Index]; if (Text != doc.Name) { Text = doc.Name; } } UpdateReorderFunctions(Globals.RationallyAddIn.Model.Documents.Count - 1); } base.Repaint(); }
/// <summary> /// Creates a Related Document. /// </summary> /// <returns>RelatedDocument</returns> public static RelatedDocument CreateRelatedDocument(Boolean mandatorySectionsOnly) { RelatedDocument relatedDocument = PathologyResultReport.CreateRelatedDocument(); // Pathology PDF var attachmentPdf = BaseCDAModel.CreateExternalData(); attachmentPdf.ExternalDataMediaType = MediaType.PDF; attachmentPdf.Path = AttachmentFileNameAndPath; relatedDocument.ExaminationResultRepresentation = attachmentPdf; // Document Provenance relatedDocument.DocumentDetails = CreateDocumentProvenance(mandatorySectionsOnly); return(relatedDocument); }
public void Execute(Shape changedShape, string identifier) { RationallyModel model = Globals.RationallyAddIn.Model; OpenFileDialog openFileDialog = new OpenFileDialog { CheckFileExists = true, CheckPathExists = true }; if (openFileDialog.ShowDialog() == DialogResult.OK) { //AddToModel RelatedDocument document = new RelatedDocument(openFileDialog.FileName, openFileDialog.FileName, true); model.Documents.Add(document); (Globals.RationallyAddIn.View.Children.FirstOrDefault(c => c is RelatedDocumentsContainer) as RelatedDocumentsContainer)?.AddRelatedDocument(document); } openFileDialog.Dispose(); }
public void UpdateModel() { if (Document != null) { if (FilePath.ReadOnly == Document.IsFile) //either both are files, or both are links { Document.Name = FileName.Text; Document.Path = FilePath.Text; return; } //else Globals.RationallyAddIn.Model.Documents.RemoveAt(DocumentIndex); //remove old (which is wrong type), create a new } //create a new document (optionally at the correct index) RelatedDocument newDocument = new RelatedDocument(FilePath.Text, FileName.Text, FilePath.ReadOnly); DocumentIndex = Math.Min(DocumentIndex, ProjectSetupWizard.Instance.ModelCopy.Documents.Count); ProjectSetupWizard.Instance.ModelCopy.Documents.Insert(DocumentIndex, newDocument); }
public void AddRelatedDocuments(string SqlWhereClause = null) { int idFld = m_RelatedDocumentsTable.FindField("RelatedDocuments_ID"); int ownerFld = m_RelatedDocumentsTable.FindField("OwnerID"); int typeFld = m_RelatedDocumentsTable.FindField("Type"); int pathFld = m_RelatedDocumentsTable.FindField("DocumentPath"); int nameFld = m_RelatedDocumentsTable.FindField("DocumentName"); int noteFld = m_RelatedDocumentsTable.FindField("Notes"); int dsFld = m_RelatedDocumentsTable.FindField("DataSourceID"); ICursor theCursor; if (SqlWhereClause == null) { theCursor = m_RelatedDocumentsTable.Search(null, false); } else { IQueryFilter QF = new QueryFilterClass(); QF.WhereClause = SqlWhereClause; theCursor = m_RelatedDocumentsTable.Search(QF, false); } IRow theRow = theCursor.NextRow(); while (theRow != null) { RelatedDocument anRelatedDocument = new RelatedDocument(); anRelatedDocument.RelatedDocuments_ID = theRow.get_Value(idFld).ToString(); anRelatedDocument.OwnerID = theRow.get_Value(ownerFld).ToString(); anRelatedDocument.Notes = theRow.get_Value(noteFld).ToString(); anRelatedDocument.Type = theRow.get_Value(typeFld).ToString(); anRelatedDocument.DocumentPath = theRow.get_Value(pathFld).ToString(); anRelatedDocument.DocumentName = theRow.get_Value(nameFld).ToString(); anRelatedDocument.DataSourceID = theRow.get_Value(dsFld).ToString(); anRelatedDocument.RequiresUpdate = true; m_RelatedDocumentsDictionary.Add(anRelatedDocument.RelatedDocuments_ID, anRelatedDocument); theRow = theCursor.NextRow(); } }
public RelatedDocumentContainer(Page page, int index, RelatedDocument document, int docId) : base(page) { //1) make a title component for the source and add it to the container RelatedDocumentTitleComponent relatedDocumentTitleComponent = new RelatedDocumentTitleComponent(page, index, document.Name); Children.Add(relatedDocumentTitleComponent); if (document.IsFile) { //2) make a shortcut to the file RelatedFileComponent relatedFileComponent = new RelatedFileComponent(page, index, document.Path); Children.Add(relatedFileComponent); } else { //2) make a shortcut to the url RelatedUrlComponent relatedUrlComponent = new RelatedUrlComponent(page, index, document.Path); Children.Add(relatedUrlComponent); //3) add a text element that displays the full URL RelatedURLURLComponent urlLabel = new RelatedURLURLComponent(page, index, document.Path); Children.Add(urlLabel); } RationallyType = ShapeNames.TypeRelatedDocumentContainer; Name = ShapeNames.RelatedDocument; Index = index; Id = docId; AddAction("addRelatedFile", string.Format(VisioFormulas.Formula_QUEUMARKEREVENT, "addRelatedFile"), Messages.Menu_AddFile, false); AddAction("addRelatedUrl", string.Format(VisioFormulas.Formula_QUEUMARKEREVENT, "addRelatedUrl"), Messages.Menu_AddUrl, false); AddAction("deleteRelatedDocument", string.Format(VisioFormulas.Formula_QUEUMARKEREVENT, "delete"), Messages.Menu_DeleteDocument, false); MsvSdContainerLocked = true; Width = 5; Height = 1; InitStyle(); }
/// <summary> /// Create the related document from information in the HL7 V2 message. /// </summary> /// <param name="message">The HL7 V2 message.</param> /// <param name="reportAttachment">Report attachment.</param> /// <returns>RelatedDocument</returns> internal static RelatedDocument CreateRelatedDocument(HL7GenericMessage message, ReportAttachment reportAttachment) { RelatedDocument relatedDocument = PathologyResultReport.CreateRelatedDocument(); // Pathology PDF var attachmentPdf = BaseCDAModel.CreateExternalData(); attachmentPdf.ExternalDataMediaType = reportAttachment.MediaType; attachmentPdf.ByteArrayInput = new ByteArrayInput { ByteArray = reportAttachment.Data, FileName = reportAttachment.Filename }; relatedDocument.ExaminationResultRepresentation = attachmentPdf; DocumentDetails documentDetails = BaseCDAModel.CreateDocumentDetails(); // Report Date documentDetails.ReportDate = GetReportDate(message); // Result Status string status = GetRelatedDocumentStatus(message); Hl7V3ResultStatus resultStatus; if (!EnumHelper.TryGetEnumValue <Hl7V3ResultStatus, NameAttribute>(attribute => attribute.Code == status, out resultStatus)) { throw new ArgumentException("No matching Hl7V3ResultStatus value found"); } documentDetails.ReportStatus = BaseCDAModel.CreateResultStatus(resultStatus); // Report Name documentDetails.ReportDescription = GetReportName(message); relatedDocument.DocumentDetails = documentDetails; return(relatedDocument); }
/** * Modelo "Complemento de pago" * - Se especifica: la moneda, método de pago, forma de pago, cliente, y lugar de expedición */ private static Facturama.Models.Request.Cfdi CreateModelCfdiPaymentComplement(FacturamaApi facturama, Facturama.Models.Response.Cfdi cfdiInicial) { Cfdi cfdi = new Cfdi(); // Lista del catálogo de nombres en el PDF var nameForPdf = facturama.Catalogs.NameIds.First(m => m.Value == "14"); // Nombre en el pdf: "Complemento de pago" cfdi.NameId = nameForPdf.Value; // Receptor de comprobante (se toma como cliente el mismo a quien se emitió el CFDI Inicial), String clientRfc = cfdiInicial.Receiver.Rfc; Client client = facturama.Clients.List().Where(p => p.Rfc.Equals(clientRfc)).First(); Receiver receiver = new Receiver { CfdiUse = client.CfdiUse,//"P01" Name = client.Name, Rfc = client.Rfc }; cfdi.Receiver = receiver; // Lugar de expedición (es necesario por lo menos tener una sucursal) BranchOffice branchOffice = facturama.BranchOffices.List().First(); cfdi.ExpeditionPlace = branchOffice.Address.ZipCode; // Fecha y hora de expecidión del comprobante //DateTime bindingDate; //DateTime.TryParse(cfdiBinding.Date, null, DateTimeStyles.RoundtripKind, out bindingDate); DateTime cfdiDate = DateTime.Now; cfdi.Date = cfdiDate; cfdi.CfdiType = CfdiType.Pago; // Complemento de pago --- Complement complement = new Complement(); // Pueden representarse más de un pago en un solo CFDI List <Payment> lstPagos = new List <Payment>(); Payment pago = new Payment(); // Fecha y hora en que se registró el pago en el formato: "yyyy-MM-ddTHH:mm:ss" // (la fecha del pago debe ser menor que la fecha en que se emite el CFDI) // Para este ejemplo, se considera que el pago se realizó hace una hora pago.Date = cfdiDate.AddHours(-1).ToString("yyyy-MM-dd HH:mm:ss"); // Forma de pago (Efectivo, Tarjeta, etc) Facturama.Models.Response.Catalogs.CatalogViewModel paymentForm = facturama.Catalogs.PaymentForms.Where(p => p.Name.Equals("Efectivo")).First(); pago.PaymentForm = paymentForm.Value; // Selección de la moneda del catálogo // La Moneda, puede ser diferente a la del documento inicial // (En el caso de que sea diferente, se debe colocar el tipo de cambio) List <CurrencyCatalog> lstCurrencies = facturama.Catalogs.Currencies.ToList(); CurrencyCatalog currency = lstCurrencies.Where(p => p.Value.Equals("MXN")).First(); pago.Currency = currency.Value; // Monto del pago // Este monto se puede distribuir entre los documentos relacionados al pago pago.Amount = 100.00m; // Documentos relacionados con el pago // En este ejemplo, los datos se obtiene el cfdiInicial, pero puedes colocar solo los datos // aun sin tener el "Objeto" del cfdi Inicial, ya que los valores son del tipo "String" List <RelatedDocument> lstRelatedDocuments = new List <RelatedDocument>(); RelatedDocument relatedDocument = new RelatedDocument { Uuid = cfdiInicial.Complement.TaxStamp.Uuid, // "27568D31-E579-442F-BA77-798CBF30BD7D" Serie = "A", //cfdiInicial.Serie, // "EA" Folio = cfdiInicial.Folio, // 34853 Currency = currency.Value, PaymentMethod = "PUE", // En el complemento de pago tiene que ser PUE PartialityNumber = 1, PreviousBalanceAmount = 100.00m, AmountPaid = 100.00m }; lstRelatedDocuments.Add(relatedDocument); pago.RelatedDocuments = lstRelatedDocuments; lstPagos.Add(pago); complement.Payments = lstPagos; cfdi.Complement = complement; return(cfdi); }
/// <summary> /// Конструктор данных ответа на требование /// </summary> /// <param name="relatedDocument">Связанный документ (требование, письмо или отчет), на который формируется ответ</param> /// <param name="idFileOsn">Идентификатор файла основания (отчета), в ответ на который формируется данный файл (опись).</param> /// <param name="additionalCertificates">Сертификаты дополнительных подписантов (публичная часть в base64)</param> public FnsInventoryDraftsBuilderData(RelatedDocument relatedDocument, string?idFileOsn = null, string[]?additionalCertificates = null) { RelatedDocument = relatedDocument ?? throw new ArgumentNullException(nameof(relatedDocument)); IdFileOsn = string.IsNullOrWhiteSpace(idFileOsn) ? null : idFileOsn; AdditionalCertificates = additionalCertificates; }
public string NewRelatedDocument(string OwnerID, string DocumentPath, string DocumentName, string Notes, string Type, string DataSourceID) { RelatedDocument newRelatedDocument = new RelatedDocument(); sysInfo SysInfoTable = new sysInfo(m_theWorkspace); newRelatedDocument.RelatedDocuments_ID = SysInfoTable.ProjAbbr + ".RelatedDocuments." + SysInfoTable.GetNextIdValue("RelatedDocuments"); newRelatedDocument.OwnerID = OwnerID; newRelatedDocument.DocumentName = DocumentName; newRelatedDocument.DocumentPath = DocumentPath; newRelatedDocument.Notes = Notes; newRelatedDocument.Type = Type; newRelatedDocument.DataSourceID = DataSourceID; newRelatedDocument.RequiresUpdate = false; m_RelatedDocumentsDictionary.Add(newRelatedDocument.RelatedDocuments_ID, newRelatedDocument); return newRelatedDocument.RelatedDocuments_ID; }
public void UpdateRelatedDocument(RelatedDocument theRelatedDocument) { try { m_RelatedDocumentsDictionary.Remove(theRelatedDocument.RelatedDocuments_ID); } catch { } theRelatedDocument.RequiresUpdate = true; m_RelatedDocumentsDictionary.Add(theRelatedDocument.RelatedDocuments_ID, theRelatedDocument); }
public void DeleteRelatedDocuments(RelatedDocument theRelatedDocument) { try { m_RelatedDocumentsDictionary.Remove(theRelatedDocument.RelatedDocuments_ID); } catch { } IEditor theEditor = ArcMap.Editor; if (theEditor.EditState == esriEditState.esriStateNotEditing) { theEditor.StartEditing(m_theWorkspace); } theEditor.StartOperation(); try { IQueryFilter QF = new QueryFilterClass(); QF.WhereClause = "RelatedDocuments_ID = '" + theRelatedDocument.RelatedDocuments_ID + "'"; m_RelatedDocumentsTable.DeleteSearchedRows(QF); theEditor.StopOperation("Delete RelatedDocuments"); } catch (Exception e) { theEditor.StopOperation("RelatedDocuments Management Failure"); } }
/// <summary> /// Ctor for all elements /// </summary> public PLClinicalDocument(II id, CE <string> code, ST title, TS effectiveTime, CE <x_BasicConfidentialityKind> confidentialityCode, CS <string> languageCode, II setId, INT versionNumber, TS copyTime, RecordTarget recordTarget, Author author, DataEnterer dataEnterer, Informant12 informant, Custodian custodian, InformationRecipient informationRecipient, LegalAuthenticator legalAuthenticator, Authenticator authenticator, Participant1 participant, InFulfillmentOf inFulfillmentOf, DocumentationOf documentationOf, RelatedDocument relatedDocument, Authorization authorization, Component1 componentOf, Component2 component) : base(id, code, title, effectiveTime, confidentialityCode, languageCode, setId, versionNumber, copyTime, recordTarget, author, dataEnterer, informant, custodian, informationRecipient, legalAuthenticator, authenticator, participant, inFulfillmentOf, documentationOf, relatedDocument, authorization, componentOf, component) { this.PertinentInformation = new List <PertinentInformation>(); }