コード例 #1
0
        protected static FR_Guid Execute(DbConnection Connection, DbTransaction Transaction, P_L5SB_SSBfR_1401 Parameter, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null)
        {
            #region UserCode
            var returnValue = new FR_Guid();
            //Put your code here

            ORM_ORD_PRC_SPB_SupplierBill_2_ReceiptHeader receiptToSupplierBillHeader = new ORM_ORD_PRC_SPB_SupplierBill_2_ReceiptHeader();

            ORM_LOG_RCP_Receipt_Header.Query receiptHeaderQuery = new ORM_LOG_RCP_Receipt_Header.Query();
            receiptHeaderQuery.LOG_RCP_Receipt_HeaderID = Parameter.LOG_RCP_Receipt_HeaderID;
            receiptHeaderQuery.Tenant_RefID             = securityTicket.TenantID;
            var foundReceiptHeaderEntity = ORM_LOG_RCP_Receipt_Header.Query.Search(Connection, Transaction, receiptHeaderQuery);

            //update receipt header status
            if (foundReceiptHeaderEntity == null)
            {
                return(new FR_Guid("Not found", FR_Status.Error_Internal));
            }
            else
            {
                ORM_LOG_RCP_Receipt_Header foundReceiptHeader = foundReceiptHeaderEntity.Single();
                foundReceiptHeader.IsReceiptForwardedToBookkeeping               = true;
                foundReceiptHeader.ReceiptForwardedToBookkeeping_AtDate          = DateTime.Now;
                foundReceiptHeader.ReceiptForwardedToBookkeeping_ByAccount_RefID = securityTicket.AccountID;
                foundReceiptHeader.Save(Connection, Transaction);
            }

            var receiptToBillAssignment = ORM_ORD_PRC_SPB_SupplierBill_2_ReceiptHeader.Query.Search(Connection, Transaction,
                                                                                                    new ORM_ORD_PRC_SPB_SupplierBill_2_ReceiptHeader.Query()
            {
                LOG_RCP_Receipt_Header_RefID = Parameter.LOG_RCP_Receipt_HeaderID,
                Tenant_RefID = securityTicket.TenantID,
                IsDeleted    = false
            }).SingleOrDefault();

            //update bill header
            if (receiptToBillAssignment != null)
            {
                ORM_ORD_PRC_SPB_SupplierBill_Header billHeader = new ORM_ORD_PRC_SPB_SupplierBill_Header();
                billHeader.Load(Connection, Transaction, receiptToBillAssignment.ORD_PRC_SPB_SupplierBill_Header_RefID);
                billHeader.CashDiscountInPercent = Parameter.CashDiscountInPercent;
                billHeader.DateOnBill            = Parameter.DateOnBill;
                billHeader.SupplierBillNumber    = Parameter.SupplierBillNumber;
                billHeader.PaymentTargetDate     = Parameter.PaymentTargetTime;
                billHeader.Save(Connection, Transaction);
            }
            else
            {
                P_L2BH_SOPSSBH_1515 saveBillHeaderParam = new P_L2BH_SOPSSBH_1515();

                saveBillHeaderParam.CashDiscountInPercent = Parameter.CashDiscountInPercent;
                saveBillHeaderParam.DateOnBill            = Parameter.DateOnBill;
                saveBillHeaderParam.SupplierBillNumber    = Parameter.SupplierBillNumber;
                saveBillHeaderParam.PaymentTargetDate     = Parameter.PaymentTargetTime;

                Guid savedBillHeader = cls_Save_ORD_PRC_SPB_SupplierBill_Header.Invoke(Connection, Transaction, saveBillHeaderParam, securityTicket).Result;

                receiptToBillAssignment = new ORM_ORD_PRC_SPB_SupplierBill_2_ReceiptHeader();
                receiptToBillAssignment.ORD_PRC_SPB_SupplierBill_2_ReceiptHeaderID = Guid.NewGuid();
                receiptToBillAssignment.ORD_PRC_SPB_SupplierBill_Header_RefID      = savedBillHeader;
                receiptToBillAssignment.LOG_RCP_Receipt_Header_RefID = Parameter.LOG_RCP_Receipt_HeaderID;
                receiptToBillAssignment.Tenant_RefID = securityTicket.TenantID;
                receiptToBillAssignment.Save(Connection, Transaction);
            }


            returnValue.Result = receiptToBillAssignment.ORD_PRC_SPB_SupplierBill_2_ReceiptHeaderID;

            return(returnValue);

            #endregion UserCode
        }
コード例 #2
0
 ///<summary>
 /// Invokes the method for the given Connection, and Transaction, leaving them open/not commited if no exceptions occured
 ///<summary>
 public static FR_Guid Invoke(DbConnection Connection, DbTransaction Transaction, P_L5SB_SSBfR_1401 Parameter, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null)
 {
     return(Invoke(Connection, Transaction, null, Parameter, securityTicket));
 }
コード例 #3
0
        ///<summary>
        /// Method Invocation of wrapper classes
        ///<summary>
        protected static FR_Guid Invoke(DbConnection Connection, DbTransaction Transaction, string ConnectionString, P_L5SB_SSBfR_1401 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_SupplierBill_for_Receipt", ex);
            }
            return(functionReturn);
        }
コード例 #4
0
 ///<summary>
 /// Opens the connection/transaction for the given connectionString, and closes them when complete
 ///<summary>
 public static FR_Guid Invoke(string ConnectionString, P_L5SB_SSBfR_1401 Parameter, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null)
 {
     return(Invoke(null, null, ConnectionString, Parameter, securityTicket));
 }