protected static FR_Guid Execute(DbConnection Connection, DbTransaction Transaction, P_L5DA_CDAtA_1238 Parameter, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null) { #region UserCode var returnValue = new FR_Guid(); //Put your code here var article = new ORM_CMN_PRO_Product(); var dummyArticle = new ORM_CMN_PRO_Product(); var result = article.Load(Connection, Transaction, Parameter.CMN_PRO_ProductID); if (result.Status != FR_Status.Success || article.CMN_PRO_ProductID == Guid.Empty) { var error = new FR_Guid(); error.ErrorMessage = "No Such ID"; error.Status = FR_Status.Error_Internal; return(error); } var result2 = dummyArticle.Load(Connection, Transaction, Parameter.Dummy_ProductID); if (result.Status != FR_Status.Success || dummyArticle.CMN_PRO_ProductID == Guid.Empty) { var error = new FR_Guid(); error.ErrorMessage = "No Such ID"; error.Status = FR_Status.Error_Internal; return(error); } article.IsPlaceholderArticle = true; dummyArticle.IsPlaceholderArticle = false; dummyArticle.Save(Connection, Transaction); return(new FR_Guid(article.Save(Connection, Transaction), article.CMN_PRO_ProductID)); #endregion UserCode }
protected static FR_Bool Execute(DbConnection Connection, DbTransaction Transaction, P_L5AR_UAIDSF_1056 Parameter, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null) { #region UserCode var returnValue = new FR_Bool(); var product = new ORM_CMN_PRO_Product(); var result = product.Load(Connection, Transaction, Parameter.ProductID); if (result.Status != FR_Status.Success) { returnValue.Result = false; returnValue.Status = FR_Status.Error_Internal; return(returnValue); } product.IsProductPartOfDefaultStock = Parameter.IsProductPartOfDefaultStock; result = product.Save(Connection, Transaction); if (result.Status != FR_Status.Success) { returnValue.Result = false; returnValue.Status = FR_Status.Error_Internal; return(returnValue); } returnValue.Status = FR_Status.Success; returnValue.Result = true; return(returnValue); #endregion UserCode }
protected static FR_Guid Execute(DbConnection Connection, DbTransaction Transaction, P_L3MP_DP_1145 Parameter, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null) { //Leave UserCode region to enable user code saving #region UserCode var returnValue = new FR_Guid(); ORM_CMN_PRO_Product item = new ORM_CMN_PRO_Product(); var result = item.Load(Connection, Transaction, Parameter.CMN_PRO_ProductID); if (result.Status != FR_Status.Success) { var error = new FR_Guid(); error.ErrorMessage = "No Such ID"; error.Status = FR_Status.Error_Internal; return(error); } /**********************Delete Hec_Product***********************************/ var hecProductQuery = new ORM_HEC_Product.Query(); hecProductQuery.Ext_PRO_Product_RefID = Parameter.CMN_PRO_ProductID; hecProductQuery.IsDeleted = false; var medProduct = ORM_HEC_Product.Query.Search(Connection, Transaction, hecProductQuery).FirstOrDefault(); if (medProduct != null) { medProduct.IsDeleted = true; medProduct.Save(Connection, Transaction); } /**********************Delete Surveys***************************************/ var surveysQuery = new ORM_CMN_PRO_Product_Questionnaire_Assignment.Query(); surveysQuery.CMN_PRO_Product_RefID = Parameter.CMN_PRO_ProductID; surveysQuery.IsDeleted = false; var surveyes = ORM_CMN_PRO_Product_Questionnaire_Assignment.Query.Search(Connection, Transaction, surveysQuery).ToList(); if (surveyes.Count != 0) { foreach (var survey in surveyes) { survey.IsDeleted = true; survey.Save(Connection, Transaction); } } item.IsDeleted = true; item.Save(Connection, Transaction); return(returnValue); #endregion UserCode }
protected static FR_Guid Execute(DbConnection Connection, DbTransaction Transaction, P_L5AR_CDAtA_1238 Parameter, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null) { #region UserCode var returnValue = new FR_Guid(); //Put your code here var article = new ORM_CMN_PRO_Product(); article.Load(Connection, Transaction, Parameter.CMN_PRO_ProductID); var dummyArticle = new ORM_CMN_PRO_Product(); dummyArticle.Load(Connection, Transaction, Parameter.Dummy_ProductID); dummyArticle.ProductSuccessor_RefID = article.CMN_PRO_ProductID; dummyArticle.Save(Connection, Transaction); return(new FR_Guid(article.Save(Connection, Transaction), article.CMN_PRO_ProductID)); #endregion UserCode }
private static List <L5CA_GACPfR_1621> ProductWithoutPrices(DbConnection Connection, DbTransaction Transaction, P_L5CA_PNCV_1520 Parameter, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket, List <ORM_CMN_PRO_Catalog_Product> oldProducts) { List <L5CA_GACPfR_1621> products = new List <L5CA_GACPfR_1621>(); L5CA_GACPfR_1621 product; List <Guid> insertedProducts = new List <Guid>(); foreach (var item in oldProducts) { if (insertedProducts.Any(i => i == item.CMN_PRO_Product_RefID)) { continue; } insertedProducts.Add(item.CMN_PRO_Product_RefID); ORM_CMN_SLS_Pricelist_Release plr = new ORM_CMN_SLS_Pricelist_Release(); plr.Load(Connection, Transaction, Parameter.Default_PricelistRelease_RefID); var pricelistPriceQry = new ORM_CMN_SLS_Price.Query() { CMN_PRO_Product_RefID = item.CMN_PRO_Product_RefID, PricelistRelease_RefID = plr.CMN_SLS_Pricelist_ReleaseID, IsDeleted = false, Tenant_RefID = securityTicket.TenantID }; var prices = ORM_CMN_SLS_Price.Query.Search(Connection, Transaction, pricelistPriceQry); if (prices.Count == 0) { ORM_CMN_PRO_Product pr = new ORM_CMN_PRO_Product(); pr.Load(Connection, Transaction, item.CMN_PRO_Product_RefID); product = new L5CA_GACPfR_1621(); product.Product_Number = pr.Product_Number; product.Product_Name = pr.Product_Name; product.Product_Description = pr.Product_Description; products.Add(product); } } return(products); }
protected static FR_L6WS_GSCDfSCID_1458 Execute(DbConnection Connection, DbTransaction Transaction, P_L6WS_GSCDfSCID_1458 Parameter, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null) { #region UserCode var returnValue = new FR_L6WS_GSCDfSCID_1458(); //Put your code here if (Parameter.ShoppingCartID == Guid.Empty) { return(null); } returnValue.Result = new L6WS_GSCDfSCID_1458(); #region ShoppingCart returnValue.Result.ShoppingCart = cls_Get_ShoppingCart_for_ShoppingCartID.Invoke(Connection, Transaction, new P_L6WS_GSCfSCID_1448() { ShoppingCartID = Parameter.ShoppingCartID }, securityTicket).Result; if (returnValue.Result.ShoppingCart == null) { return(null); } #endregion #region ShoppingCart_Notes returnValue.Result.ShoppingCart_Notes = cls_Get_ShoppingCart_Notes_for_ShoppingCartID.Invoke(Connection, Transaction, new P_L5AWSAR_GSCNfSC_1454() { ShoppingCartID = Parameter.ShoppingCartID }, securityTicket).Result.OrderBy(i => i.UpdatedOn).ToArray(); #endregion #region Articles ORM_ORD_PRC_ShoppingCart_Product.Query shoppingCartProductsQuery = new ORM_ORD_PRC_ShoppingCart_Product.Query(); shoppingCartProductsQuery.ORD_PRC_ShoppingCart_RefID = returnValue.Result.ShoppingCart.ORD_PRC_ShoppingCartID; shoppingCartProductsQuery.IsDeleted = false; shoppingCartProductsQuery.IsCanceled = false; shoppingCartProductsQuery.Tenant_RefID = securityTicket.TenantID; List <ORM_ORD_PRC_ShoppingCart_Product> productList = ORM_ORD_PRC_ShoppingCart_Product.Query.Search(Connection, Transaction, shoppingCartProductsQuery); List <Guid> articleIds = new List <Guid>(); if (productList != null && productList.Count > 0) { articleIds.AddRange(productList.Select(i => i.CMN_PRO_Product_RefID)); } List <L3AR_GAfAL_0942> articleInfos = new List <L3AR_GAfAL_0942>(); if (articleIds.Count > 0) { articleInfos = cls_Get_Articles_for_ArticleList.Invoke(Connection, Transaction, new P_L3AR_GAfAL_0942() { ProductID_List = articleIds.ToArray() }, securityTicket).Result.ToList(); } List <L6WS_GSCDfSCID_1458_Product> products = new List <L6WS_GSCDfSCID_1458_Product>(); L6WS_GSCDfSCID_1458_Product product; L3AR_GAfAL_0942 articleInfo; double taxRate = 0; #region ORM and Querie objects ORM_CMN_PRO_Product orm_product; ORM_CMN_SLS_Price.Query priceQuery; ORM_CMN_PRO_Product_SalesTaxAssignmnet.Query taxAssignmentQuery; ORM_ACC_TAX_Tax orm_tax; #endregion foreach (var productItem in productList) { #region check procurement order date and number if (returnValue.Result.OrderDate == null || returnValue.Result.OrderDate.Ticks == 0) { ORM_ORD_PRC_ShoppingCart_2_ProcurementOrderPosition.Query shoppingCartOrderPositionQuery = new ORM_ORD_PRC_ShoppingCart_2_ProcurementOrderPosition.Query(); shoppingCartOrderPositionQuery.IsDeleted = false; shoppingCartOrderPositionQuery.Tenant_RefID = securityTicket.TenantID; shoppingCartOrderPositionQuery.ORD_PRC_ShoppingCart_Product_RefID = productItem.ORD_PRC_ShoppingCart_ProductID; List <ORM_ORD_PRC_ShoppingCart_2_ProcurementOrderPosition> shoppingCartOrderPositionList = ORM_ORD_PRC_ShoppingCart_2_ProcurementOrderPosition.Query.Search(Connection, Transaction, shoppingCartOrderPositionQuery); foreach (var shoppingCartOrderPosition in shoppingCartOrderPositionList) { ORM_ORD_PRC_ProcurementOrder_Position procurementOrder_Position = new ORM_ORD_PRC_ProcurementOrder_Position(); var procurementOrder_PositionResult = procurementOrder_Position.Load(Connection, Transaction, shoppingCartOrderPosition.ORD_PRC_ProcurementOrder_Position_RefID); if (procurementOrder_PositionResult.Status != FR_Status.Success || procurementOrder_Position.ORD_PRC_ProcurementOrder_PositionID == Guid.Empty) { continue; } ORM_ORD_PRC_ProcurementOrder_Header procurementOrder_Header = new ORM_ORD_PRC_ProcurementOrder_Header(); var procurementOrder_HeaderResult = procurementOrder_Header.Load(Connection, Transaction, procurementOrder_Position.ProcurementOrder_Header_RefID); if (procurementOrder_HeaderResult.Status != FR_Status.Success || procurementOrder_Header.ORD_PRC_ProcurementOrder_HeaderID == Guid.Empty) { continue; } returnValue.Result.OrderDate = procurementOrder_Header.ProcurementOrder_Date; returnValue.Result.OrderNumber = procurementOrder_Header.ProcurementOrder_Number; break; } } #endregion #region get product orm_product = new ORM_CMN_PRO_Product(); var productResult = orm_product.Load(Connection, Transaction, productItem.CMN_PRO_Product_RefID); if (productResult.Status != FR_Status.Success || orm_product.CMN_PRO_ProductID == Guid.Empty) { continue; } #endregion #region get price ORM_CMN_PRO_SubscribedCatalog.Query catalogQuery = new ORM_CMN_PRO_SubscribedCatalog.Query(); catalogQuery.Tenant_RefID = securityTicket.TenantID; catalogQuery.IsDeleted = false; List <ORM_CMN_PRO_SubscribedCatalog> catalogList = ORM_CMN_PRO_SubscribedCatalog.Query.Search(Connection, Transaction, catalogQuery); priceQuery = new ORM_CMN_SLS_Price.Query(); priceQuery.CMN_PRO_Product_RefID = orm_product.CMN_PRO_ProductID; priceQuery.Tenant_RefID = securityTicket.TenantID; priceQuery.IsDeleted = false; List <ORM_CMN_SLS_Price> prices = ORM_CMN_SLS_Price.Query.Search(Connection, Transaction, priceQuery); ORM_CMN_SLS_Price price = prices.Where(i => catalogList.Select(j => j.SubscribedCatalog_PricelistRelease_RefID).Contains(i.PricelistRelease_RefID)).FirstOrDefault(); #endregion #region get taxes taxRate = 0; taxAssignmentQuery = new ORM_CMN_PRO_Product_SalesTaxAssignmnet.Query(); taxAssignmentQuery.Product_RefID = orm_product.CMN_PRO_ProductID; taxAssignmentQuery.Tenant_RefID = securityTicket.TenantID; taxAssignmentQuery.IsDeleted = false; List <ORM_CMN_PRO_Product_SalesTaxAssignmnet> taxAssignmentList = ORM_CMN_PRO_Product_SalesTaxAssignmnet.Query.Search(Connection, Transaction, taxAssignmentQuery); foreach (var taxAssignment in taxAssignmentList) { orm_tax = new ORM_ACC_TAX_Tax(); var taxResult = orm_tax.Load(Connection, Transaction, taxAssignment.ApplicableSalesTax_RefID); if (taxResult.Status == FR_Status.Success && orm_tax.ACC_TAX_TaxeID != Guid.Empty) { taxRate += orm_tax.TaxRate; } } #endregion #region set product item product = new L6WS_GSCDfSCID_1458_Product(); product.CMN_PRO_Product_RefID = orm_product.CMN_PRO_ProductID; product.PriceAmount = price == null ? 0 : (price.PriceAmount == null ? 0 : Double.Parse(price.PriceAmount.ToString())); product.TaxRate = taxRate; product.Quantity = productItem.Quantity.ToString(); product.IsProductCanceled = productItem.IsCanceled; if (!String.IsNullOrEmpty(productItem.Comment)) { string[] comments = productItem.Comment.Split('@'); if (comments.Length == 2) { product.ProductComment = comments[1]; } } product.IsProductReplacementAllowed = productItem.IsProductReplacementAllowed; articleInfo = articleInfos.FirstOrDefault(i => i.CMN_PRO_ProductID == orm_product.CMN_PRO_ProductID); if (articleInfo != null) { product.Product_Name = articleInfo.Product_Name; product.Product_Number = articleInfo.Product_Number; product.UnitAmount = articleInfo.UnitAmount.ToString(); product.UnitIsoCode = articleInfo.UnitIsoCode; product.DossageFormName = articleInfo.DossageFormName; } #endregion products.Add(product); } returnValue.Result.Products = products.ToArray(); #endregion #region Person info // current user ORM_CMN_PER_PersonInfo_2_Account.Query accountQuery = new ORM_CMN_PER_PersonInfo_2_Account.Query(); accountQuery.USR_Account_RefID = securityTicket.AccountID; accountQuery.Tenant_RefID = securityTicket.TenantID; accountQuery.IsDeleted = false; ORM_CMN_PER_PersonInfo_2_Account account = ORM_CMN_PER_PersonInfo_2_Account.Query.Search(Connection, Transaction, accountQuery).FirstOrDefault(); if (account != null) { ORM_CMN_PER_PersonInfo personInfo = new ORM_CMN_PER_PersonInfo(); var personInfoResult = personInfo.Load(Connection, Transaction, account.CMN_PER_PersonInfo_RefID); if (personInfoResult.Status == FR_Status.Success && personInfo.CMN_PER_PersonInfoID != Guid.Empty) { returnValue.Result.CurrentUser = personInfo.FirstName + " " + personInfo.LastName; } } #region Approved by user ORM_ORD_PRC_ShoppingCart_Status.Query stusesQuery = new ORM_ORD_PRC_ShoppingCart_Status.Query(); stusesQuery.Tenant_RefID = securityTicket.TenantID; stusesQuery.IsDeleted = false; List <ORM_ORD_PRC_ShoppingCart_Status> statuses = ORM_ORD_PRC_ShoppingCart_Status.Query.Search(Connection, Transaction, stusesQuery); ORM_ORD_PRC_ShoppingCart_Status approvedStatus = statuses.FirstOrDefault(i => i.GlobalPropertyMatchingID.Contains("approved")); if (approvedStatus != null) { ORM_ORD_PRC_ShoppingCartStatus_History.Query statusHistoryQuery = new ORM_ORD_PRC_ShoppingCartStatus_History.Query(); statusHistoryQuery.Tenant_RefID = securityTicket.TenantID; statusHistoryQuery.IsDeleted = false; statusHistoryQuery.ORD_PRC_ShoppingCart_RefID = returnValue.Result.ShoppingCart.ORD_PRC_ShoppingCartID; statusHistoryQuery.ORD_PRC_ShoppingCart_Status_RefID = approvedStatus.ORD_PRC_ShoppingCart_StatusID; ORM_ORD_PRC_ShoppingCartStatus_History statusHistory = ORM_ORD_PRC_ShoppingCartStatus_History.Query.Search(Connection, Transaction, statusHistoryQuery).FirstOrDefault(); if (statusHistory != null) { accountQuery = new ORM_CMN_PER_PersonInfo_2_Account.Query(); accountQuery.USR_Account_RefID = statusHistory.PerformedBy_Account_RefID; accountQuery.Tenant_RefID = securityTicket.TenantID; accountQuery.IsDeleted = false; account = ORM_CMN_PER_PersonInfo_2_Account.Query.Search(Connection, Transaction, accountQuery).FirstOrDefault(); if (account != null) { ORM_CMN_PER_PersonInfo personInfo = new ORM_CMN_PER_PersonInfo(); var personInfoResult = personInfo.Load(Connection, Transaction, account.CMN_PER_PersonInfo_RefID); if (personInfoResult.Status == FR_Status.Success && personInfo.CMN_PER_PersonInfoID != Guid.Empty) { returnValue.Result.ApprovedByUser = personInfo.FirstName + " " + personInfo.LastName; returnValue.Result.DateOfApproval = statusHistory.Creation_Timestamp; } } } } #endregion #endregion return(returnValue); #endregion UserCode }
protected static FR_L6SH_GMDfPH_0500_Array Execute(DbConnection Connection, DbTransaction Transaction, P_L6SH_GMDfPH_0500 Parameter, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null) { #region UserCode var returnValue = new FR_L6SH_GMDfPH_0500_Array(); //Put your code here var supplier = cls_Get_Suppliers_for_PrivateSubscribedCatalogs.Invoke(Connection, Transaction, securityTicket).Result.FirstOrDefault(); #region Get All OrganizationalUnits //TODO: This is quick and dirty solution, remove it as soon as SLorenz remove MaveFile var organizationalUnits = ORM_CMN_BPT_CTM_OrganizationalUnit.Query.Search(Connection, Transaction, new ORM_CMN_BPT_CTM_OrganizationalUnit.Query() { Tenant_RefID = Guid.Parse(supplier.TenantITL) }); #endregion var paramShoppingProducts = new P_L5PO_GPPaSCIfH_1750(); paramShoppingProducts.ProcurementOrderHeaderID = Parameter.ProcurementHeaderID; var shoppingCartProcurementPositions = cls_Get_ProcurementPositions_and_ShoppingCartInfo_for_HeaderID.Invoke(Connection, Transaction, paramShoppingProducts, securityTicket) .Result.OrderBy(x => x.ORD_PRC_ShoppingCart_RefID); var maveResults = new List <L6SH_GMDfPH_0500>(); var procurementHeader = new ORM_ORD_PRC_ProcurementOrder_Header(); procurementHeader.Load(Connection, Transaction, Parameter.ProcurementHeaderID); var previousShoppingCartID = Guid.Empty; var currentShoppingCart = new ORM_ORD_PRC_ShoppingCart(); var accountsForTenant = cls_Get_AllDisplayNames_of_Accounts_for_TenantID.Invoke(Connection, Transaction, securityTicket).Result; foreach (var shoppingCartProcurementPosition in shoppingCartProcurementPositions) { var maveResult = new L6SH_GMDfPH_0500(); var currentProduct = new ORM_CMN_PRO_Product(); currentProduct.Load(Connection, Transaction, shoppingCartProcurementPosition.CMN_PRO_Product_RefID); if (currentShoppingCart.ORD_PRC_ShoppingCartID == Guid.Empty || shoppingCartProcurementPosition.ORD_PRC_ShoppingCart_RefID != previousShoppingCartID) { currentShoppingCart.Load(Connection, Transaction, shoppingCartProcurementPosition.ORD_PRC_ShoppingCart_RefID); } var userThatApproved = accountsForTenant.FirstOrDefault(x => x.USR_AccountID == currentShoppingCart.CreatedBy_Account_RefID); #region Add ShoppingCart Position //TODO: This is quick and dirty solution, remove it as soon as SLorenz remove MaveFile var organizationalUnit = organizationalUnits.Where(i => i.CustomerTenant_OfficeITL == shoppingCartProcurementPosition.CMN_STR_OfficeID.ToString()).Single(); maveResult.CustomerNumber = supplier.ExternalSupplierProvidedIdentifier; maveResult.OrgUnitNumber = organizationalUnit.InternalOrganizationalUnitNumber; maveResult.OrderDateTime = procurementHeader.ProcurementOrder_Date; maveResult.PriceOfAllPositionsOverAll = procurementHeader.TotalValue_BeforeTax; maveResult.PZNorTXT = currentProduct.Product_Number; maveResult.UserThatApproved = userThatApproved.DisplayName; maveResult.OrderQuantity = Convert.ToInt32(shoppingCartProcurementPosition.Position_Quantity); maveResult.PositionPricePerUnit = shoppingCartProcurementPosition.Position_ValuePerUnit; maveResult.Comment = string.Empty; maveResult.IncreasingNumber = "108384"; maveResults.Add(maveResult); #endregion #region Add ShoppingCart Comment // get all comments for current shopping chart and do that just once! if (currentShoppingCart.ORD_PRC_ShoppingCartID != previousShoppingCartID) { previousShoppingCartID = currentShoppingCart.ORD_PRC_ShoppingCartID; var shoppingNoteParameter = new P_L5AWSAR_GSCNfSC_1454(); shoppingNoteParameter.ShoppingCartID = currentShoppingCart.ORD_PRC_ShoppingCartID; var shoppingCartNotes = cls_Get_ShoppingCart_Notes_for_ShoppingCartID.Invoke(Connection, Transaction, shoppingNoteParameter, securityTicket).Result; foreach (var note in shoppingCartNotes) { if (!note.IsNoteForProcurementOrder) { continue; } maveResult = new L6SH_GMDfPH_0500(); maveResult.CustomerNumber = supplier.ExternalSupplierProvidedIdentifier; maveResult.OrgUnitNumber = organizationalUnit.InternalOrganizationalUnitNumber; maveResult.OrderDateTime = procurementHeader.ProcurementOrder_Date; maveResult.PriceOfAllPositionsOverAll = procurementHeader.TotalValue_BeforeTax; maveResult.PZNorTXT = "TEXT"; maveResult.UserThatApproved = userThatApproved.DisplayName; maveResult.OrderQuantity = 0; maveResult.PositionPricePerUnit = 0; maveResult.Comment = note.Memo_Text; maveResult.IncreasingNumber = "108384"; maveResults.Add(maveResult); } } #endregion } returnValue.Result = maveResults.ToArray(); return(returnValue); #endregion UserCode }
protected static FR_L3PR_IoUPfSC_1326_Array Execute(DbConnection Connection, DbTransaction Transaction, P_L3PR_IoUPfSC_1326 Parameter, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null) { #region UserCode var returnValue = new FR_L3PR_IoUPfSC_1326_Array(); //Put your code here var importedProducts = new List <L3PR_IoUPfSC_1326>(); #region ImportOrUpdate Product's BaseData P_L3PR_IoUPBD_1614 param = new P_L3PR_IoUPBD_1614(); param.Products = Parameter.Products.Select(i => i.Product).ToArray(); var importedProductsBaseData = cls_ImportOrUpdate_Products_BaseData.Invoke(Connection, Transaction, param, securityTicket).Result; #endregion //TODO: for each product saved, create or update product_2_productGroup foreach (var importedProductBaseData in importedProductsBaseData) { var currentParameter = Parameter.Products.SingleOrDefault(i => i.Product.ProductITL == importedProductBaseData.ProductITL); var product = new ORM_CMN_PRO_Product(); product.Load(Connection, Transaction, importedProductBaseData.ProductID); if (!importedProductBaseData.IsAlreadyExisted) { product.IfImportedFromExternalCatalog_CatalogSubscription_RefID = Parameter.SubscribedCatalogID; product.IsImportedFromExternalCatalog = true; product.Save(Connection, Transaction); ORM_CMN_PRO_Product_2_ProductGroup product_2_productGroup = new ORM_CMN_PRO_Product_2_ProductGroup(); product_2_productGroup.CMN_PRO_Product_RefID = product.CMN_PRO_ProductID; product_2_productGroup.CMN_PRO_ProductGroup_RefID = Parameter.ProductGroupID; product_2_productGroup.Tenant_RefID = securityTicket.TenantID; product_2_productGroup.Creation_Timestamp = DateTime.Now; product_2_productGroup.Save(Connection, Transaction); } else { #region Update Product_2_ProductGroup var isAlreadyInGroup = ORM_CMN_PRO_Product_2_ProductGroup.Query.Exists(Connection, Transaction, new ORM_CMN_PRO_Product_2_ProductGroup.Query() { CMN_PRO_Product_RefID = product.CMN_PRO_ProductID, CMN_PRO_ProductGroup_RefID = Parameter.ProductGroupID, Tenant_RefID = securityTicket.TenantID }); if (!isAlreadyInGroup) { ORM_CMN_PRO_Product_2_ProductGroup product_2_productGroup = new ORM_CMN_PRO_Product_2_ProductGroup(); product_2_productGroup.CMN_PRO_Product_RefID = product.CMN_PRO_ProductID; product_2_productGroup.CMN_PRO_ProductGroup_RefID = Parameter.ProductGroupID; product_2_productGroup.Tenant_RefID = securityTicket.TenantID; product_2_productGroup.Creation_Timestamp = DateTime.Now; product_2_productGroup.Save(Connection, Transaction); } #endregion } #region Default Price var price = ORM_CMN_SLS_Price.Query.Search(Connection, Transaction, new ORM_CMN_SLS_Price.Query() { PricelistRelease_RefID = Parameter.PriceListReleaseID, CMN_PRO_Product_RefID = product.CMN_PRO_ProductID, Tenant_RefID = securityTicket.TenantID, CMN_Currency_RefID = Parameter.CatalogCurrencyID, IsDeleted = false }).SingleOrDefault(); if (price == null) { price = new ORM_CMN_SLS_Price(); price.CMN_SLS_PriceID = Guid.NewGuid(); price.PricelistRelease_RefID = Parameter.PriceListReleaseID; price.CMN_PRO_Product_RefID = product.CMN_PRO_ProductID; price.CMN_Currency_RefID = Parameter.CatalogCurrencyID; price.Tenant_RefID = securityTicket.TenantID; price.Creation_Timestamp = DateTime.Now; } price.PriceAmount = currentParameter.Price; price.Save(Connection, Transaction); #endregion importedProducts.Add(new L3PR_IoUPfSC_1326() { ProductID = product.CMN_PRO_ProductID, ProductITL = product.ProductITL }); } returnValue.Result = importedProducts.ToArray(); return(returnValue); #endregion UserCode }
protected static FR_L5CA_PNCV_1603 Execute(DbConnection Connection, DbTransaction Transaction, P_L5CA_PNCV_1603 Parameter, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null) { #region UserCode var returnValue = new FR_L5CA_PNCV_1603(); returnValue.Result = new L5CA_PNCV_1603(); var account = new ORM_USR_Account(); account.Load(Connection, Transaction, securityTicket.AccountID); #region Update active catalog revision ORM_CMN_PRO_Catalog_Revision rev = new ORM_CMN_PRO_Catalog_Revision(); rev.Load(Connection, Transaction, Parameter.CMN_PRO_Catalog_RevisionID); rev.Valid_From = Parameter.Valid_From; rev.Valid_Through = Parameter.Valid_Through; rev.Default_PricelistRelease_RefID = Parameter.Default_PricelistRelease_RefID; rev.PublishedBy_BusinessParticipant_RefID = account.BusinessParticipant_RefID; rev.PublishedOn_Date = DateTime.Now; rev.Save(Connection, Transaction); #endregion #region Create new catalog revision ORM_CMN_PRO_Catalog_Revision newRev = new ORM_CMN_PRO_Catalog_Revision(); newRev.CMN_PRO_Catalog_RevisionID = Guid.NewGuid(); newRev.CMN_PRO_Catalog_RefID = rev.CMN_PRO_Catalog_RefID; newRev.Tenant_RefID = securityTicket.TenantID; newRev.Creation_Timestamp = DateTime.Now; newRev.CatalogRevision_Description = "Revision for Catalog"; newRev.CatalogRevision_Name = "New Catalog Revision"; newRev.IsDeleted = false; newRev.RevisionNumber = rev.RevisionNumber + 1; newRev.Save(Connection, Transaction); #endregion #region Products var oldProducts = ORM_CMN_PRO_Catalog_Product.Query.Search(Connection, Transaction, new ORM_CMN_PRO_Catalog_Product.Query() { CMN_PRO_Catalog_Revision_RefID = rev.CMN_PRO_Catalog_RevisionID, IsDeleted = false }); if (oldProducts.Count == 0) { returnValue.Result.Status_Code = -1; // -1 no products in revision returnValue.Result.Status_Message = "no products in revision"; return(returnValue); } //oldProductID - newProductID Dictionary <Guid, Guid> productsMapping = new Dictionary <Guid, Guid>(); foreach (var item in oldProducts) { ORM_CMN_SLS_Pricelist_Release plr = new ORM_CMN_SLS_Pricelist_Release(); plr.Load(Connection, Transaction, Parameter.Default_PricelistRelease_RefID); var pricelistPriceQry = new ORM_CMN_SLS_Price.Query() { CMN_PRO_Product_RefID = item.CMN_PRO_Product_RefID, PricelistRelease_RefID = plr.CMN_SLS_Pricelist_ReleaseID, IsDeleted = false, Tenant_RefID = securityTicket.TenantID }; var prices = ORM_CMN_SLS_Price.Query.Search(Connection, Transaction, pricelistPriceQry); if (prices.Count == 0) { ORM_CMN_PRO_Product pr = new ORM_CMN_PRO_Product(); pr.Load(Connection, Transaction, item.CMN_PRO_Product_RefID); returnValue.Result.Status_Code = -2; // -2 => pricelist does not have price for product returnValue.Result.Status_Message = pr.Product_Number; return(returnValue); } var newProduct = new ORM_CMN_PRO_Catalog_Product() { CMN_PRO_Catalog_ProductID = Guid.NewGuid(), CMN_PRO_Product_Variant_RefID = item.CMN_PRO_Product_Variant_RefID, Creation_Timestamp = DateTime.Now, Tenant_RefID = item.Tenant_RefID, CMN_PRO_Catalog_Revision_RefID = newRev.CMN_PRO_Catalog_RevisionID, CMN_PRO_Product_RefID = item.CMN_PRO_Product_RefID, }; newProduct.Save(Connection, Transaction); productsMapping.Add(item.CMN_PRO_Catalog_ProductID, newProduct.CMN_PRO_Catalog_ProductID); } #endregion #region ProductGroups var oldGroups = ORM_CMN_PRO_Catalog_ProductGroup.Query.Search(Connection, Transaction, new ORM_CMN_PRO_Catalog_ProductGroup.Query() { Catalog_Revision_RefID = rev.CMN_PRO_Catalog_RevisionID, IsDeleted = false }); //oldGroupID - newGroupID Dictionary <Guid, Guid> groupsMapping = new Dictionary <Guid, Guid>(); groupsMapping.Add(Guid.Empty, Guid.Empty); foreach (var item in oldGroups) { groupsMapping.Add(item.CMN_PRO_Catalog_ProductGroupID, Guid.NewGuid()); } foreach (var item in oldGroups) { var newGroup = new ORM_CMN_PRO_Catalog_ProductGroup() { CMN_PRO_Catalog_ProductGroupID = groupsMapping[item.CMN_PRO_Catalog_ProductGroupID], Catalog_Revision_RefID = newRev.CMN_PRO_Catalog_RevisionID, CatalogProductGroup_Name = item.CatalogProductGroup_Name, CatalogProductGroup_Parent_RefID = groupsMapping[item.CatalogProductGroup_Parent_RefID], Creation_Timestamp = DateTime.Now, Tenant_RefID = item.Tenant_RefID }; newGroup.Save(Connection, Transaction); var oldProductsInGroup = ORM_CMN_PRO_Catalog_Product_2_ProductGroup.Query.Search(Connection, Transaction, new ORM_CMN_PRO_Catalog_Product_2_ProductGroup.Query() { CMN_PRO_Catalog_ProductGroup_RefID = item.CMN_PRO_Catalog_ProductGroupID, IsDeleted = false }); foreach (var product in oldProductsInGroup) { var newProduct = new ORM_CMN_PRO_Catalog_Product_2_ProductGroup() { AssignmentID = Guid.NewGuid(), CMN_PRO_Catalog_ProductGroup_RefID = groupsMapping[product.CMN_PRO_Catalog_ProductGroup_RefID], CMN_PRO_Catalog_Product_RefID = productsMapping[product.CMN_PRO_Catalog_Product_RefID], Creation_Timestamp = DateTime.Now, Tenant_RefID = item.Tenant_RefID }; newProduct.Save(Connection, Transaction); } } #endregion returnValue.Result.Status_Code = 1; returnValue.Result.Status_Message = "Success"; returnValue.Result.ID = newRev.CMN_PRO_Catalog_RevisionID; return(returnValue); #endregion UserCode }
protected static FR_L6PO_GPfCOCM_1502 Execute(DbConnection Connection, DbTransaction Transaction, P_L6PO_GPfCOCM_1502 Parameter, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null) { #region UserCode var returnValue = new FR_L6PO_GPfCOCM_1502(); returnValue.Result = new L6PO_GPfCOCM_1502(); #region Get Languages P_L2LN_GALFTID_1530 langParam = new P_L2LN_GALFTID_1530(); langParam.Tenant_RefID = securityTicket.TenantID; var DBLanguages = cls_Get_All_Languages_ForTenantID.Invoke(Connection, Transaction, langParam, securityTicket).Result; var LanguageID = DBLanguages.Where(i => i.ISO_639_1 == "DE").SingleOrDefault().CMN_LanguageID; #endregion #region ORM_ORD_PRC_ProcurementOrder_Header var procurementHeader = new ORM_ORD_PRC_ProcurementOrder_Header(); procurementHeader.Load(Connection, Transaction, Parameter.ProcurementHeaderID); #endregion #region ORM_ORD_PRC_ProcurementOrder_Positions var paramShoppingProducts = new P_L5PO_GPPaSCIfH_1750(); paramShoppingProducts.ProcurementOrderHeaderID = Parameter.ProcurementHeaderID; var shoppingProducts = cls_Get_ProcurementPositions_and_ShoppingCartInfo_for_HeaderID.Invoke(Connection, Transaction, paramShoppingProducts, securityTicket).Result; #endregion #region Positions var positions = new List <L6PO_GPfCOCM_1502a>(); foreach (var shoppingProduct in shoppingProducts) { var product = new ORM_CMN_PRO_Product(); product.Load(Connection, Transaction, shoppingProduct.CMN_PRO_Product_RefID); if (String.IsNullOrEmpty(product.ProductITL)) { product.ProductITL = Guid.NewGuid().ToString(); product.Save(Connection, Transaction); } var catalogSubscription = new ORM_CMN_PRO_SubscribedCatalog(); catalogSubscription.Load(Connection, Transaction, product.IfImportedFromExternalCatalog_CatalogSubscription_RefID); var position = new L6PO_GPfCOCM_1502a(); position.ProductITL = product.ProductITL; position.ProductNumber = product.Product_Number; position.ProductName = product.Product_Name.GetContent(LanguageID); position.ProductDescription = product.Product_Description.GetContent(LanguageID); position.Comment = "NotDefinedBySender"; position.Quantity = shoppingProduct.Position_Quantity; position.IsProductReplacementAllowed = shoppingProduct.IsProductReplacementAllowed; position.SourceCatalogITL = catalogSubscription.CatalogCodeITL; position.UnitPrice = shoppingProduct.Position_ValuePerUnit; position.NetoPrice = shoppingProduct.Position_ValueTotal; var shoppingCart2Office = ORM_ORD_PRC_Office_ShoppingCart.Query.Search(Connection, Transaction, new ORM_ORD_PRC_Office_ShoppingCart.Query { ORD_PRC_ShoppingCart_RefID = shoppingProduct.ORD_PRC_ShoppingCart_RefID, IsDeleted = false, Tenant_RefID = securityTicket.TenantID } ).Single(); position.Quantites = new L6PO_GPfCOCM_1502b[] { new L6PO_GPfCOCM_1502b() { OfficeID = shoppingCart2Office.CMN_STR_Office_RefID, Quantity = shoppingProduct.Position_Quantity } }; positions.Add(position); } #endregion #region Comments var procurmentNotes = ORM_ORD_PRC_ProcurementOrder_Note.Query.Search(Connection, Transaction, new ORM_ORD_PRC_ProcurementOrder_Note.Query() { ORD_PRC_ProcurementOrder_Header_RefID = procurementHeader.ORD_PRC_ProcurementOrder_HeaderID, IsDeleted = false }).ToList(); var comments = new List <L6PO_GPfCOCM_1502c>(); foreach (var note in procurmentNotes) { comments.Add( new L6PO_GPfCOCM_1502c() { OfficeID = note.CMN_STR_Office_RefID, Content = note.Comment, PublilshDate = note.NotePublishDate, SequenceNumber = note.SequenceOrderNumber, Title = note.Title } ); } #endregion returnValue.Result.ProcurProcurementHeaderID = procurementHeader.ORD_PRC_ProcurementOrder_HeaderID; returnValue.Result.OrderNumber = procurementHeader.ProcurementOrder_Number; returnValue.Result.ProcurementOrderDate = procurementHeader.ProcurementOrder_Date; returnValue.Result.Comments = comments.ToArray(); returnValue.Result.Positions = positions.ToArray(); return(returnValue); #endregion UserCode }
protected static FR_L5SO_RSP_1524 Execute(DbConnection Connection, DbTransaction Transaction, P_L5SO_RSP_1524 Parameter, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null) { #region UserCode var returnValue = new FR_L5SO_RSP_1524(); returnValue.Result = new L5SO_RSP_1524(); var shipmentPositionToReplace = new ORM_LOG_SHP_Shipment_Position(); shipmentPositionToReplace.Load(Connection, Transaction, Parameter.PositionID); var startProduct = new ORM_CMN_PRO_Product(); startProduct.Load(Connection, Transaction, shipmentPositionToReplace.CMN_PRO_Product_RefID); var finalProduct = new ORM_CMN_PRO_Product(); finalProduct.Load(Connection, Transaction, Parameter.ProductID); shipmentPositionToReplace.ShipmentPosition_PricePerUnitValueWithoutTax = Parameter.Price; shipmentPositionToReplace.ShipmentPosition_ValueWithoutTax = Parameter.Price * (Decimal)shipmentPositionToReplace.QuantityToShip; shipmentPositionToReplace.CMN_PRO_Product_RefID = Parameter.ProductID; returnValue.Result.ReplacedPosition = new FR_Guid(shipmentPositionToReplace.Save(Connection, Transaction), shipmentPositionToReplace.LOG_SHP_Shipment_PositionID).Result; P_L2LN_GALFTID_1530 langParam = new P_L2LN_GALFTID_1530(); langParam.Tenant_RefID = securityTicket.TenantID; SessionSecurityTicket fakeTicket = new SessionSecurityTicket(); var DBLanguages = cls_Get_All_Languages_ForTenantID.Invoke(Connection, Transaction, langParam, fakeTicket).Result; var languages = DBLanguages.Select(i => new ISOLanguage() { ISO = i.ISO_639_1, LanguageID = i.CMN_LanguageID }).ToList(); var dicts = EnumUtils.GetDictObjectsForStaticListData <ECustomMessages>(ResourceFilePath.CustomMessages, ORM_LOG_SHP_Shipment_Note.TableName, languages); ORM_LOG_SHP_Shipment_Note note = new ORM_LOG_SHP_Shipment_Note(); note.LOG_SHP_Shipment_NoteID = Guid.NewGuid(); note.Shipment_Header_RefID = Parameter.ShipmentHeaderID; note.Comment = String.Format(dicts["comment.article-replaced"].Contents[1].Content, startProduct.Product_Name.Contents[0].Content, startProduct.Product_Number, finalProduct.Product_Name.Contents[0].Content, finalProduct.Product_Number); note.Tenant_RefID = securityTicket.TenantID; note.IsNotePrintedOnDeliveryPaper = true; note.Save(Connection, Transaction); returnValue.Result.ReplacedPosition = new FR_Guid(shipmentPositionToReplace.Save(Connection, Transaction), shipmentPositionToReplace.LOG_SHP_Shipment_PositionID).Result; ORM_LOG_RSV_Reservation.Query.SoftDelete(Connection, Transaction, new ORM_LOG_RSV_Reservation.Query { LOG_SHP_Shipment_Position_RefID = shipmentPositionToReplace.LOG_SHP_Shipment_PositionID, IsDeleted = false }); #region CommentedUseful #endregion cls_Update_Current_TotalValue_on_ShipmentHeader_from_Positions.Invoke(Connection, Transaction, new P_L5SO_UCTVoSHfP_1549 { ShipmentHeaderID = Parameter.ShipmentHeaderID }, securityTicket); return(returnValue); #endregion UserCode }
protected static FR_Base Execute(DbConnection Connection, DbTransaction Transaction, P_L3_DPPfID_1421 Parameter, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null) { //Leave UserCode region to enable user code saving #region UserCode var returnValue = new FR_Base(); //Put your code here var productID = Parameter.ProductID; ORM_CMN_PRO_Product product = new ORM_CMN_PRO_Product(); product.Load(Connection, Transaction, productID); var DocumentationStructure = product.Product_DocumentationStructure_RefID; product.Product_DocumentationStructure_RefID = Guid.Empty; product.Save(Connection, Transaction); ////////////////////////////////////////////////////////////////////////////////////// ORM_DOC_Document_2_Structure.Query documentToStructure = new ORM_DOC_Document_2_Structure.Query(); documentToStructure.StructureHeader_RefID = DocumentationStructure; documentToStructure.Tenant_RefID = securityTicket.TenantID; documentToStructure.IsDeleted = false; var documentStructure = ORM_DOC_Document_2_Structure.Query.Search(Connection, Transaction, documentToStructure); var doc_documentID = documentStructure.Count() > 0 ? documentStructure.Select(x => x.Document_RefID).FirstOrDefault() : Guid.Empty; ORM_DOC_Document_2_Structure.Query.SoftDelete(Connection, Transaction, documentToStructure); ////////////////////////////////////////////////////////////////////////////////////// ORM_DOC_Document.Query document = new ORM_DOC_Document.Query(); document.DOC_DocumentID = doc_documentID; document.Tenant_RefID = securityTicket.TenantID; document.IsDeleted = false; ORM_DOC_Document.Query.SoftDelete(Connection, Transaction, document); ///////////////////////////////////////////////////////////////////////////////////// ORM_DOC_Structure.Query structure = new ORM_DOC_Structure.Query(); structure.Structure_Header_RefID = DocumentationStructure; structure.Tenant_RefID = securityTicket.TenantID; structure.IsDeleted = false; ORM_DOC_Structure.Query.SoftDelete(Connection, Transaction, structure); ///////////////////////////////////////////////////////////////////////////////////// ORM_DOC_Structure_Header.Query structureHeader = new ORM_DOC_Structure_Header.Query(); structureHeader.DOC_Structure_HeaderID = DocumentationStructure; structureHeader.Tenant_RefID = securityTicket.TenantID; structureHeader.IsDeleted = false; ORM_DOC_Structure_Header.Query.SoftDelete(Connection, Transaction, structureHeader); return(returnValue); #endregion UserCode }
protected static FR_Guid Execute(DbConnection Connection, DbTransaction Transaction, P_L3MP_SP_1045 Parameter, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null) { //Leave UserCode region to enable user code saving #region UserCode var returnValue = new FR_Guid(); //languages P_L2LN_GALFTID_1530 languageTenandID = new P_L2LN_GALFTID_1530(); languageTenandID.Tenant_RefID = securityTicket.TenantID; List <L2LN_GALFTID_1530> DBLanguages = cls_Get_All_Languages_ForTenantID.Invoke(Connection, Transaction, languageTenandID, securityTicket).Result.ToList(); ORM_CMN_PRO_Product item = new ORM_CMN_PRO_Product(); if (Parameter.CMN_PRO_ProductID != null && Parameter.CMN_PRO_ProductID != Guid.Empty) { var result = item.Load(Connection, Transaction, Parameter.CMN_PRO_ProductID); if (result.Status != FR_Status.Success) { var error = new FR_Guid(); error.ErrorMessage = "No Such ID"; error.Status = FR_Status.Error_Internal; return(error); } #region Edit Dict _extProductDictName = new Dict("cmn_pro_products"); _extProductDictName = Parameter.Product_Name_DictID; if (_extProductDictName != null) { foreach (var entry in _extProductDictName.Contents) { item.Product_Name.UpdateEntry(entry.LanguageID, entry.Content); } } Dict _extProductDictDescription = new Dict("cmn_pro_products"); _extProductDictDescription = Parameter.Product_Description; if (_extProductDictDescription != null) { foreach (var entry in _extProductDictDescription.Contents) { item.Product_Description.UpdateEntry(entry.LanguageID, entry.Content); } } item.Product_Number = Parameter.Product_Number; return(new FR_Guid(item.Save(Connection, Transaction), item.CMN_PRO_ProductID)); #endregion } else { #region Save item.CMN_PRO_ProductID = Guid.NewGuid(); item.Creation_Timestamp = DateTime.Now; item.IsDeleted = false; Dict _extProductDictName = new Dict("cmn_pro_products"); _extProductDictName = Parameter.Product_Name_DictID; if (_extProductDictName != null) { foreach (var entry in _extProductDictName.Contents) { item.Product_Name.UpdateEntry(entry.LanguageID, entry.Content); } } Dict _extProductDictDescription = new Dict("cmn_pro_products"); _extProductDictDescription = Parameter.Product_Description; if (_extProductDictDescription != null) { foreach (var entry in _extProductDictDescription.Contents) { item.Product_Description.UpdateEntry(entry.LanguageID, entry.Content); } } item.Product_Number = Parameter.Product_Number; item.Tenant_RefID = securityTicket.TenantID; item.Modification_Timestamp = DateTime.MinValue; return(new FR_Guid(item.Save(Connection, Transaction), item.CMN_PRO_ProductID)); #endregion } return(returnValue); #endregion UserCode }
protected static FR_Base Execute(DbConnection Connection, DbTransaction Transaction, P_L5AS_SAP_1515 Parameter, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null) { #region UserCode var returnValue = new FR_Base(); var defaultLanguages = ORM_CMN_Language.Query.Search(Connection, Transaction, new ORM_CMN_Language.Query { IsDeleted = false, Tenant_RefID = securityTicket.TenantID }); List <P_L3AS_SAVP_0004> parameterVendorProduct = new List <P_L3AS_SAVP_0004>(); List <P_L3AS_SAVV_0040> parameterVendorVariants = new List <P_L3AS_SAVV_0040>(); #region ImportCatalogProducts foreach (var productFromCatalog in Parameter.Products.Where(x => !string.IsNullOrEmpty(x.ProductITL)).ToList()) { P_L5PR_IPfC_1648 importProductFromCatalogParameter = new P_L5PR_IPfC_1648(); importProductFromCatalogParameter.Product = new ProductsForImport(); importProductFromCatalogParameter.Product.CatalogITL = productFromCatalog.CatalogITL; importProductFromCatalogParameter.Product.Code = productFromCatalog.Code; importProductFromCatalogParameter.Product.Custom = productFromCatalog.Custom; importProductFromCatalogParameter.Product.Description = productFromCatalog.Description; importProductFromCatalogParameter.Product.Name = productFromCatalog.Name; importProductFromCatalogParameter.Product.LongName = productFromCatalog.LongName; importProductFromCatalogParameter.Product.ProductITL = productFromCatalog.ProductITL; importProductFromCatalogParameter.Product.Variants = new List <Variant>(); foreach (var variant in productFromCatalog.Variants) { importProductFromCatalogParameter.Product.Variants.Add(variant); } importProductFromCatalogParameter.Product.Customizations = new List <Customization>(); if (productFromCatalog.Customizations != null) { foreach (var customization in productFromCatalog.Customizations) { importProductFromCatalogParameter.Product.Customizations.Add(customization); } } importProductFromCatalogParameter.Product.Vat = productFromCatalog.Vat; Guid productID = cls_Import_Product_from_Catalog.Invoke(Connection, Transaction, importProductFromCatalogParameter, securityTicket).Result; Parameter.Products.Where(x => x.ProductITL == productFromCatalog.ProductITL).ToList().ForEach(x => x.LocalProductID = productID); } #endregion import foreach (var parameterProduct in Parameter.Products) { ORM_CMN_PRO_Product productDB = new ORM_CMN_PRO_Product(); #region loadProduct productDB.Load(Connection, Transaction, parameterProduct.LocalProductID); Guid originalProductId = productDB.CMN_PRO_ProductID; #endregion P_L3AS_GNoPiAfP_1512 parameterAssortmentProductExists = new P_L3AS_GNoPiAfP_1512(); parameterAssortmentProductExists.AssortmentID = Parameter.AssortmentID; parameterAssortmentProductExists.ProductRefID = originalProductId; int numberOfProductsInAssortment = cls_Get_Number_of_Products_in_Assortment_for_ProductID.Invoke(Connection, Transaction, parameterAssortmentProductExists, securityTicket).Result.NumberOfProducts; if (numberOfProductsInAssortment == 0) { #region SaveProductCopy ORM_CMN_PRO_Product productCopyToCreate = new ORM_CMN_PRO_Product(); productCopyToCreate.CMN_PRO_ProductID = Guid.NewGuid(); productCopyToCreate.ProductITL = string.Empty; productCopyToCreate.IsProduct_Article = true; productCopyToCreate.IsProductAvailableForOrdering = true; productCopyToCreate.IsImportedFromExternalCatalog = false; productCopyToCreate.IsProductForInternalDistributionOnly = true; productCopyToCreate.Product_Name = new Dict(ORM_CMN_PRO_Product.TableName); productCopyToCreate.Product_Description = new Dict(ORM_CMN_PRO_Product.TableName); productCopyToCreate.PackageInfo_RefID = Guid.NewGuid(); productCopyToCreate.Creation_Timestamp = DateTime.Now; productCopyToCreate.Tenant_RefID = securityTicket.TenantID; productCopyToCreate.IsDeleted = false; productCopyToCreate.Save(Connection, Transaction); productCopyToCreate.Product_Number = productDB.Product_Number; foreach (var lang in defaultLanguages) { productCopyToCreate.Product_Name.UpdateEntry(lang.CMN_LanguageID, productDB.Product_Name.Contents.FirstOrDefault().Content); productCopyToCreate.Product_Description.UpdateEntry(lang.CMN_LanguageID, productDB.Product_Description.Contents.FirstOrDefault().Content); } productCopyToCreate.ProductType_RefID = Guid.Empty; productCopyToCreate.ProductSuccessor_RefID = Guid.Empty; productCopyToCreate.IsDeleted = false; var productDocumentStructureRefID = Guid.NewGuid(); if (productDB.Product_DocumentationStructure_RefID != Guid.Empty) { productCopyToCreate.Product_DocumentationStructure_RefID = productDocumentStructureRefID; } productCopyToCreate.Save(Connection, Transaction); #endregion #region copyPicture if (productDB.Product_DocumentationStructure_RefID != Guid.Empty) { var documentStructureHeaders = ORM_DOC_Structure_Header.Query.Search(Connection, Transaction, new ORM_DOC_Structure_Header.Query { DOC_Structure_HeaderID = productDB.Product_DocumentationStructure_RefID }); if (documentStructureHeaders != null && documentStructureHeaders.Count() > 0) { var documentStructureHeader = documentStructureHeaders.First(); ORM_DOC_Structure_Header docStructureHeaderToCreate = new ORM_DOC_Structure_Header(); docStructureHeaderToCreate.DOC_Structure_HeaderID = productDocumentStructureRefID; docStructureHeaderToCreate.IsDeleted = false; docStructureHeaderToCreate.Label = documentStructureHeader.Label; docStructureHeaderToCreate.Tenant_RefID = securityTicket.TenantID; docStructureHeaderToCreate.Save(Connection, Transaction); var documentStructures = ORM_DOC_Structure.Query.Search(Connection, Transaction, new ORM_DOC_Structure.Query { Structure_Header_RefID = documentStructureHeader.DOC_Structure_HeaderID }); var documentStructureID = Guid.NewGuid(); if (documentStructures != null && documentStructures.Count() > 0) { var documentStructure = documentStructures.First(); ORM_DOC_Structure structureToCreate = new ORM_DOC_Structure(); structureToCreate.Label = "Product picture"; structureToCreate.DOC_StructureID = documentStructureID; structureToCreate.Structure_Header_RefID = docStructureHeaderToCreate.DOC_Structure_HeaderID; structureToCreate.CreatedBy_Account_RefID = securityTicket.AccountID; structureToCreate.Tenant_RefID = securityTicket.TenantID; structureToCreate.Save(Connection, Transaction); var document2DocumentStructures = ORM_DOC_Document_2_Structure.Query.Search(Connection, Transaction, new ORM_DOC_Document_2_Structure.Query { Structure_RefID = documentStructure.DOC_StructureID }); if (document2DocumentStructures != null && document2DocumentStructures.Count() > 0) { var document2DocumentStructure = document2DocumentStructures.First(); var documentService = InfrastructureFactory.CreateDocumentService(); var webClient = new WebClient(); var imageBytes = webClient.DownloadData(documentService.GenerateDownloadLink(document2DocumentStructure.Document_RefID)); var documentID = documentService.UploadDocument(imageBytes, productCopyToCreate.Product_Number, securityTicket.SessionTicket, null, null); ORM_DOC_Document documentToCreate = new ORM_DOC_Document(); documentToCreate.DOC_DocumentID = documentID; documentToCreate.Tenant_RefID = securityTicket.TenantID; documentToCreate.Save(Connection, Transaction); ORM_DOC_Document_2_Structure documentStructureToSave = new ORM_DOC_Document_2_Structure(); documentStructureToSave.Document_RefID = documentToCreate.DOC_DocumentID; documentStructureToSave.Structure_RefID = structureToCreate.DOC_StructureID; documentStructureToSave.StructureHeader_RefID = docStructureHeaderToCreate.DOC_Structure_HeaderID; documentStructureToSave.Tenant_RefID = securityTicket.TenantID; documentStructureToSave.Save(Connection, Transaction); } } } } #endregion var dimensionsDb = ORM_CMN_PRO_Dimension.Query.Search(Connection, Transaction, new ORM_CMN_PRO_Dimension.Query { IsDeleted = false, Tenant_RefID = securityTicket.TenantID, Product_RefID = originalProductId }); List <ORM_CMN_PRO_Dimension_Value> dimensionValuesToCreate = new List <ORM_CMN_PRO_Dimension_Value>(); #region SaveDimensions foreach (var dimensionDb in dimensionsDb) { var dimensionName = dimensionDb.DimensionName; var dimensionID = dimensionDb.CMN_PRO_DimensionID; ORM_CMN_PRO_Dimension dimensionCopyToCreate = new ORM_CMN_PRO_Dimension(); dimensionCopyToCreate.CMN_PRO_DimensionID = Guid.NewGuid(); dimensionCopyToCreate.Creation_Timestamp = DateTime.Now; dimensionCopyToCreate.DimensionName = new Dict(ORM_CMN_PRO_Dimension.TableName); dimensionCopyToCreate.IsDeleted = false; dimensionCopyToCreate.IsDimensionTemplate = false; dimensionCopyToCreate.Product_RefID = productCopyToCreate.CMN_PRO_ProductID; dimensionCopyToCreate.Tenant_RefID = securityTicket.TenantID; dimensionCopyToCreate.OrderSequence = dimensionDb.OrderSequence; dimensionCopyToCreate.Modification_Timestamp = DateTime.Now; dimensionCopyToCreate.Save(Connection, Transaction); foreach (var lang in defaultLanguages) { dimensionCopyToCreate.DimensionName.UpdateEntry(lang.CMN_LanguageID, dimensionName.Contents.FirstOrDefault().Content); } dimensionCopyToCreate.Save(Connection, Transaction); var dimensionValuesDb = ORM_CMN_PRO_Dimension_Value.Query.Search(Connection, Transaction, new ORM_CMN_PRO_Dimension_Value.Query { Tenant_RefID = securityTicket.TenantID, IsDeleted = false, Dimensions_RefID = dimensionID }); dimensionValuesDb.ForEach(x => x.Dimensions_RefID = dimensionCopyToCreate.CMN_PRO_DimensionID); dimensionValuesToCreate.AddRange(dimensionValuesDb); } #endregion var productVariantsDb = ORM_CMN_PRO_Product_Variant.Query.Search(Connection, Transaction, new ORM_CMN_PRO_Product_Variant.Query { Tenant_RefID = securityTicket.TenantID, IsDeleted = false, CMN_PRO_Product_RefID = originalProductId }); #region AssortmentProductSave ORM_CMN_PRO_ASS_AssortmentProduct assortmentProductToCreate = new ORM_CMN_PRO_ASS_AssortmentProduct(); assortmentProductToCreate.CMN_PRO_ASS_AssortmentProductID = Guid.NewGuid(); assortmentProductToCreate.Ext_CMN_PRO_Product_RefID = productCopyToCreate.CMN_PRO_ProductID; assortmentProductToCreate.IsDeleted = false; assortmentProductToCreate.Tenant_RefID = securityTicket.TenantID; assortmentProductToCreate.Save(Connection, Transaction); #endregion #region Assortment Vendor Product Save P_L3AS_SAVP_0004 parameterVendorProductItem = new P_L3AS_SAVP_0004(); parameterVendorProductItem.AssortmentProductID = assortmentProductToCreate.CMN_PRO_ASS_AssortmentProductID; parameterVendorProductItem.ProductRefID = originalProductId; parameterVendorProduct.Add(parameterVendorProductItem); ORM_CMN_PRO_ASS_AssortmentProduct_VendorProduct assortmentVendorProductToCreate = new ORM_CMN_PRO_ASS_AssortmentProduct_VendorProduct(); #endregion #region Assortment2Assortment Product save ORM_CMN_PRO_ASS_Assortment_2_AssortmentProduct assortmentToAssortmentProductToCreate = new ORM_CMN_PRO_ASS_Assortment_2_AssortmentProduct(); assortmentToAssortmentProductToCreate.AssignmentID = Guid.NewGuid(); assortmentToAssortmentProductToCreate.CMN_PRO_ASS_Assortment_Product_RefID = assortmentProductToCreate.CMN_PRO_ASS_AssortmentProductID; assortmentToAssortmentProductToCreate.CMN_PRO_ASS_Assortment_RefID = Parameter.AssortmentID; assortmentToAssortmentProductToCreate.IsDeleted = false; assortmentToAssortmentProductToCreate.Tenant_RefID = securityTicket.TenantID; assortmentToAssortmentProductToCreate.Save(Connection, Transaction); #endregion List <ORM_CMN_PRO_Variant_DimensionValue> variantDimensionValueAssignmentToCreate = new List <ORM_CMN_PRO_Variant_DimensionValue>(); foreach (var productVariantDb in productVariantsDb) { #region ProductVariant Save ORM_CMN_PRO_ASS_DistributionPrice distributionPriceToCreate = new ORM_CMN_PRO_ASS_DistributionPrice(); distributionPriceToCreate.CMN_PRO_ASS_DistributionPriceID = Guid.NewGuid(); distributionPriceToCreate.IsDeleted = false; distributionPriceToCreate.Tenant_RefID = securityTicket.TenantID; distributionPriceToCreate.Save(Connection, Transaction); ORM_CMN_PRO_Product_Variant productVariantToCreate = new ORM_CMN_PRO_Product_Variant(); productVariantToCreate.CMN_PRO_Product_VariantID = Guid.NewGuid(); productVariantToCreate.CMN_PRO_Product_RefID = productCopyToCreate.CMN_PRO_ProductID; productVariantToCreate.Creation_Timestamp = DateTime.Now; productVariantToCreate.Tenant_RefID = securityTicket.TenantID; productVariantToCreate.ProductVariantITL = ""; productVariantToCreate.ProductVariant_DocumentationStructure_RefID = Guid.Empty; productVariantToCreate.VariantName = new Dict(ORM_CMN_PRO_Product_Variant.TableName); productVariantToCreate.IsDeleted = false; productVariantToCreate.IsStandardProductVariant = productVariantDb.IsStandardProductVariant; productVariantToCreate.IsImportedFromExternalCatalog = false; productVariantToCreate.Modification_Timestamp = DateTime.Now; productVariantToCreate.Save(Connection, Transaction); foreach (var lang in defaultLanguages) { productVariantToCreate.VariantName.UpdateEntry(lang.CMN_LanguageID, productVariantDb.VariantName.Contents.FirstOrDefault().Content); } productVariantToCreate.Save(Connection, Transaction); #endregion #region dimensionValuesAssignemnt var assignmentExists = ORM_CMN_PRO_Variant_DimensionValue.Query.Search(Connection, Transaction, new ORM_CMN_PRO_Variant_DimensionValue.Query { Tenant_RefID = securityTicket.TenantID, ProductVariant_RefID = productVariantDb.CMN_PRO_Product_VariantID }); foreach (var variantAssignment in assignmentExists) { variantAssignment.IsDeleted = false; variantAssignment.ProductVariant_RefID = productVariantToCreate.CMN_PRO_Product_VariantID; variantAssignment.Tenant_RefID = securityTicket.TenantID; variantDimensionValueAssignmentToCreate.Add(variantAssignment); } #endregion #region AddVariantToAssortment ORM_CMN_PRO_ASS_AssortmentVariant assortmentVariantToCreate = new ORM_CMN_PRO_ASS_AssortmentVariant(); assortmentVariantToCreate.CMN_PRO_ASS_AssortmentVariantID = Guid.NewGuid(); assortmentVariantToCreate.Ext_CMN_PRO_Product_Variant_RefID = productVariantToCreate.CMN_PRO_Product_VariantID; assortmentVariantToCreate.IsDeleted = false; assortmentVariantToCreate.DistributionPrice_RefID = distributionPriceToCreate.CMN_PRO_ASS_DistributionPriceID; assortmentVariantToCreate.Tenant_RefID = securityTicket.TenantID; assortmentVariantToCreate.Save(Connection, Transaction); #endregion P_L3AS_SAVV_0040 parameterVendorVariantItem = new P_L3AS_SAVV_0040(); parameterVendorVariantItem.AssortmentVariantID = assortmentVariantToCreate.CMN_PRO_ASS_AssortmentVariantID; parameterVendorVariantItem.ProductVariantID = productVariantDb.CMN_PRO_Product_VariantID; parameterVendorVariantItem.OrderSequence = 1; parameterVendorVariantItem.IsDefaultVendorVariant = true; parameterVendorVariants.Add(parameterVendorVariantItem); } #region SaveDimensionValuesAndAssignment foreach (var dimensionValueToCreate in dimensionValuesToCreate) { var valueName = dimensionValueToCreate.DimensionValue_Text; var valueID = dimensionValueToCreate.CMN_PRO_Dimension_ValueID; ORM_CMN_PRO_Dimension_Value dimensionValueToCreateUpdate = new ORM_CMN_PRO_Dimension_Value(); dimensionValueToCreateUpdate.CMN_PRO_Dimension_ValueID = Guid.NewGuid(); dimensionValueToCreateUpdate.Creation_Timestamp = DateTime.Now; dimensionValueToCreateUpdate.DimensionValue_Text = new Dict(ORM_CMN_PRO_Dimension_Value.TableName); dimensionValueToCreateUpdate.Dimensions_RefID = dimensionValueToCreate.Dimensions_RefID; dimensionValueToCreateUpdate.IsDeleted = false; dimensionValueToCreateUpdate.Tenant_RefID = securityTicket.TenantID; dimensionValueToCreateUpdate.Modification_Timestamp = DateTime.Now; dimensionValueToCreateUpdate.OrderSequence = dimensionValueToCreate.OrderSequence; dimensionValueToCreateUpdate.Save(Connection, Transaction); foreach (var lang in defaultLanguages) { dimensionValueToCreateUpdate.DimensionValue_Text.UpdateEntry(lang.CMN_LanguageID, valueName.Contents.FirstOrDefault().Content); } dimensionValueToCreateUpdate.Save(Connection, Transaction); var assignments = variantDimensionValueAssignmentToCreate.Where(x => x.DimensionValue_RefID == valueID).ToList(); foreach (var assignment in assignments) { ORM_CMN_PRO_Variant_DimensionValue assignmentToSave = new ORM_CMN_PRO_Variant_DimensionValue(); assignmentToSave.CMN_PRO_Variant_DimensionValueID = Guid.NewGuid(); assignmentToSave.Creation_Timestamp = DateTime.Now; assignmentToSave.DimensionValue_RefID = dimensionValueToCreateUpdate.CMN_PRO_Dimension_ValueID; assignmentToSave.IsDeleted = false; assignmentToSave.Modification_Timestamp = DateTime.Now; assignmentToSave.ProductVariant_RefID = assignment.ProductVariant_RefID; assignmentToSave.Tenant_RefID = securityTicket.TenantID; assignmentToSave.Save(Connection, Transaction); } } #endregion } } cls_Save_Assortment_Vendor_Products.Invoke(Connection, Transaction, parameterVendorProduct.ToArray(), securityTicket); cls_Save_Assortment_Vendor_Variants.Invoke(Connection, Transaction, parameterVendorVariants.ToArray(), securityTicket); return(returnValue); #endregion UserCode }
protected static FR_L3AR_IoUPfSC_1325_Array Execute(DbConnection Connection, DbTransaction Transaction, P_L3AR_IoUPfSC_1325 Parameter, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null) { #region UserCode var returnValue = new FR_L3AR_IoUPfSC_1325_Array(); var importedProducts = new List <L3AR_IoUPfSC_1325>(); #region ABDA catalog var catalogQuery = new ORM_CMN_PRO_SubscribedCatalog.Query(); catalogQuery.Tenant_RefID = securityTicket.TenantID; catalogQuery.IsDeleted = false; catalogQuery.CatalogCodeITL = EnumUtils.GetEnumDescription(EPublicCatalogs.ABDA); var abdaCatalog = ORM_CMN_PRO_SubscribedCatalog.Query.Search(Connection, Transaction, catalogQuery).SingleOrDefault(); #endregion #region ImportOrUpdate Product's BaseData var param = new P_L3AR_IoUPBD_1631(); var products = Parameter.Products.Select(item => new P_L3AR_IoUPBD_1631a() { ProductITL = item.ProductITL, Product_Name = item.Product_Name, Product_Description = item.Product_Description, Product_Number = item.Product_Number, Dosage = item.Dosage, Amount = item.Amount, MeasuredInUnit_ISO_um_ums = item.MeasuredInUnit_ISO_um_ums, VAT = Double.Parse(item.VAT), Producer = item.Producer, DistributionStatus = item.DistributionStatus, DefaultExpirationPeriod_in_sec = item.DefaultExpirationPeriod_in_sec, DefaultStorageTemperature_min_in_kelvin = item.DefaultStorageTemperature_min_in_kelvin, DefaultStorageTemperature_max_in_kelvin = item.DefaultStorageTemperature_max_in_kelvin, IsStorage_CoolingRequired = item.IsStorage_CoolingRequired, IsProduct_AddictiveDrug = item.IsProduct_AddictiveDrug, ActiveComponents = item.ActiveComponents, IsPharmacyOnlyDistribution = item.IsPharmacyOnlyDistribution }).ToArray(); param.Products = products; var importedProductsBaseData = cls_ImportOrUpdate_Products_BaseData.Invoke(Connection, Transaction, param, securityTicket).Result; #endregion foreach (var importedProductBaseData in importedProductsBaseData) { var currentParameter = Parameter.Products.SingleOrDefault(i => i.ProductITL == importedProductBaseData.ProductITL); var product = new ORM_CMN_PRO_Product(); product.Load(Connection, Transaction, importedProductBaseData.ProductID); if (!importedProductBaseData.IsAlreadyExisted) { product.IfImportedFromExternalCatalog_CatalogSubscription_RefID = Parameter.SubscribedCatalogID; product.IsImportedFromExternalCatalog = true; product.Save(Connection, Transaction); ORM_CMN_PRO_Product_2_ProductGroup product_2_productGroup = new ORM_CMN_PRO_Product_2_ProductGroup(); product_2_productGroup.CMN_PRO_Product_RefID = product.CMN_PRO_ProductID; product_2_productGroup.CMN_PRO_ProductGroup_RefID = Parameter.ProductGroupID; product_2_productGroup.Tenant_RefID = securityTicket.TenantID; product_2_productGroup.Creation_Timestamp = DateTime.Now; product_2_productGroup.Save(Connection, Transaction); } else { #region Update Product_2_ProductGroup var groupsParam = new P_CL2_MP_GAPGfP_1735(); groupsParam.ProductID = product.CMN_PRO_ProductID; var productGroups = cls_Get_All_ProductGroups_for_ProductID.Invoke(Connection, Transaction, groupsParam, securityTicket).Result; var abdaGroup = productGroups.Where(i => i.GlobalPropertyMatchingID == EnumUtils.GetEnumDescription(EProductGroup.ABDA)).FirstOrDefault(); var houselistGroup = productGroups.Where(i => i.GlobalPropertyMatchingID == EnumUtils.GetEnumDescription(EProductGroup.HauseList)).FirstOrDefault(); if (abdaGroup == default(CL2_MP_GAPGfP_1735)) { //it's not in abda if (houselistGroup == default(CL2_MP_GAPGfP_1735)) { //it's not in abda and it's not in houselist product.IfImportedFromExternalCatalog_CatalogSubscription_RefID = Parameter.SubscribedCatalogID; product.IsImportedFromExternalCatalog = true; product.Save(Connection, Transaction); } else { //it's not in abda but it's in houselist //check if new import isn't from abda //it could be new house list if (abdaCatalog == null || abdaCatalog.CMN_PRO_SubscribedCatalogID != Parameter.SubscribedCatalogID) { product.IfImportedFromExternalCatalog_CatalogSubscription_RefID = Parameter.SubscribedCatalogID; product.IsImportedFromExternalCatalog = true; product.Save(Connection, Transaction); } } } else { //it's in abda if (houselistGroup == default(CL2_MP_GAPGfP_1735)) { //it's in abda but it's not in houselist //it could be house list or just update abda product.IfImportedFromExternalCatalog_CatalogSubscription_RefID = Parameter.SubscribedCatalogID; product.IsImportedFromExternalCatalog = true; product.Save(Connection, Transaction); } else { //it's in abda and it's in houselist //check if new import isn't from abda //it could be only house list if (abdaCatalog.CMN_PRO_SubscribedCatalogID != Parameter.SubscribedCatalogID) { product.IfImportedFromExternalCatalog_CatalogSubscription_RefID = Parameter.SubscribedCatalogID; product.IsImportedFromExternalCatalog = true; product.Save(Connection, Transaction); } } } var isAlreadyInGroup = ORM_CMN_PRO_Product_2_ProductGroup.Query.Exists(Connection, Transaction, new ORM_CMN_PRO_Product_2_ProductGroup.Query() { CMN_PRO_Product_RefID = product.CMN_PRO_ProductID, CMN_PRO_ProductGroup_RefID = Parameter.ProductGroupID, Tenant_RefID = securityTicket.TenantID }); if (!isAlreadyInGroup) { ORM_CMN_PRO_Product_2_ProductGroup product_2_productGroup = new ORM_CMN_PRO_Product_2_ProductGroup(); product_2_productGroup.CMN_PRO_Product_RefID = product.CMN_PRO_ProductID; product_2_productGroup.CMN_PRO_ProductGroup_RefID = Parameter.ProductGroupID; product_2_productGroup.Tenant_RefID = securityTicket.TenantID; product_2_productGroup.Creation_Timestamp = DateTime.Now; product_2_productGroup.Save(Connection, Transaction); } #endregion } #region Default Price var price = ORM_CMN_SLS_Price.Query.Search(Connection, Transaction, new ORM_CMN_SLS_Price.Query() { PricelistRelease_RefID = Parameter.PriceListReleaseID, CMN_PRO_Product_RefID = product.CMN_PRO_ProductID, Tenant_RefID = securityTicket.TenantID, CMN_Currency_RefID = Parameter.CatalogCurrencyID, IsDeleted = false }).SingleOrDefault(); if (price == null) { price = new ORM_CMN_SLS_Price(); price.CMN_SLS_PriceID = Guid.NewGuid(); price.PricelistRelease_RefID = Parameter.PriceListReleaseID; price.CMN_PRO_Product_RefID = product.CMN_PRO_ProductID; price.CMN_Currency_RefID = Parameter.CatalogCurrencyID; price.Tenant_RefID = securityTicket.TenantID; price.Creation_Timestamp = DateTime.Now; } price.PriceAmount = currentParameter.Price; price.Save(Connection, Transaction); #endregion importedProducts.Add(new L3AR_IoUPfSC_1325() { ProductID = product.CMN_PRO_ProductID, ProductITL = product.ProductITL }); } returnValue.Result = importedProducts.ToArray(); return(returnValue); #endregion UserCode }