Example #1
0
        private UPSEAdditionalItemInformations(UPSerialEntry serialEntry, List <string> configNames, string columnName,
                                               Dictionary <string, object> filterParameters, UPSEAdditionalItemInformationsDelegate theDelegate)
        {
            List <UPSESingleAdditionalItemInformation> additionalItems = null;

            foreach (string configName in configNames)
            {
                var item = UPSESingleAdditionalItemInformation.Create(serialEntry, configName, columnName, filterParameters, this);
                if (item != null)
                {
                    if (additionalItems == null)
                    {
                        additionalItems = new List <UPSESingleAdditionalItemInformation> {
                            item
                        };
                    }
                    else
                    {
                        additionalItems.Add(item);
                    }
                }
            }

            if (additionalItems == null)
            {
                throw new Exception("Additional Items is null");
            }

            this.AdditionalItemArray = additionalItems;
            this.TheDelegate         = theDelegate;
        }
Example #2
0
 /// <summary>
 /// Creates the specified serial entry.
 /// </summary>
 /// <param name="serialEntry">The serial entry.</param>
 /// <param name="viewReference">The view reference.</param>
 /// <returns></returns>
 public static UPSerialEntryAutoFill Create(UPSerialEntry serialEntry, ViewReference viewReference)
 {
     try
     {
         return(new UPSerialEntryAutoFill(serialEntry, viewReference));
     }
     catch
     {
         return(null);
     }
 }
 /// <summary>
 /// Creates the specified serial entry.
 /// </summary>
 /// <param name="serialEntry">The serial entry.</param>
 /// <param name="configuration">The configuration.</param>
 /// <param name="date">The date.</param>
 /// <param name="theDelegate">The delegate.</param>
 /// <returns></returns>
 public static UPSEQuotaHandler Create(UPSerialEntry serialEntry, ViewReference configuration, DateTime date,
                                       UPSEQuotaHandlerDelegate theDelegate)
 {
     try
     {
         return(new UPSEQuotaHandler(serialEntry, configuration, date, theDelegate));
     }
     catch
     {
         return(null);
     }
 }
Example #4
0
 /// <summary>
 /// Creates the specified serial entry.
 /// </summary>
 /// <param name="serialEntry">The serial entry.</param>
 /// <param name="configNames">The configuration names.</param>
 /// <param name="columnName">Name of the column.</param>
 /// <param name="filterParameters">The filter parameters.</param>
 /// <param name="theDelegate">The delegate.</param>
 /// <returns></returns>
 public static UPSEAdditionalItemInformations Create(UPSerialEntry serialEntry, List <string> configNames, string columnName,
                                                     Dictionary <string, object> filterParameters, UPSEAdditionalItemInformationsDelegate theDelegate)
 {
     try
     {
         return(new UPSEAdditionalItemInformations(serialEntry, configNames, columnName, filterParameters, theDelegate));
     }
     catch
     {
         return(null);
     }
 }
Example #5
0
 /// <summary>
 /// Creates the specified serial entry.
 /// </summary>
 /// <param name="serialEntry">The serial entry.</param>
 /// <param name="configName">Name of the configuration.</param>
 /// <param name="keyColumnName">Name of the key column.</param>
 /// <param name="filterParameters">The filter parameters.</param>
 /// <param name="theDelegate">The delegate.</param>
 /// <returns></returns>
 public static UPSESingleAdditionalItemInformation Create(UPSerialEntry serialEntry, string configName, string keyColumnName,
                                                          Dictionary <string, object> filterParameters, UPSESingleAdditionalItemInformationDelegate theDelegate)
 {
     try
     {
         return(new UPSESingleAdditionalItemInformation(serialEntry, configName, keyColumnName, filterParameters, theDelegate));
     }
     catch
     {
         return(null);
     }
 }
        /// <summary>
        /// Initializes a new instance of the <see cref="UPSEQuotaHandler"/> class.
        /// </summary>
        /// <param name="serialEntry">The serial entry.</param>
        /// <param name="configuration">The configuration.</param>
        /// <param name="date">The date.</param>
        /// <param name="theDelegate">The delegate.</param>
        /// <exception cref="Exception">
        /// ArticleConfigurationSearchAndList is null
        /// or
        /// QuotaSearchAndList is null
        /// </exception>
        private UPSEQuotaHandler(UPSerialEntry serialEntry, ViewReference configuration, DateTime date, UPSEQuotaHandlerDelegate theDelegate)
        {
            this.SerialEntry   = serialEntry;
            this.Configuration = configuration;
            this.TheDelegate   = theDelegate;
            this.Date          = date;
            var configStore = ConfigurationUnitStore.DefaultStore;

            this.InitializeBaseConfigStore(configStore);
            this.InitializeMax();

            this.ParentLinkString = this.Configuration.ContextValueForKey("ParentLink");
            this.RequestOption    = UPCRMDataStore.RequestOptionFromString(
                this.Configuration.ContextValueForKey("RequestOption"),
                UPRequestOption.FastestAvailable);
            this.ItemNumberFunctionName = this.Configuration.ContextValueForKey("ItemNumberFunctionName");

            if (string.IsNullOrWhiteSpace(this.ItemNumberFunctionName))
            {
                this.ItemNumberFunctionName = "ItemNumber";
            }

            this.RowItemNumberFunctionName = this.Configuration.ContextValueForKey("RowItemNumberFunctionName");
            if (string.IsNullOrWhiteSpace(this.RowItemNumberFunctionName))
            {
                this.RowItemNumberFunctionName = this.ItemNumberFunctionName;
            }

            this.InitializeQuotaFieldNames();

            var configName = this.Configuration.ContextValueForKey("QuotaLinkId");

            if (!string.IsNullOrWhiteSpace(configName))
            {
                int qLinkId = -1;
                int.TryParse(configName, out qLinkId);
                this.QuotaLinkId = qLinkId;
            }
            else
            {
                this.QuotaLinkId = -1;
            }

            this.InitializeConfigOptions();

            configName = this.Configuration.ContextValueForKey("NewQuotaTemplateFilter");
            if (!string.IsNullOrWhiteSpace(configName))
            {
                this.QuotaTemplateFilter = configStore.FilterByName(configName);
            }
        }
Example #7
0
        private UPSESingleAdditionalItemInformation(UPSerialEntry _serialEntry, string _configName, string _keyColumnName,
                                                    Dictionary <string, object> filterParameters, UPSESingleAdditionalItemInformationDelegate theDelegate)
        {
            IConfigurationUnitStore configStore = ConfigurationUnitStore.DefaultStore;
            SearchAndList           searchAndListConfiguration = configStore.SearchAndListByName(_configName);

            if (searchAndListConfiguration == null)
            {
                throw new Exception("Search & List Config is null");
            }

            this.FieldControl = configStore.FieldControlByNameFromGroup("List", searchAndListConfiguration.FieldGroupName);
            if (this.FieldControl == null)
            {
                throw new Exception("FieldControl is null");
            }

            if (searchAndListConfiguration.FilterName != null)
            {
                this.Filter = configStore.FilterByName(searchAndListConfiguration.FilterName);
                if (this.Filter != null && filterParameters != null)
                {
                    this.Filter = this.Filter.FilterByApplyingReplacements(UPConditionValueReplacement.ReplacementsFromValueParameterDictionary(filterParameters));
                }

                if (this.Filter == null)
                {
                    throw new Exception("Filter is null");
                }
            }

            UPConfigFieldControlField field = this.FieldControl.FieldWithFunction(_keyColumnName);

            if (field == null)
            {
                throw new Exception("Field is null");
            }

            this.keyColumnIndex = field.TabIndependentFieldIndex;
            this.SerialEntry    = _serialEntry;
            this.KeyColumnName  = _keyColumnName;
            this.TheDelegate    = theDelegate;
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="UPSERowConfiguration"/> class.
        /// </summary>
        /// <param name="dict">The dictionary.</param>
        /// <param name="serialEntry">The serial entry.</param>
        public UPSERowConfiguration(Dictionary <string, object> dict, UPSerialEntry serialEntry)
        {
            if (dict == null)
            {
                throw new ArgumentNullException(nameof(dict));
            }

            var columnArray = new List <UPSEColumn>();
            var nextColumn  = 0;

            this.SerialEntry = serialEntry ?? throw new ArgumentNullException(nameof(serialEntry));
            var defaultConfiguration       = serialEntry.DefaultRowConfiguration;
            var configStore                = ConfigurationUnitStore.DefaultStore;
            var sourceColumnFieldGroupName = dict.ValueOrDefault("SourceFG") as string;

            this.SetupDefaultConfiguration(sourceColumnFieldGroupName, configStore, defaultConfiguration, ref nextColumn, columnArray);
            this.SetupSourceAndDestinationColumns(dict, configStore, ref nextColumn, defaultConfiguration, columnArray);
            this.SetupColumnDestinationFieldGroupName(dict, configStore, nextColumn, defaultConfiguration, columnArray);

            Columns = columnArray;
        }
        /// <summary>
        /// Results for row row.
        /// </summary>
        /// <param name="_serialEntry">The serial entry.</param>
        /// <param name="row">The row.</param>
        /// <returns></returns>
        public UPCRMResult ResultForRowRow(UPSerialEntry _serialEntry, UPSERow row)
        {
            IConfigurationUnitStore configStore          = ConfigurationUnitStore.DefaultStore;
            FieldControl            documentFieldControl = configStore.FieldControlByNameFromGroup("List", "D1DocData");
            UPContainerMetaInfo     crmQuery             = new UPContainerMetaInfo(documentFieldControl);
            UPConfigFilter          filter = configStore.FilterByName(this.FilterName);

            if (filter != null)
            {
                Dictionary <string, object>     valuesForFunction  = new Dictionary <string, object>();
                Dictionary <string, UPSEColumn> columnsForFunction = _serialEntry.DestColumnsForFunction;
                foreach (string functionName in columnsForFunction.Keys)
                {
                    UPSEColumn column = columnsForFunction.ValueOrDefault(functionName) ??
                                        columnsForFunction.ValueOrDefault($"$par{functionName}");

                    if (column != null)
                    {
                        string value = row.StringValueAtIndex(column.Index);
                        if (!string.IsNullOrEmpty(value))
                        {
                            valuesForFunction.SetObjectForKey(value, functionName);
                        }
                    }
                }

                UPConfigFilter replacedFilter = filter.FilterByApplyingValueDictionaryDefaults(valuesForFunction, true);
                crmQuery.ApplyFilter(replacedFilter);
            }
            else
            {
                crmQuery.MaxResults = 10;
            }

            UPCRMResult crmResult = crmQuery.Find();

            return(crmResult);
        }
Example #10
0
 /// <summary>
 /// Initializes a new instance of the <see cref="UPSerialEntryRequest"/> class.
 /// </summary>
 /// <param name="context">The context.</param>
 /// <param name="serialEntry">The serial entry.</param>
 public UPSerialEntryRequest(object context, UPSerialEntry serialEntry)
 {
     this.Context     = context;
     this.SerialEntry = serialEntry;
 }
Example #11
0
 /// <summary>
 /// Initializes a new instance of the <see cref="UPSerialEntrySaveRowsRequest"/> class.
 /// </summary>
 /// <param name="_rows">The rows.</param>
 /// <param name="context">The context.</param>
 /// <param name="serialEntry">The serial entry.</param>
 public UPSerialEntrySaveRowsRequest(List <UPSERow> _rows, object context, UPSerialEntry serialEntry)
     : base(context, serialEntry)
 {
     this.rows = _rows;
 }
Example #12
0
 /// <summary>
 /// Initializes a new instance of the <see cref="UPSerialEntrySaveAllRequest"/> class.
 /// </summary>
 /// <param name="context">The context.</param>
 /// <param name="serialEntry">The serial entry.</param>
 public UPSerialEntrySaveAllRequest(object context, UPSerialEntry serialEntry)
     : base(context, serialEntry)
 {
 }
        /// <summary>
        /// Initializes a new instance of the <see cref="UPSerialEntryDocuments"/> class.
        /// </summary>
        /// <param name="_name">The name.</param>
        /// <param name="_filterName">Name of the filter.</param>
        /// <param name="_style">The style.</param>
        /// <param name="_addPhotoDirectButtonName">Name of the add photo direct button.</param>
        /// <param name="_hasDocumentsColumnFunctionName">Name of the has documents column function.</param>
        /// <param name="_hasDocumentsColumnValue">The has documents column value.</param>
        /// <param name="_serialEntry">The serial entry.</param>
        UPSerialEntryDocuments(string _name, string _filterName, string _style, string _addPhotoDirectButtonName,
                               string _hasDocumentsColumnFunctionName, string _hasDocumentsColumnValue, UPSerialEntry _serialEntry)
        {
            this.Name        = _name;
            this.SerialEntry = _serialEntry;
            this.FilterName  = _filterName;
            this.Style       = _style;
            this.AddPhotoDirectButtonName       = _addPhotoDirectButtonName;
            this.HasDocumentsColumnFunctionName = _hasDocumentsColumnFunctionName;
            this.HasDocumentsColumnValue        = _hasDocumentsColumnValue;
            IConfigurationUnitStore configStore = ConfigurationUnitStore.DefaultStore;
            UPConfigFilter          filter      = configStore.FilterByName(this.FilterName);

            if (!string.IsNullOrEmpty(filter?.DisplayName))
            {
                this.Label = filter.DisplayName;
            }
        }
Example #14
0
        /// <summary>
        /// Initializes a new instance of the <see cref="UPSEDestinationParent"/> class.
        /// </summary>
        /// <param name="sourceRecordIdentification">The source record identification.</param>
        /// <param name="destinationRecordIdentification">The destination record identification.</param>
        /// <param name="serialEntry">The serial entry.</param>
        public UPSEDestinationParent(string sourceRecordIdentification, string destinationRecordIdentification, UPSerialEntry serialEntry)
        {
            this.SourceRecordIdentification = sourceRecordIdentification;
            if (!string.IsNullOrEmpty(destinationRecordIdentification))
            {
                this.DestinationRecord = new UPCRMRecord(destinationRecordIdentification);
            }

            this.SerialEntry = serialEntry;
            this.positions   = new Dictionary <string, UPSERow>();
        }
Example #15
0
        /// <summary>
        /// Serials the entry information from definition serial entry.
        /// </summary>
        /// <param name="definition">The definition.</param>
        /// <param name="serialEntry">The serial entry.</param>
        /// <returns></returns>
        public static UPSerialEntryInfo SerialEntryInfoFromDefinitionSerialEntry(Dictionary <string, string> definition, UPSerialEntry serialEntry)
        {
            string            name            = definition["name"];
            UPSerialEntryInfo serialEntryInfo = null;

            if (name == "Pricing")
            {
                //serialEntryInfo = new UPSerialEntryPricingInfo(definition, serialEntry);
            }
            else
            {
                serialEntryInfo = UPSerialEntrySourceRowInfo.Create(definition, serialEntry);
            }

            string verticalLayoutString = definition.ValueOrDefault("verticalRows");

            if (!string.IsNullOrEmpty(verticalLayoutString))
            {
                serialEntryInfo.VerticalRows = Convert.ToBoolean(verticalLayoutString);
            }

            return(serialEntryInfo);
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="UPSERowConfiguration"/> class.
 /// </summary>
 /// <param name="serialEntry">The serial entry.</param>
 public UPSERowConfiguration(UPSerialEntry serialEntry)
 {
     this.Columns     = serialEntry.Columns;
     this.SerialEntry = serialEntry;
 }
Example #17
0
        /// <summary>
        /// Initializes a new instance of the <see cref="UPSEPricing"/> class.
        /// </summary>
        /// <param name="serialEntry">The serial entry.</param>
        /// <param name="viewReference">The view reference.</param>
        /// <param name="theDelegate">The delegate.</param>
        /// <exception cref="InvalidOperationException">PriceListFieldControl is null</exception>
        public UPSEPricing(UPSerialEntry serialEntry, ViewReference viewReference, UPSEPricingDelegate theDelegate)
        {
            this.SerialEntry = serialEntry;
            this.TheDelegate = theDelegate;
            string configName = viewReference.ContextValueForKey("PriceListConfigName");

            if (!string.IsNullOrEmpty(configName))
            {
                this.PriceListSearchAndList = ConfigurationUnitStore.DefaultStore.SearchAndListByName(configName);
                if (this.PriceListSearchAndList != null)
                {
                    this.PriceListFieldControl = ConfigurationUnitStore.DefaultStore.FieldControlByNameFromGroup("List", this.PriceListSearchAndList.FieldGroupName);
                }
            }

            configName = viewReference.ContextValueForKey("PriceListPriorityColumns");
            if (string.IsNullOrEmpty(configName))
            {
                this.PriceListPriorityColumns = new List <string> {
                    "PriceList"
                };
            }
            else if (configName.ToUpper() == "NONE")
            {
                this.PriceListPriorityColumns = null;
            }
            else
            {
                this.PriceListPriorityColumns = configName.Split(',').ToList();
            }

            configName = viewReference.ContextValueForKey("BulkVolumeConfigName");
            if (!string.IsNullOrEmpty(configName))
            {
                this.BulkVolumes = new UPSEPricingBulkVolumes(viewReference, this);
            }

            if (this.PriceListFieldControl == null)
            {
                throw new InvalidOperationException("PriceListFieldControl is null");
            }

            configName = viewReference.ContextValueForKey("ConditionConfigName");
            if (!string.IsNullOrEmpty(configName))
            {
                string scaleConfigName = viewReference.ContextValueForKey("ConditionScaleConfigName");
                this.StandardPricing = new UPSEPricingSet(configName, scaleConfigName, this, this);
            }

            configName = viewReference.ContextValueForKey("CompanyConfigName");
            if (!string.IsNullOrEmpty(configName))
            {
                string scaleConfigName = viewReference.ContextValueForKey("CompanyScaleConfigName");
                this.CompanySpecificPricing = new UPSEPricingSet(configName, scaleConfigName, this, this);
            }

            configName = viewReference.ContextValueForKey("ActionConfigName");
            if (!string.IsNullOrEmpty(configName))
            {
                string scaleConfigName       = viewReference.ContextValueForKey("ActionScaleConfigName");
                string bundleConfigName      = viewReference.ContextValueForKey("BundleConfigName");
                string bundleScaleConfigName = viewReference.ContextValueForKey("BundleScaleConfigName");
                this.ActionPricing = new UPSEPricingSet(configName, scaleConfigName, bundleConfigName, bundleScaleConfigName, this, this);
            }

            configName = viewReference.ContextValueForKey("FunctionNameApplyOrder");
            this.FunctionNameApplyOrder = !string.IsNullOrEmpty(configName)
                                            ? configName.Split(',').ToList()
                                            : new List <string> {
                "ItemNumber"
            };

            configName = viewReference.ContextValueForKey("Options");
            if (!string.IsNullOrEmpty(configName))
            {
                this.Options = configName.JsonDictionaryFromString();
            }

            if (this.SerialEntry.ExplicitItemNumberFunctionName)
            {
                this.PricingItemNumber = viewReference.ContextValueForKey("ItemNumberFunctionName");
                if (string.IsNullOrEmpty(this.PricingItemNumber))
                {
                    this.PricingItemNumber = "ItemNumber";
                }
            }

            configName = viewReference.ContextValueForKey("CurrencyConversionConfigName");
            if (!string.IsNullOrEmpty(configName))
            {
                this.CurrencyConversion = new CurrencyConversion(configName);
            }
        }
        /// <summary>
        /// Creates the specified definition.
        /// </summary>
        /// <param name="definition">The definition.</param>
        /// <param name="_serialEntry">The serial entry.</param>
        /// <returns></returns>
        public static UPSerialEntryDocuments Create(Dictionary <string, string> definition, UPSerialEntry _serialEntry)
        {
            string name       = definition.ValueOrDefault("name");
            string filterName = definition.ValueOrDefault("filter");
            string style      = definition.ValueOrDefault("style").ToUpper();

            if (style != "IMG" && style != "NOIMG")
            {
                style = "DEFAULT";
            }

            string addPhotoDirectButtonName       = definition.ValueOrDefault("addPhotoDirectButtonName");
            string hasDocumentsColumnFunctionName = definition.ValueOrDefault("hasDocumentsColumnFunctionName");
            string hasDocumentsColumnValue        = definition.ValueOrDefault("hasDocumentsColumnValue");

            if (name == null || filterName == null)
            {
                return(null);
            }

            return(new UPSerialEntryDocuments(name, filterName, style, addPhotoDirectButtonName, hasDocumentsColumnFunctionName, hasDocumentsColumnValue, _serialEntry));
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="UPSERow"/> class.
 /// </summary>
 /// <param name="resultRow">The result row.</param>
 /// <param name="listing">The listing.</param>
 /// <param name="serialEntry">The serial entry.</param>
 public UPSEPOSRow(UPCRMResultRow resultRow, UPSEListing listing, UPSerialEntry serialEntry)
     : base(resultRow, listing, serialEntry)
 {
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="UPSERow"/> class.
 /// </summary>
 /// <param name="resultRow">The result row.</param>
 /// <param name="tableIndex">Index of the table.</param>
 /// <param name="sourceFieldOffset">The source field offset.</param>
 /// <param name="serialEntry">The serial entry.</param>
 /// <exception cref="Exception">RowRecordId is null</exception>
 public UPSEPOSRow(UPCRMResultRow resultRow, int tableIndex, int sourceFieldOffset, UPSerialEntry serialEntry)
     : base(resultRow, tableIndex, sourceFieldOffset, serialEntry)
 {
 }
Example #21
0
        /// <summary>
        /// Initializes a new instance of the <see cref="UPSEListingController"/> class.
        /// </summary>
        /// <param name="recordIdentification">The record identification.</param>
        /// <param name="parameters">The parameters.</param>
        /// <param name="serialEntry">The serial entry.</param>
        /// <param name="theDelegate">The delegate.</param>
        public UPSEListingController(string recordIdentification, Dictionary <string, object> parameters, UPSerialEntry serialEntry,
                                     UPSEListingControllerDelegate theDelegate)
        {
            this.fastRequest = ServerSession.CurrentSession.IsEnterprise;
            this.LinkRecordIdentification = recordIdentification;
            this.RootRecordIdentification = recordIdentification;
            this.SerialEntry = serialEntry;
            string listingControlName                 = parameters.ValueOrDefault("ListingControlName") as string;
            string listingOwnerFieldGroupName         = parameters.ValueOrDefault("ListingOwnerFieldGroupName") as string;
            string relatedListingOwnersConfigName     = parameters.ValueOrDefault("RelatedListingOwnersConfigName") as string;
            string distinctListingFunctionNamesString = parameters.ValueOrDefault("DistinctListingFunctionNames") as string;

            this.rowColumnsForFunctionNames = new Dictionary <string, UPSEColumn>();
            if (!string.IsNullOrEmpty(distinctListingFunctionNamesString))
            {
                this.DistinctListingFunctionNames = distinctListingFunctionNamesString.Split(',').ToList();
            }

            string listingApplyHierarchyString = parameters.ValueOrDefault("ApplyHierarchy") as string;

            if (!string.IsNullOrEmpty(listingControlName))
            {
                List <UPSEListingFieldMatch> hierarchyItemArray = new List <UPSEListingFieldMatch>();
                var hierarchyItemStrings = listingApplyHierarchyString.Split(';');
                int index = 0;
                foreach (string itemStrings in hierarchyItemStrings)
                {
                    if (string.IsNullOrEmpty(itemStrings))
                    {
                        continue;
                    }

                    hierarchyItemArray.Add(new UPSEListingFieldMatch(index++, itemStrings));
                }

                this.ListingFieldMatchHierarchy = hierarchyItemArray;
            }

            string destinationFieldFunctionNameString = parameters.ValueOrDefault("DestinationFieldFunctionNames") as string;

            if (!string.IsNullOrEmpty(destinationFieldFunctionNameString))
            {
                this.DestinationFieldFunctionNames = destinationFieldFunctionNameString.Split(',').ToList();
            }

            this.RootFieldValues = parameters.ValueOrDefault("RecordFieldValues") as Dictionary <string, object>;
            IConfigurationUnitStore configStore = ConfigurationUnitStore.DefaultStore;

            this.ListingOwnerFieldGroup     = configStore.FieldControlByNameFromGroup("List", listingOwnerFieldGroupName);
            this.RootListingOwnerMapping    = this.ListingOwnerFieldGroup.FunctionNames();
            this.RelatedListingOwnersSearch = configStore.SearchAndListByName(relatedListingOwnersConfigName);
            FieldControl fieldControl = configStore.FieldControlByNameFromGroup("List", this.RelatedListingOwnersSearch.FieldGroupName);

            this.ListingOwnerMapping = fieldControl.FunctionNames();
            this.ListingSearch       = configStore.SearchAndListByName(listingControlName);
            fieldControl             = configStore.FieldControlByNameFromGroup("List", this.ListingSearch.FieldGroupName);
            this.ListingMapping      = fieldControl.FunctionNames();
            if (this.ListingMapping.Count > 0)
            {
                Dictionary <string, string> listingKeyForFieldKey = new Dictionary <string, string>(this.ListingMapping.Count);
                foreach (string key in this.ListingMapping.Keys)
                {
                    UPConfigFieldControlField field = this.ListingMapping[key];
                    listingKeyForFieldKey[$"{field.InfoAreaId}.{field.FieldId}"] = key;
                }

                this.ListingFieldToKey = listingKeyForFieldKey;
            }

            this.TheDelegate = theDelegate;
        }
Example #22
0
 /// <summary>
 /// Initializes a new instance of the <see cref="UPSerialEntryInfo"/> class.
 /// </summary>
 /// <param name="name">The name.</param>
 /// <param name="serialEntry">The serial entry.</param>
 public UPSerialEntryInfo(string name, UPSerialEntry serialEntry)
 {
     this.Name        = name;
     Label            = name;
     this.SerialEntry = serialEntry;
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="UPSerialEntrySourceRowInfo"/> class.
 /// </summary>
 /// <param name="name">The name.</param>
 /// <param name="serialEntry">The serial entry.</param>
 private UPSerialEntrySourceRowInfo(string name, UPSerialEntry serialEntry)
     : base(name, serialEntry)
 {
 }
Example #24
0
        /// <summary>
        /// Initializes a new instance of the <see cref="UPSerialEntryAutoFill"/> class.
        /// </summary>
        /// <param name="serialEntry">The serial entry.</param>
        /// <param name="viewReference">The view reference.</param>
        /// <exception cref="Exception">
        /// FillColumns empty
        /// or
        /// ItemNumberDestination or ItemNumberSource is empty
        /// </exception>
        private UPSerialEntryAutoFill(UPSerialEntry serialEntry, ViewReference viewReference)
        {
            this.SerialEntry   = serialEntry;
            this.ViewReference = viewReference;
            this.FillColumns   = viewReference.ContextValueForKey("fillColumns")?.Split(';')?.ToList();

            if (this.FillColumns == null || this.FillColumns?.Count == 0)
            {
                //return;
                throw new Exception("FillColumns empty");
            }

            this.FillColumnParameters = viewReference.ContextValueForKey("fcp")?.Split(';')?.ToList();
            if (this.FillColumnParameters?.Count == 0)
            {
                this.FillColumnParameters = this.FillColumns;
            }

            Dictionary <string, object> dict = new Dictionary <string, object>(this.FillColumns.Count);
            int index = 0;

            foreach (string parameter in this.FillColumnParameters)
            {
                if (index >= this.FillColumns?.Count)
                {
                    break;
                }

                var values = viewReference.ContextValueForKey(parameter)?.Split(';')?.ToList();
                if (values != null)
                {
                    dict[this.FillColumns[index]] = values;
                }

                ++index;
            }

            this.FillData = dict;
            if (this.SerialEntry.ExplicitItemNumberFunctionName)
            {
                if (this.FillData.ContainsKey(this.SerialEntry.ItemNumberFunctionName))
                {
                    this.ItemNumberSource = this.SerialEntry.ItemNumberFunctionName;
                }

                this.ItemNumberDestination = this.SerialEntry.ItemNumberFunctionName;
            }

            if (string.IsNullOrEmpty(this.ItemNumberSource))
            {
                if (this.FillData.ContainsKey("ItemNumber"))
                {
                    this.ItemNumberSource = "ItemNumber";
                }
                else if (this.FillData.ContainsKey("CopyItemNumber"))
                {
                    this.ItemNumberSource = "CopyItemNumber";
                }
            }

            if (string.IsNullOrEmpty(this.ItemNumberDestination))
            {
                if (this.SerialEntry.SourceColumnsForFunction.ContainsKey("ItemNumber"))
                {
                    this.ItemNumberDestination = "ItemNumber";
                }
                else if (this.SerialEntry.SourceColumnsForFunction.ContainsKey("CopyItemNumber"))
                {
                    this.ItemNumberDestination = "CopyItemNumber";
                }
            }

            if (string.IsNullOrEmpty(this.ItemNumberDestination) || string.IsNullOrEmpty(this.ItemNumberSource))
            {
                throw new Exception("ItemNumberDestination or ItemNumberSource is empty");
            }
        }
Example #25
0
 /// <summary>
 /// Initializes a new instance of the <see cref="UPSerialEntrySaveAllRequest"/> class.
 /// </summary>
 /// <param name="context">The context.</param>
 /// <param name="ignoreChanges">if set to <c>true</c> [ignore changes].</param>
 /// <param name="serialEntry">The serial entry.</param>
 public UPSerialEntrySaveAllRequest(object context, bool ignoreChanges, UPSerialEntry serialEntry)
     : base(context, serialEntry)
 {
     this.ignoreChanges = ignoreChanges;
 }
        /// <summary>
        /// Creates the specified definition.
        /// </summary>
        /// <param name="definition">The definition.</param>
        /// <param name="serialEntry">The serial entry.</param>
        /// <returns></returns>
        public static UPSerialEntrySourceRowInfo Create(Dictionary <string, string> definition, UPSerialEntry serialEntry)
        {
            string name = definition.ValueOrDefault("name");

            if (name == null)
            {
                return(null);
            }

            var newObj = new UPSerialEntrySourceRowInfo(name, serialEntry);

            newObj.VerticalRows = false;

            string configName = definition.ValueOrDefault("configName") ?? name;
            string parameters = definition.ValueOrDefault("maxResults");

            newObj.MaxResults         = !string.IsNullOrEmpty(parameters) ? Convert.ToInt32(parameters) : 10;
            newObj.IgnoreSourceRecord = Convert.ToInt32(definition.ValueOrDefault("NoLink")) != 0;

            IConfigurationUnitStore configStore = ConfigurationUnitStore.DefaultStore;

            newObj.SearchAndList = configStore.SearchAndListByName(configName);
            if (newObj.SearchAndList == null)
            {
                return(null);
            }

            newObj.FieldControl = configStore.FieldControlByNameFromGroup("List", newObj.SearchAndList.FieldGroupName);
            if (newObj.FieldControl == null)
            {
                return(null);
            }

            if (!string.IsNullOrEmpty(newObj.SearchAndList.FilterName))
            {
                newObj.Filter = configStore.FilterByName(newObj.SearchAndList.FilterName);
                if (!string.IsNullOrEmpty(newObj.Filter?.DisplayName))
                {
                    newObj.Label = newObj.Filter.DisplayName;
                }
            }

            List <string> columnNameArray = new List <string>();
            List <UPConfigFieldControlField> columnDefArray = new List <UPConfigFieldControlField>();

            foreach (FieldControlTab tab in newObj.FieldControl.Tabs)
            {
                foreach (UPConfigFieldControlField field in tab.Fields)
                {
                    columnDefArray.Add(field);
                    columnNameArray.Add(field.Label);
                }
            }

            newObj.ColumnDefs  = columnDefArray;
            newObj.ColumnNames = columnNameArray;

            return(newObj);
        }
Example #27
0
 /// <summary>
 /// Initializes a new instance of the <see cref="UPSEDestinationParent"/> class.
 /// </summary>
 /// <param name="sourceRecordIdentification">The source record identification.</param>
 /// <param name="serialEntry">The serial entry.</param>
 public UPSEDestinationParent(string sourceRecordIdentification, UPSerialEntry serialEntry)
     : this(sourceRecordIdentification, null, serialEntry)
 {
 }