Exemplo n.º 1
0
        protected static FR_L6SR_GDfSRCC_1515 Execute(DbConnection Connection, DbTransaction Transaction, P_L6SR_GDfSRCC_1515 Parameter, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null)
        {
            #region UserCode
            var returnValue = new FR_L6SR_GDfSRCC_1515();

            P_L5SR_GSRPfH_1544 getPositionsParameter = new P_L5SR_GSRPfH_1544();
            getPositionsParameter.ReceiptHeaderID = Parameter.ReceiptHeaderID;

            var receiptPositions = cls_Get_StockReceiptsPositions_for_ReceiptHeaderID.Invoke(Connection, Transaction, getPositionsParameter, securityTicket).Result;

            CL1_LOG_RCP.ORM_LOG_RCP_Receipt_Header receiptHeader = new CL1_LOG_RCP.ORM_LOG_RCP_Receipt_Header();
            receiptHeader.Load(Connection, Transaction, Parameter.ReceiptHeaderID);

            var expectedDeliveryHeader = CL1_ORD_PRC.ORM_ORD_PRC_ExpectedDelivery_Header.Query.Search(Connection, Transaction,
                                                                                                      new CL1_ORD_PRC.ORM_ORD_PRC_ExpectedDelivery_Header.Query()
            {
                ORD_PRC_ExpectedDelivery_HeaderID = receiptHeader.ExpectedDeliveryHeader_RefID,
                Tenant_RefID = securityTicket.TenantID,
                IsDeleted    = false
            }).Single();

            #region Discount types

            var discountTypesParam = new P_L2DT_GDTfGPMIL_1546();
            discountTypesParam.GlobalPropertyMatchingID_List = EnumUtils.GetAllEnumDescriptions <EDiscountType>().ToArray();

            var discountTypes = cls_Get_DiscountTypes_for_GlobalPropertyMatchingID_List.Invoke(Connection, Transaction, discountTypesParam, securityTicket).Result;

            #endregion

            returnValue.Result                = new L6SR_GDfSRCC_1515();
            returnValue.Result.Positions      = receiptPositions;
            returnValue.Result.DeliveryDate   = expectedDeliveryHeader.ExpectedDeliveryDate;
            returnValue.Result.DeliveryNumber = expectedDeliveryHeader.ExpectedDeliveryNumber;
            returnValue.Result.SupplierID     = receiptHeader.ProvidingSupplier_RefID;
            returnValue.Result.DiscountTypes  = discountTypes;

            return(returnValue);

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

            FR_L6SR_GDfSRCC_1515 functionReturn = new FR_L6SR_GDfSRCC_1515();

            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_Get_Data_for_StockReceiptConditionCheck", ex);
            }
            return(functionReturn);
        }