예제 #1
0
        protected static FR_Guid Execute(DbConnection Connection, DbTransaction Transaction, P_L6DO_SDaR_1536 Parameter, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null)
        {
            //Leave UserCode region to enable user code saving
            #region UserCode
            var returnValue = new FR_Guid();
            #region Save Document
            P_L3DO_SD_1409 paramDoc = new P_L3DO_SD_1409();
            paramDoc.Alias = Parameter.File_Name;
            Guid documentID = cls_Save_DOC_Document.Invoke(Connection, Transaction, paramDoc, securityTicket).Result;
            #endregion

            #region cls_Save_DOC_Document_2_Structure
            P_L3DO_SD2S_1407 paramDocument2Structure = new P_L3DO_SD2S_1407();
            paramDocument2Structure.Document_RefID        = documentID;
            paramDocument2Structure.Structure_RefID       = Parameter.Structure_RefID;
            paramDocument2Structure.StructureHeader_RefID = Parameter.Structure_Header_RefID;

            Guid assigmentID = cls_Save_DOC_Document_2_Structure.Invoke(Connection, Transaction, paramDocument2Structure, securityTicket).Result;


            #endregion

            #region cls_Save_DOC_DocumentRevision
            P_L3DO_SDR_1401 paramDocumentRevision = new P_L3DO_SDR_1401();
            paramDocumentRevision.Document_RefID      = documentID;
            paramDocumentRevision.Revision            = 1;
            paramDocumentRevision.IsLocked            = false;
            paramDocumentRevision.IsLastRevision      = true;
            paramDocumentRevision.UploadedByAccount   = securityTicket.AccountID;
            paramDocumentRevision.File_Name           = Parameter.File_Name;
            paramDocumentRevision.File_SourceLocation = "";
            paramDocumentRevision.File_ServerLocation = Parameter.File_ServerLocation;
            paramDocumentRevision.File_MIMEType       = Parameter.File_MIMEType;
            paramDocumentRevision.File_Extension      = Parameter.File_Extension;
            paramDocumentRevision.File_Size_Bytes     = Parameter.File_Size_Bytes;

            cls_Save_DOC_DocumentRevision.Invoke(Connection, Transaction, paramDocumentRevision, securityTicket);


            #endregion

            return(returnValue);

            #endregion UserCode
        }
예제 #2
0
 ///<summary>
 /// Ivokes the method with the given Connection, leaving it open if no exceptions occured
 ///<summary>
 public static FR_Guid Invoke(DbConnection Connection, P_L6DO_SDaR_1536 Parameter, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null)
 {
     return(Invoke(Connection, null, null, Parameter, securityTicket));
 }
예제 #3
0
        ///<summary>
        /// Method Invocation of wrapper classes
        ///<summary>
        protected static FR_Guid Invoke(DbConnection Connection, DbTransaction Transaction, string ConnectionString, P_L6DO_SDaR_1536 Parameter, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null)
        {
            bool cleanupConnection  = Connection == null;
            bool cleanupTransaction = Transaction == null;

            FR_Guid functionReturn = new FR_Guid();

            try
            {
                if (cleanupConnection == true)
                {
                    Connection = CSV2Core_MySQL.Support.DBSQLSupport.CreateConnection(ConnectionString);
                    Connection.Open();
                }
                if (cleanupTransaction == true)
                {
                    Transaction = Connection.BeginTransaction();
                }

                functionReturn = Execute(Connection, Transaction, Parameter, securityTicket);

                #region Cleanup Connection/Transaction
                //Commit the transaction
                if (cleanupTransaction == true)
                {
                    Transaction.Commit();
                }
                //Close the connection
                if (cleanupConnection == true)
                {
                    Connection.Close();
                }
                #endregion
            }
            catch (Exception ex)
            {
                try
                {
                    if (cleanupTransaction == true && Transaction != null)
                    {
                        Transaction.Rollback();
                    }
                }
                catch { }

                try
                {
                    if (cleanupConnection == true && Connection != null)
                    {
                        Connection.Close();
                    }
                }
                catch { }

                throw new Exception("Exception occured in method cls_Save_Document_and_Revision", ex);
            }
            return(functionReturn);
        }