3.0.0.1 Demo repository registration

This commit is contained in:
Andy Howard
2025-02-08 16:41:08 +00:00
parent 0d8e7d5619
commit c4e5712d0a
312 changed files with 13145 additions and 30232 deletions
+66 -79
View File
@@ -1858,95 +1858,82 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Bus
/// <summary>Commodity status.</summary>
public StatusCat StatusCat { get; set; } = StatusCat.NotDeleted;
// Utilities.
public List<StringPair> GetDisplayValues(ISbmUserOrganisationContext userContext)
public List<StringPair> GetDisplayValues(SbmInternals internals)
{
SbmAccountMgr accountMgr = null;
List<StringPair> lValue = new List<StringPair>();
using (SbmSessionConsole sessionConsole = SbmGlobals.System.CreateSessionConsole(userContext))
{
// Commodities to exclude.
if (IdsIncluded.Count > 0) lValue.Add("Included commodities", IdsIncluded.Count.ToString());
if (IdsExcluded.Count > 0) lValue.Add("Excluded commodities", IdsExcluded.Count.ToString());
// Commodity type.
if (CommodityType > 0) lValue.Add("Type", SbmSystem.GetSystemCodes(Sbm.SystemCode.CommodityType).GetDescForType(CommodityType, CommodityType.ToString()));
else if (CommodityType == Sbm.CommodityType.AnyProduct) lValue.Add("Type", "Any product");
if (StockItemsOnly) lValue.Add("Stock items only", "True");
// Commodity code.
if (!StringUtil.IsEmpty(CodeFull)) lValue.Add("Code", CodeFull);
else if (!StringUtil.IsEmpty(CodePartial)) lValue.Add("Code contains", CodePartial);
// Drawing number.
if (!StringUtil.IsEmpty(DrawingNoFull)) lValue.Add("Drawing no", DrawingNoFull);
else if (!StringUtil.IsEmpty(DrawingNoPartial)) lValue.Add("Drawing no starts", DrawingNoPartial);
if (!StringUtil.IsEmpty(DrawingIssueFull)) lValue.Add("Drawing issue", DrawingIssueFull);
else if (!StringUtil.IsEmpty(DrawingIssuePartial)) lValue.Add("Drawing issue starts", DrawingIssuePartial);
// Commodity description.
if (!StringUtil.IsEmpty(DescBriefFull)) lValue.Add("Description", DescBriefFull);
if (!StringUtil.IsEmpty(DescBriefPartial)) lValue.Add("Description starts", DescBriefPartial);
// Category.
if (Categories.Count > 0) lValue.Add("Categories", Categories.Concat(","));
// Catalog reference.
if (!StringUtil.IsEmpty(CatalogRefPartial)) lValue.Add("Catalog ref start", CatalogRefPartial);
// Codings.
if (!StringUtil.IsEmpty(RangeCode)) lValue.Add("Range code", RangeCode);
if (!StringUtil.IsEmpty(ColourCode)) lValue.Add("Colour code", ColourCode);
if (!StringUtil.IsEmpty(SourceCode)) lValue.Add("Source code", SourceCode);
if (!StringUtil.IsEmpty(SupplyMethodCode)) lValue.Add("SupplyMethod code", SupplyMethodCode);
if (!StringUtil.IsEmpty(HandlingCode)) lValue.Add("Handling code", HandlingCode);
if (!StringUtil.IsEmpty(DeliveryCode)) lValue.Add("Delivery code", DeliveryCode);
if (!StringUtil.IsEmpty(MaterialCode)) lValue.Add(sessionConsole.GetAttributeCaption(SbmDbDfn.ColumnIdx.Commodity_MaterialCode, "Material") + " code", MaterialCode);
if (!StringUtil.IsEmpty(FinishCode)) lValue.Add(sessionConsole.GetAttributeCaption(SbmDbDfn.ColumnIdx.Commodity_FinishCode, "Finish") + " code", FinishCode);
if (!StringUtil.IsEmpty(PromotionCode)) lValue.Add(sessionConsole.GetAttributeCaption(SbmDbDfn.ColumnIdx.Commodity_PromotionCode, "Promotion") + " code", PromotionCode);
// Price sets.
if (PriceSetIdsIncluded.Count > 0) lValue.Add("Included in price sets", PriceSetIdsIncluded.Count.ToString());
if (PriceSetIdsExcluded.Count > 0) lValue.Add("Excluded from price sets", PriceSetIdsExcluded.Count.ToString());
// Customer.
if (SysId.IsValid(AssociationIdCustomer))
{
if (accountMgr == null) accountMgr = SbmGlobals.System.CreateAccountMgr(userContext);
lValue.Add("Customer", accountMgr.GetAssociationTargetName(AssociationIdCustomer));
}
if (!StringUtil.IsEmpty(CustomerName)) lValue.Add("Customer name starts", CustomerName);
if (!StringUtil.IsEmpty(SupplierName)) lValue.Add("Supplier name starts", SupplierName);
if (!StringUtil.IsEmpty(SalesOrderRef)) lValue.Add("SO reference starts", SalesOrderRef);
if (!StringUtil.IsEmpty(PurchaseOrderRef)) lValue.Add("PO reference starts", PurchaseOrderRef);
List<StringPair> values = new List<StringPair>();
// Commodities to exclude.
if (IdsIncluded.Count > 0) values.Add("Included commodities", IdsIncluded.Count.ToString());
if (IdsExcluded.Count > 0) values.Add("Excluded commodities", IdsExcluded.Count.ToString());
// Commodity type.
if (CommodityType > 0) values.Add("Type", SbmSystem.GetSystemCodes(Sbm.SystemCode.CommodityType).GetDescForType(CommodityType, CommodityType.ToString()));
else if (CommodityType == Sbm.CommodityType.AnyProduct) values.Add("Type", "Any product");
if (StockItemsOnly) values.Add("Stock items only", "True");
// Commodity code.
if (!StringUtil.IsEmpty(CodeFull)) values.Add("Code", CodeFull);
else if (!StringUtil.IsEmpty(CodePartial)) values.Add("Code contains", CodePartial);
// Drawing number.
if (!StringUtil.IsEmpty(DrawingNoFull)) values.Add("Drawing no", DrawingNoFull);
else if (!StringUtil.IsEmpty(DrawingNoPartial)) values.Add("Drawing no starts", DrawingNoPartial);
if (!StringUtil.IsEmpty(DrawingIssueFull)) values.Add("Drawing issue", DrawingIssueFull);
else if (!StringUtil.IsEmpty(DrawingIssuePartial)) values.Add("Drawing issue starts", DrawingIssuePartial);
// Commodity description.
if (!StringUtil.IsEmpty(DescBriefFull)) values.Add("Description", DescBriefFull);
if (!StringUtil.IsEmpty(DescBriefPartial)) values.Add("Description starts", DescBriefPartial);
// Category.
if (Categories.Count > 0) values.Add("Categories", Categories.Concat(","));
// Catalog reference.
if (!StringUtil.IsEmpty(CatalogRefPartial)) values.Add("Catalog ref start", CatalogRefPartial);
// Codings.
if (!StringUtil.IsEmpty(RangeCode)) values.Add("Range code", RangeCode);
if (!StringUtil.IsEmpty(ColourCode)) values.Add("Colour code", ColourCode);
if (!StringUtil.IsEmpty(SourceCode)) values.Add("Source code", SourceCode);
if (!StringUtil.IsEmpty(SupplyMethodCode)) values.Add("SupplyMethod code", SupplyMethodCode);
if (!StringUtil.IsEmpty(HandlingCode)) values.Add("Handling code", HandlingCode);
if (!StringUtil.IsEmpty(DeliveryCode)) values.Add("Delivery code", DeliveryCode);
if (!StringUtil.IsEmpty(MaterialCode)) values.Add(internals.SessionConsole.GetAttributeCaption(SbmDbDfn.ColumnIdx.Commodity_MaterialCode, "Material") + " code", MaterialCode);
if (!StringUtil.IsEmpty(FinishCode)) values.Add(internals.SessionConsole.GetAttributeCaption(SbmDbDfn.ColumnIdx.Commodity_FinishCode, "Finish") + " code", FinishCode);
if (!StringUtil.IsEmpty(PromotionCode)) values.Add(internals.SessionConsole.GetAttributeCaption(SbmDbDfn.ColumnIdx.Commodity_PromotionCode, "Promotion") + " code", PromotionCode);
// Price sets.
if (PriceSetIdsIncluded.Count > 0) values.Add("Included in price sets", PriceSetIdsIncluded.Count.ToString());
if (PriceSetIdsExcluded.Count > 0) values.Add("Excluded from price sets", PriceSetIdsExcluded.Count.ToString());
// Customer.
if (SysId.IsValid(AssociationIdCustomer))
values.Add("Customer", internals.AccountMgr.GetAssociationTargetName(AssociationIdCustomer));
if (!StringUtil.IsEmpty(CustomerName)) values.Add("Customer name starts", CustomerName);
if (!StringUtil.IsEmpty(SupplierName)) values.Add("Supplier name starts", SupplierName);
if (!StringUtil.IsEmpty(SalesOrderRef)) values.Add("SO reference starts", SalesOrderRef);
if (!StringUtil.IsEmpty(PurchaseOrderRef)) values.Add("PO reference starts", PurchaseOrderRef);
// Transaction.
if (!StringUtil.IsEmpty(OrderRef)) lValue.Add("Transaction reference", OrderRef);
// Transaction.
if (!StringUtil.IsEmpty(OrderRef)) values.Add("Transaction reference", OrderRef);
// Stock:
if (StockLocationFilter == Sbm.LocationFilter.Sales) lValue.Add("Stock location", "Sales locations only");
else if (StockLocationFilter == Sbm.LocationFilter.Calc) lValue.Add("Stock location", "Calculated locations only");
else if (StockLocationFilter == Sbm.LocationFilter.All) lValue.Add("Stock location", "All locations");
if (SysId.IsValid(LocationIdStock)) lValue.Add("Stock location", SysId.ToString(LocationIdStock));
if (DateUtil.IsValid(StockSoldFrom)) lValue.Add("Stock sold from", DateUtil.Format(StockSoldFrom, "d-MMM-yyyy"));
if (DateUtil.IsValid(StockSoldTo)) lValue.Add("Stock sold to", DateUtil.Format(StockSoldTo, "d-MMM-yyyy"));
if (DateUtil.IsValid(ProjectedSalesFrom)) lValue.Add("Proj sales from", DateUtil.Format(ProjectedSalesFrom, "d-MMM-yyyy"));
if (DateUtil.IsValid(ProjectedSalesTo)) lValue.Add("Proj sales to", DateUtil.Format(ProjectedSalesTo, "d-MMM-yyyy"));
// Stock:
if (StockLocationFilter == Sbm.LocationFilter.Sales) values.Add("Stock location", "Sales locations only");
else if (StockLocationFilter == Sbm.LocationFilter.Calc) values.Add("Stock location", "Calculated locations only");
else if (StockLocationFilter == Sbm.LocationFilter.All) values.Add("Stock location", "All locations");
if (SysId.IsValid(LocationIdStock)) values.Add("Stock location", SysId.ToString(LocationIdStock));
if (DateUtil.IsValid(StockSoldFrom)) values.Add("Stock sold from", DateUtil.Format(StockSoldFrom, "d-MMM-yyyy"));
if (DateUtil.IsValid(StockSoldTo)) values.Add("Stock sold to", DateUtil.Format(StockSoldTo, "d-MMM-yyyy"));
if (DateUtil.IsValid(ProjectedSalesFrom)) values.Add("Proj sales from", DateUtil.Format(ProjectedSalesFrom, "d-MMM-yyyy"));
if (DateUtil.IsValid(ProjectedSalesTo)) values.Add("Proj sales to", DateUtil.Format(ProjectedSalesTo, "d-MMM-yyyy"));
if (StockLevelMin > decimal.MinValue) lValue.Add("Stock level >= ", StockLevelMin.ToString("N2"));
if (StockLevelMax > decimal.MinValue) lValue.Add("Stock level <= ", StockLevelMax.ToString("N2"));
if (StockLevelMin > decimal.MinValue) values.Add("Stock level >= ", StockLevelMin.ToString("N2"));
if (StockLevelMax > decimal.MinValue) values.Add("Stock level <= ", StockLevelMax.ToString("N2"));
// Commodities with definitions for Customer.
if (SysId.IsValid(AssociationIdCommodityCustomer))
{
if (accountMgr == null) accountMgr = SbmGlobals.System.CreateAccountMgr(userContext);
lValue.Add("Commodity definitions for customer", accountMgr.GetAssociationTargetName(AssociationIdCommodityCustomer));
}
if (!StringUtil.IsEmpty(AccountCodeCommodityCustomer))
lValue.Add("Commodity definitions for customer", AccountCodeCommodityCustomer);
// Commodities with definitions for Customer.
if (SysId.IsValid(AssociationIdCommodityCustomer))
values.Add("Commodity definitions for customer", internals.AccountMgr.GetAssociationTargetName(AssociationIdCommodityCustomer));
if (!StringUtil.IsEmpty(AccountCodeCommodityCustomer))
values.Add("Commodity definitions for customer", AccountCodeCommodityCustomer);
// Commodity status category.
if (StatusCat == StatusCat.Current)
lValue.Add("Status", "Current");
}
// Commodity status category.
if (StatusCat == StatusCat.Current)
values.Add("Status", "Current");
// Portfolio:
//PortfolioIdInclude;
//PortfolioIdExclude;
// Clean-up.
if (accountMgr != null) accountMgr.Dispose();
return lValue;
return values;
}
}
}