protected static FR_Base Execute(DbConnection Connection, DbTransaction Transaction, P_L5BD_DBI_1127 Parameter, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null)
        {
            #region UserCode
            var returnValue = new FR_Base();
            //Put your code here

            ORM_DOC_DocumentRevision.Query revisionQuery = new ORM_DOC_DocumentRevision.Query();
            revisionQuery.DOC_DocumentRevisionID = Parameter.DocumentRevisionID;
            ORM_DOC_DocumentRevision.Query.SoftDelete(Connection, Transaction, revisionQuery);

            return(returnValue);

            #endregion UserCode
        }
Beispiel #2
0
        protected static FR_Guid Execute(DbConnection Connection, DbTransaction Transaction, P_L5DO_SD_1702 Parameter, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null)
        {
            #region UserCode
            var returnValue = new FR_Guid();
            //Put your code here

            var saveDocumentParam = new P_L2DO_SDD_1640();

            if (Parameter.IsDeleted)
            {
                // Delete document revisions
                ORM_DOC_DocumentRevision.Query qry = new ORM_DOC_DocumentRevision.Query();
                qry.Document_RefID = Parameter.DOC_DocumentID;
                qry.IsDeleted      = false;

                foreach (var item in ORM_DOC_DocumentRevision.Query.Search(Connection, Transaction, qry))
                {
                    item.Load(Connection, Transaction, item.DOC_DocumentRevisionID);
                    item.IsDeleted = true;
                    item.Save(Connection, Transaction);
                }

                //Delete document if exists
                ORM_DOC_Document doc = new ORM_DOC_Document();
                var docQry           = new ORM_DOC_Document.Query()
                {
                    DOC_DocumentID = Parameter.DOC_DocumentID
                };
                if (ORM_DOC_Document.Query.Exists(Connection, Transaction, docQry))
                {
                    doc.Load(Connection, Transaction, Parameter.DOC_DocumentID);
                    doc.IsDeleted = true;
                    doc.Save(Connection, Transaction);

                    returnValue.Result = doc.DOC_DocumentID;
                }

                return(returnValue);
            }

            var savedDocumentGuid = cls_Save_DOC_Document.Invoke(Connection, Transaction, saveDocumentParam, securityTicket).Result;

            var saveDocumentRevisionParam = new P_L2DO_SDDR_1644();
            saveDocumentRevisionParam.Document_RefID      = savedDocumentGuid;
            saveDocumentRevisionParam.File_Name           = Parameter.File_Name;
            saveDocumentRevisionParam.UploadedByAccount   = Parameter.UploadedByAccount;
            saveDocumentRevisionParam.File_ServerLocation = Parameter.FileLocation;

            saveDocumentRevisionParam.IsLastRevision = true;
            saveDocumentRevisionParam.Revision       = 1;

            var webshopParam = new P_L2DO_SEDGD_1813();
            webshopParam.Document_RefID         = savedDocumentGuid;
            webshopParam.IsPublicallyVisible    = Parameter.VisibleInWebShop;
            webshopParam.DocumentTypeMatchingID = EnumUtils.GetEnumDescription(EDocumentType.APODemandDocument);
            cls_Save_ECM_DOC_GeneralDocument.Invoke(Connection, Transaction, webshopParam, securityTicket);

            var savedRevisionGuid = cls_Save_DOC_DocumentRevision.Invoke(Connection, Transaction, saveDocumentRevisionParam, securityTicket).Result;

            returnValue.Result = savedDocumentGuid;

            return(returnValue);

            #endregion UserCode
        }