protected static FR_Guid Execute(DbConnection Connection, DbTransaction Transaction, P_L3PL_SPLaPLR_2050 Parameter, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null)
        {
            #region UserCode
            var     returnValue = new FR_Base();
            FR_Base saveStatus  = new FR_Base();
            #region Save Price List

            P_L2PL_SP_1407 parameterPriceList = Parameter.PriceList;

            var savingStatus = cls_Save_CMN_SLS_Pricelist.Invoke(Connection, Transaction, parameterPriceList, securityTicket);
            var priceListID  = savingStatus.Result;
            if (Parameter.IsDefaultPriceList == true)
            {
                P_L2_ST_1149 tenantParameter = new P_L2_ST_1149();
                tenantParameter.CMN_TenantID = securityTicket.TenantID;
                tenantParameter.Customers_DefaultPricelist_RefID = priceListID;
                savingStatus = cls_Save_CMN_Tenant.Invoke(Connection, Transaction, tenantParameter, securityTicket);
            }
            #endregion
            if (saveStatus.Status == FR_Status.Success)
            {
                foreach (var parameterPriceListRelease in Parameter.PriceListReleasesList.ToList())
                {
                    parameterPriceListRelease.Pricelist_RefID = priceListID;
                    saveStatus = cls_Save_CMN_SLS_Pricelist_Release.Invoke(Connection, Transaction, parameterPriceListRelease, securityTicket);
                }
            }
            returnValue = saveStatus;



            return(savingStatus);

            #endregion UserCode
        }
示例#2
0
        protected static FR_Guid Execute(DbConnection Connection, DbTransaction Transaction, P_L5PL_SPWD_1432 Parameter, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null)
        {
            //Leave UserCode region to enable user code saving
            #region UserCode
            var returnValue = new FR_Guid();
            //Put your code here

            var savePricelistParam = new P_L2PL_SP_1407();
            savePricelistParam = Parameter.Save_CMN_SLS_Pricelist_Param;
            var savedPricelist = cls_Save_CMN_SLS_Pricelist.Invoke(Connection, Transaction, savePricelistParam, securityTicket).Result;

            var tenantQuery = new ORM_CMN_Tenant.Query();
            tenantQuery.Tenant_RefID = securityTicket.TenantID;
            tenantQuery.CMN_TenantID = securityTicket.TenantID;
            var foundTenant = ORM_CMN_Tenant.Query.Search(Connection, Transaction, tenantQuery).Single();

            if (foundTenant != null)
            {
                if (Parameter.IsDefault)
                {
                    if (savePricelistParam.CMN_SLS_PricelistID != Guid.Empty)
                    {
                        foundTenant.Customers_DefaultPricelist_RefID = savePricelistParam.CMN_SLS_PricelistID;
                    }
                    else
                    {
                        foundTenant.Customers_DefaultPricelist_RefID = savedPricelist;
                    }
                }
                else
                {
                    foundTenant.Customers_DefaultPricelist_RefID = Guid.Empty;
                }

                foundTenant.Save(Connection, Transaction);
            }


            returnValue.Result = savedPricelist;

            return(returnValue);

            #endregion UserCode
        }
示例#3
0
        protected static FR_Guid Execute(DbConnection Connection, DbTransaction Transaction, P_L5PL_PDD_1242 Parameter, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null)
        {
            //Leave UserCode region to enable user code saving
            #region UserCode
            var returnValue = new FR_Guid();
            //Put your code here

            P_L2PL_SP_1407 delPricelistParam = new P_L2PL_SP_1407();
            delPricelistParam = Parameter.Save_CMN_SLS_Pricelist_Param;

            var pricelistReleasesQuery = new ORM_CMN_SLS_Pricelist_Release.Query();
            pricelistReleasesQuery.Pricelist_RefID = delPricelistParam.CMN_SLS_PricelistID;
            pricelistReleasesQuery.Tenant_RefID    = securityTicket.TenantID;
            var foundReleases = ORM_CMN_SLS_Pricelist_Release.Query.Search(Connection, Transaction, pricelistReleasesQuery);

            //delete all found releases/versions for pricelistID
            foreach (var release in foundReleases)
            {
                release.IsDeleted = true;
                release.Save(Connection, Transaction);
            }

            //check if this is default pricelist
            var tenantQuery = new ORM_CMN_Tenant.Query();
            tenantQuery.CMN_TenantID = securityTicket.TenantID;
            tenantQuery.Tenant_RefID = securityTicket.TenantID;
            var foundTenant = ORM_CMN_Tenant.Query.Search(Connection, Transaction, tenantQuery).SingleOrDefault();

            //if yes, then set default pricelist id to empty guid
            if (foundTenant != null && foundTenant.Customers_DefaultPricelist_RefID == delPricelistParam.CMN_SLS_PricelistID)
            {
                foundTenant.Customers_DefaultPricelist_RefID = Guid.Empty;
            }

            //finaly, delete pricelist
            var deletedPricelist = cls_Save_CMN_SLS_Pricelist.Invoke(Connection, Transaction, delPricelistParam, securityTicket).Result;
            returnValue.Result = deletedPricelist;

            return(returnValue);

            #endregion UserCode
        }