Example #1
0
        private List <RedirectImportItem> ParseCsvRows(CsvInternalImportOptions options)
        {
            List <RedirectImportItem> redirects = new List <RedirectImportItem>();

            foreach (CsvRow row in options.File.Rows)
            {
                RedirectImportItem item = new RedirectImportItem {
                    AddOptions = new AddRedirectOptions()
                };

                string valueRootNodeId = row.GetCellValue(options.ColumnRootNodeId.Index);
                if (int.TryParse(valueRootNodeId, out int rootNodeId))
                {
                    item.AddOptions.RootNodeId = rootNodeId;


                    IPublishedContent content = Current.UmbracoContext.Content.GetById(rootNodeId);

                    if (content != null)
                    {
                        item.AddOptions.RootNodeKey = content.Key;
                    }
                }
                else
                {
                    // TODO: Should we validate the domain? Any security concerns about using the input value?

                    IDomain domain = Current.Services.DomainService.GetByName(valueRootNodeId);
                    if (domain == null)
                    {
                        item.Errors.Add("Unknown root node ID or domain: " + valueRootNodeId);
                    }
                    else if (domain.RootContentId == null)
                    {
                        item.Errors.Add("Domain doesn't have a root node ID: " + valueRootNodeId);
                    }
                    else
                    {
                        item.AddOptions.RootNodeId = domain.RootContentId.Value;
                        IPublishedContent content = Current.UmbracoContext.Content.GetById(domain.RootContentId.Value);
                        if (content != null)
                        {
                            item.AddOptions.RootNodeKey = content.Key;
                        }
                    }
                }

                string valueInboundUrl = row.GetCellValue(options.ColumnInboundUrl.Index);
                try {
                    // TODO: Should we validate the domain? Any security concerns about using the input value?

                    string testUrl = "http://hest.dk" + valueInboundUrl;
                    Uri    uri     = new Uri(testUrl);
                    item.AddOptions.OriginalUrl = valueInboundUrl;
                } catch (Exception) {
                    item.Errors.Add("Invalid inbound URL specified: " + valueInboundUrl);
                }



                string valueDestinationId = row.GetCellValue(options.ColumnDestinationId.Index);
                if (!int.TryParse(valueDestinationId, out int destinationId))
                {
                    item.Errors.Add("Invalid destination ID: " + valueDestinationId);
                }



                string destinationUrl = row.GetCellValue(options.ColumnDestinationUrl.Index);
                if (string.IsNullOrWhiteSpace(destinationUrl))
                {
                    item.Errors.Add("Invalid destination URL: " + destinationUrl);
                }



                string valueLinkMode = row.GetCellValue(options.ColumnDestinationType.Index);
                if (!EnumUtils.TryParseEnum(valueLinkMode, out RedirectDestinationType destinationMode))
                {
                    item.Errors.Add("Invalid destination type: " + valueLinkMode);
                }


                string destinatioName = "";
                Guid   destinationKey = Guid.Empty;
                if (destinationMode == RedirectDestinationType.Content)
                {
                    IPublishedContent content = Current.UmbracoContext.Content.GetById(destinationId);
                    if (content != null)
                    {
                        destinatioName = content.Name;
                        destinationKey = content.Key;
                        destinationUrl = content.Url;
                    }
                }
                else if (destinationMode == RedirectDestinationType.Media)
                {
                    IPublishedContent media = Current.UmbracoContext.Media.GetById(destinationId);
                    if (media != null)
                    {
                        destinatioName = media.Name;
                        destinationKey = media.Key;
                        destinationUrl = media.Url;
                    }
                }

                item.AddOptions.Destination = new RedirectDestination(destinationId, destinationKey, destinationUrl, destinationMode) /*Name = destinatioName*/ }
                {
                    ;
                    //item.AddOptions.Overwrite = options.Options.OverwriteExisting;

                    redirects.Add(item);
            }

            return(redirects);
        }
Example #2
0
        private static void UpdateListItem(VisitListItem data, Visit visit, IPersistenceContext context)
        {
            var facilityAssembler = new FacilityAssembler();

            data.VisitRef       = visit.GetRef();
            data.VisitNumber    = new CompositeIdentifierDetail(visit.VisitNumber.Id, EnumUtils.GetEnumValueInfo(visit.VisitNumber.AssigningAuthority));
            data.PatientClass   = EnumUtils.GetEnumValueInfo(visit.PatientClass);
            data.PatientType    = EnumUtils.GetEnumValueInfo(visit.PatientType);
            data.AdmissionType  = EnumUtils.GetEnumValueInfo(visit.AdmissionType);
            data.VisitStatus    = EnumUtils.GetEnumValueInfo(visit.Status, context);
            data.AdmitTime      = visit.AdmitTime;
            data.DischargeTime  = visit.DischargeTime;
            data.VisitFacility  = facilityAssembler.CreateFacilitySummary(visit.Facility);
            data.PreadmitNumber = visit.PreadmitNumber;
        }
Example #3
0
        private JsonSchema GenerateInternal(Type type, Required valueRequired, bool required)
        {
            ValidationUtils.ArgumentNotNull(type, "type");

            string resolvedId = GetTypeId(type, false);
            string explicitId = GetTypeId(type, true);

            if (!string.IsNullOrEmpty(resolvedId))
            {
                JsonSchema resolvedSchema = _resolver.GetSchema(resolvedId);
                if (resolvedSchema != null)
                {
                    // resolved schema is not null but referencing member allows nulls
                    // change resolved schema to allow nulls. hacky but what are ya gonna do?
                    if (valueRequired != Required.Always && !HasFlag(resolvedSchema.Type, JsonSchemaType.Null))
                    {
                        resolvedSchema.Type |= JsonSchemaType.Null;
                    }
                    if (required && resolvedSchema.Required != true)
                    {
                        resolvedSchema.Required = true;
                    }

                    return(resolvedSchema);
                }
            }

            // test for unresolved circular reference
            if (_stack.Any(tc => tc.Type == type))
            {
                throw new JsonException("Unresolved circular reference for type '{0}'. Explicitly define an Id for the type using a JsonObject/JsonArray attribute or automatically generate a type Id using the UndefinedSchemaIdHandling property.".FormatWith(CultureInfo.InvariantCulture, type));
            }

            JsonContract  contract = ContractResolver.ResolveContract(type);
            JsonConverter converter;

            if ((converter = contract.Converter) != null || (converter = contract.InternalConverter) != null)
            {
                JsonSchema converterSchema = converter.GetSchema();
                if (converterSchema != null)
                {
                    return(converterSchema);
                }
            }

            Push(new TypeSchema(type, new JsonSchema()));

            if (explicitId != null)
            {
                CurrentSchema.Id = explicitId;
            }

            if (required)
            {
                CurrentSchema.Required = true;
            }
            CurrentSchema.Title       = GetTitle(type);
            CurrentSchema.Description = GetDescription(type);

            if (converter != null)
            {
                // todo: Add GetSchema to JsonConverter and use here?
                CurrentSchema.Type = JsonSchemaType.Any;
            }
            else
            {
                switch (contract.ContractType)
                {
                case JsonContractType.Object:
                    CurrentSchema.Type = AddNullType(JsonSchemaType.Object, valueRequired);
                    CurrentSchema.Id   = GetTypeId(type, false);
                    GenerateObjectSchema(type, (JsonObjectContract)contract);
                    break;

                case JsonContractType.Array:
                    CurrentSchema.Type = AddNullType(JsonSchemaType.Array, valueRequired);

                    CurrentSchema.Id = GetTypeId(type, false);

                    JsonArrayAttribute arrayAttribute = JsonTypeReflector.GetCachedAttribute <JsonArrayAttribute>(type);
                    bool allowNullItem = (arrayAttribute == null || arrayAttribute.AllowNullItems);

                    Type collectionItemType = ReflectionUtils.GetCollectionItemType(type);
                    if (collectionItemType != null)
                    {
                        CurrentSchema.Items = new List <JsonSchema>();
                        CurrentSchema.Items.Add(GenerateInternal(collectionItemType, (!allowNullItem) ? Required.Always : Required.Default, false));
                    }
                    break;

                case JsonContractType.Primitive:
                    CurrentSchema.Type = GetJsonSchemaType(type, valueRequired);

                    if (CurrentSchema.Type == JsonSchemaType.Integer && type.IsEnum() && !type.IsDefined(typeof(FlagsAttribute), true))
                    {
                        CurrentSchema.Enum = new List <JToken>();

                        IList <EnumValue <long> > enumValues = EnumUtils.GetNamesAndValues <long>(type);
                        foreach (EnumValue <long> enumValue in enumValues)
                        {
                            JToken value = JToken.FromObject(enumValue.Value);

                            CurrentSchema.Enum.Add(value);
                        }
                    }
                    break;

                case JsonContractType.String:
                    JsonSchemaType schemaType = (!ReflectionUtils.IsNullable(contract.UnderlyingType))
                            ? JsonSchemaType.String
                            : AddNullType(JsonSchemaType.String, valueRequired);

                    CurrentSchema.Type = schemaType;
                    break;

                case JsonContractType.Dictionary:
                    CurrentSchema.Type = AddNullType(JsonSchemaType.Object, valueRequired);

                    Type keyType;
                    Type valueType;
                    ReflectionUtils.GetDictionaryKeyValueTypes(type, out keyType, out valueType);

                    if (keyType != null)
                    {
                        JsonContract keyContract = ContractResolver.ResolveContract(keyType);

                        // can be converted to a string
                        if (keyContract.ContractType == JsonContractType.Primitive)
                        {
                            CurrentSchema.AdditionalProperties = GenerateInternal(valueType, Required.Default, false);
                        }
                    }
                    break;

#if !(NETFX_CORE || PORTABLE || PORTABLE40)
                case JsonContractType.Serializable:
                    CurrentSchema.Type = AddNullType(JsonSchemaType.Object, valueRequired);
                    CurrentSchema.Id   = GetTypeId(type, false);
                    GenerateISerializableContract(type, (JsonISerializableContract)contract);
                    break;
#endif
#if !(NET35 || NET20 || PORTABLE40)
                case JsonContractType.Dynamic:
#endif
                case JsonContractType.Linq:
                    CurrentSchema.Type = JsonSchemaType.Any;
                    break;

                default:
                    throw new JsonException("Unexpected contract type: {0}".FormatWith(CultureInfo.InvariantCulture, contract));
                }
            }

            return(Pop().Schema);
        }
Example #4
0
        public ParseStringDelegate GetParseFn <T>()
        {
            var type = Nullable.GetUnderlyingType(typeof(T)) ?? typeof(T);

            if (type.GetTypeInfo().IsEnum)
            {
                return(x => EnumUtils.Parse <T>(x, true));
            }

            if (type == typeof(string))
            {
                return(Serializer.ParseString);
            }

            if (type == typeof(object))
            {
                return(DeserializeType <TSerializer> .ObjectStringToType);
            }

            var specialParseFn = ParseUtils.GetSpecialParseMethod(type);

            if (specialParseFn != null)
            {
                return(specialParseFn);
            }

            if (type.IsArray)
            {
                return(DeserializeArray <T, TSerializer> .Parse);
            }

            var builtInMethod = DeserializeBuiltin <T> .Parse;

            if (builtInMethod != null)
            {
                return(value => builtInMethod(Serializer.ParseRawString(value)));
            }

            if (JsConfig <T> .SerializeFn != null)
            {
                return(value => JsConfig <T> .ParseFn(Serializer.ParseRawString(value)));
            }

            if (type.IsGenericType())
            {
                if (type.IsOrHasGenericInterfaceTypeOf(typeof(IList <>)))
                {
                    return(DeserializeList <T, TSerializer> .Parse);
                }

                if (type.IsOrHasGenericInterfaceTypeOf(typeof(IDictionary <,>)))
                {
                    return(DeserializeDictionary <TSerializer> .GetParseMethod(type));
                }

                if (type.IsOrHasGenericInterfaceTypeOf(typeof(ICollection <>)))
                {
                    return(DeserializeCollection <TSerializer> .GetParseMethod(type));
                }

                if (type.HasAnyTypeDefinitionsOf(typeof(Queue <>)) ||
                    type.HasAnyTypeDefinitionsOf(typeof(Stack <>)))
                {
                    return(DeserializeSpecializedCollections <T, TSerializer> .Parse);
                }

                if (type.IsOrHasGenericInterfaceTypeOf(typeof(IEnumerable <>)))
                {
                    return(DeserializeEnumerable <T, TSerializer> .Parse);
                }
            }

            var isCollection = typeof(T).IsOrHasGenericInterfaceTypeOf(typeof(ICollection));

            if (isCollection)
            {
                var isDictionary = typeof(T).IsAssignableFrom(typeof(IDictionary)) ||
                                   typeof(T).HasInterface(typeof(IDictionary));
                if (isDictionary)
                {
                    return(DeserializeDictionary <TSerializer> .GetParseMethod(type));
                }

                return(DeserializeEnumerable <T, TSerializer> .Parse);
            }

            var isEnumerable = typeof(T).IsAssignableFrom(typeof(IEnumerable)) ||
                               typeof(T).HasInterface(typeof(IEnumerable));

            if (isEnumerable)
            {
                var parseFn = DeserializeSpecializedCollections <T, TSerializer> .Parse;
                if (parseFn != null)
                {
                    return(parseFn);
                }
            }

            if (type.GetTypeInfo().IsValueType)
            {
                var staticParseMethod = StaticParseMethod <T> .Parse;
                if (staticParseMethod != null)
                {
                    return(value => staticParseMethod(Serializer.ParseRawString(value)));
                }
            }
            else
            {
                var staticParseMethod = StaticParseRefTypeMethod <TSerializer, T> .Parse;
                if (staticParseMethod != null)
                {
                    return(value => staticParseMethod(Serializer.ParseRawString(value)));
                }
            }

            var typeConstructor = DeserializeType <TSerializer> .GetParseMethod(TypeConfig <T> .GetState());

            if (typeConstructor != null)
            {
                return(typeConstructor);
            }

            var stringConstructor = DeserializeTypeUtils.GetParseMethod(type);

            if (stringConstructor != null)
            {
                return(stringConstructor);
            }

            return(DeserializeType <TSerializer> .ParseAbstractType <T>);
        }
Example #5
0
        protected static FR_Bool Execute(DbConnection Connection, DbTransaction Transaction, P_L5ZW_SDfNC_1707 Parameter, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null)
        {
            #region UserCode
            var returnValue = new FR_Bool();
            returnValue.Result = false;

            //Put your code here
            #region get securityTicket and businessParticipantID by Paramter.AccountID and set defaultLanguageID
            Guid tenantID;
            Guid businessParticipantID;

            if (Parameter.AccountID == Guid.Empty)
            {
                return(returnValue);
            }

            ORM_USR_Account orm_account = new ORM_USR_Account();
            var             result      = orm_account.Load(Connection, Transaction, Parameter.AccountID);
            if (result.Status != FR_Status.Success || orm_account.USR_AccountID == Guid.Empty)
            {
                return(returnValue);
            }

            tenantID       = orm_account.Tenant_RefID;
            securityTicket = new CSV2Core.SessionSecurity.SessionSecurityTicket()
            {
                TenantID = tenantID
            };

            ORM_CMN_BPT_BusinessParticipant.Query businessParticipantQuery = new ORM_CMN_BPT_BusinessParticipant.Query();
            businessParticipantQuery.IfTenant_Tenant_RefID = tenantID;
            businessParticipantQuery.IsDeleted             = false;
            ORM_CMN_BPT_BusinessParticipant businessParticipant = ORM_CMN_BPT_BusinessParticipant.Query.Search(Connection, Transaction, businessParticipantQuery).FirstOrDefault();

            if (businessParticipant == null)
            {
                return(returnValue);
            }

            businessParticipantID = businessParticipant.CMN_BPT_BusinessParticipantID;
            #endregion

            #region get languages for tenant and set parameter dict values
            P_L2LN_GALFTID_1530 languageParam = new P_L2LN_GALFTID_1530()
            {
                Tenant_RefID = tenantID
            };
            L2LN_GALFTID_1530[] languages = cls_Get_All_Languages_ForTenantID.Invoke(Connection, Transaction, languageParam, securityTicket).Result;
            SetParameterDictValues(Parameter, languages);

            List <ISOLanguage> languagesISOs = new List <ISOLanguage>();
            languagesISOs.AddRange(languages.Select(l => new ISOLanguage()
            {
                ISO        = l.ISO_639_1,
                LanguageID = l.CMN_LanguageID
            }).ToList());
            #endregion

            #region save defaultLanguage

            // We are setting language for bp and acc
            var defaultLanguage = languages.FirstOrDefault(i => i.ISO_639_1.ToLower().Contains(Parameter.DefaultLanguageCode.ToLower()));
            if (defaultLanguage != null)
            {
                businessParticipant.DefaultLanguage_RefID = defaultLanguage.CMN_LanguageID;
                businessParticipant.Save(Connection, Transaction);

                orm_account.DefaultLanguage_RefID = defaultLanguage.CMN_LanguageID;
                orm_account.Save(Connection, Transaction);
            }

            #endregion

            #region save default country

            if (Parameter.DefaultCountry != null)
            {
                ORM_CMN_Country country = new ORM_CMN_Country();
                country.CMN_CountryID          = Guid.NewGuid();
                country.Country_ISOCode_Alpha3 = Parameter.DefaultCountry.Code;
                country.Country_Name           = new Dict()
                {
                    DictionaryID = Guid.NewGuid()
                };
                country.Creation_Timestamp     = DateTime.Now;
                country.Default_Currency_RefID = Guid.Empty;
                country.Default_Language_RefID = Guid.Empty;
                country.Tenant_RefID           = tenantID;
                country.IsDeleted = false;
                country.IsDefault = true;

                foreach (var languageItem in languages)
                {
                    country.Country_Name.UpdateEntry(languageItem.CMN_LanguageID, Parameter.DefaultCountry.Name);
                }

                country.Save(Connection, Transaction);
            }

            #endregion

            #region save default currency

            //asign currency
            if (Parameter.DefaultCurrency != null)
            {
                ORM_CMN_Currency currency = new ORM_CMN_Currency();
                currency.CMN_CurrencyID     = Guid.NewGuid();
                currency.Creation_Timestamp = DateTime.Now;
                currency.IsDeleted          = false;
                currency.ISO4127            = Parameter.DefaultCurrency.Code;
                currency.Name = new Dict()
                {
                    DictionaryID = Guid.NewGuid()
                };
                currency.Tenant_RefID = tenantID;

                foreach (var language in languages)
                {
                    currency.Name.UpdateEntry(language.CMN_LanguageID, Parameter.DefaultCurrency.Name);
                }

                currency.Save(Connection, Transaction);

                //set default currency
                ORM_CMN_BPT_BusinessParticipant businessPart = new ORM_CMN_BPT_BusinessParticipant();
                businessPart.Load(Connection, Transaction, businessParticipantID);

                businessPart.DefaultCurrency_RefID = currency.CMN_CurrencyID;
                businessPart.Save(Connection, Transaction);
            }

            #endregion

            #region save organisational units
            if (Parameter.OrganisationalUnitParameters.Length > 0)
            {
                foreach (var item in Parameter.OrganisationalUnitParameters)
                {
                    cls_Save_Office.Invoke(Connection, Transaction, item, securityTicket);
                }
            }
            #endregion

            #region save cost centers
            if (Parameter.CostCenterParameters.Length > 0)
            {
                foreach (var item in Parameter.CostCenterParameters)
                {
                    cls_Save_CostCenter.Invoke(Connection, Transaction, item, securityTicket);
                }
            }
            #endregion

            #region save warehouses
            if (Parameter.WarehousesParameters.Length > 0)
            {
                #region save warehouse group
                P_L2WH_SWHG_1327 warehouseGroupParam = new P_L2WH_SWHG_1327();
                warehouseGroupParam.Parent_RefID               = Guid.Empty;
                warehouseGroupParam.WarehouseGroup_Name        = "Waregouse group";
                warehouseGroupParam.WarehouseGroup_Description = new Dict()
                {
                    DictionaryID = Guid.NewGuid()
                };
                foreach (var language in languages)
                {
                    warehouseGroupParam.WarehouseGroup_Description.UpdateEntry(language.CMN_LanguageID, String.Empty);
                }

                var warehouseGroupID = cls_Save_Warehouse_Group.Invoke(Connection, Transaction, warehouseGroupParam, securityTicket).Result;
                #endregion

                foreach (var item in Parameter.WarehousesParameters)
                {
                    item.LOG_WRH_WarehouseGroupID = warehouseGroupID;
                    cls_Save_Warehouse.Invoke(Connection, Transaction, item, securityTicket);
                }
            }
            #endregion

            #region create dimension templates
            string           jsonTemplates      = ReadFromFile.LoadContentFromFile(@"Dimensions.json");
            List <Dimension> dimensionTemplates = JsonConvert.DeserializeObject <List <Dimension> >(jsonTemplates);

            int orderSequence = 1;
            ORM_CMN_PRO_Dimension       orm_dimension;
            ORM_CMN_PRO_Dimension_Value orm_dimensionValue;
            foreach (var template in dimensionTemplates)
            {
                orderSequence = 1;

                #region save dimension
                orm_dimension = new ORM_CMN_PRO_Dimension();
                orm_dimension.Product_RefID = Guid.Empty;
                orm_dimension.DimensionName = new Dict()
                {
                    DictionaryID = Guid.NewGuid()
                };
                orm_dimension.IsDimensionTemplate = true;
                orm_dimension.Tenant_RefID        = tenantID;

                foreach (var language in languages)
                {
                    orm_dimension.DimensionName.UpdateEntry(language.CMN_LanguageID, template.Name);
                }

                orm_dimension.Save(Connection, Transaction);
                #endregion

                #region save dimension values
                foreach (var templateValue in template.DimansionValues)
                {
                    orm_dimensionValue = new ORM_CMN_PRO_Dimension_Value();
                    orm_dimensionValue.Dimensions_RefID    = orm_dimension.CMN_PRO_DimensionID;
                    orm_dimensionValue.DimensionValue_Text = new Dict()
                    {
                        DictionaryID = Guid.NewGuid()
                    };
                    orm_dimensionValue.Tenant_RefID  = tenantID;
                    orm_dimensionValue.OrderSequence = orderSequence;

                    foreach (var language in languages)
                    {
                        orm_dimensionValue.DimensionValue_Text.UpdateEntry(language.CMN_LanguageID, templateValue);
                    }

                    orm_dimensionValue.Save(Connection, Transaction);

                    orderSequence++;
                }
                #endregion
            }
            #endregion

            #region create shipment types
            string shipmentTypesJson           = ReadFromFile.LoadContentFromFile(@"ShipmentTypes.json");
            List <ShipmentTypes> shipmentTypes = JsonConvert.DeserializeObject <List <ShipmentTypes> >(shipmentTypesJson);

            ORM_LOG_SHP_Shipment_Type orm_shipmentType;
            foreach (var type in shipmentTypes)
            {
                #region save LOG_SHP_Shipment_Type
                orm_shipmentType = new ORM_LOG_SHP_Shipment_Type();
                orm_shipmentType.ShipmentType_Name = new Dict()
                {
                    DictionaryID = Guid.NewGuid()
                };
                orm_shipmentType.ShipmentType_Description = new Dict()
                {
                    DictionaryID = Guid.NewGuid()
                };
                orm_shipmentType.Tenant_RefID = tenantID;

                foreach (var language in languages)
                {
                    orm_shipmentType.ShipmentType_Name.UpdateEntry(language.CMN_LanguageID, type.Name);
                    orm_shipmentType.ShipmentType_Description.UpdateEntry(language.CMN_LanguageID, string.Empty);
                }

                orm_shipmentType.Save(Connection, Transaction);
                #endregion
            }
            #endregion

            #region create number ranges

            string      numberRangesJson = ReadFromFile.LoadContentFromFile(@"NumberRanges.json");
            NumberRange numberRanges     = JsonConvert.DeserializeObject <NumberRange>(numberRangesJson);


            ORM_CMN_NumberRange_UsageArea numberRangeUsageArea;
            ORM_CMN_NumberRange           orm_numberRanges;
            foreach (var item in numberRanges.NumberRanges)
            {
                if (Parameter.IsCustomerRegistration && item.Name == "Customer orders")
                {
                    continue;
                }

                if (!Parameter.IsCustomerRegistration && item.Name == "Distribution orders")
                {
                    continue;
                }

                if (!Parameter.IsCustomerRegistration && item.Name == "Procurement orders")
                {
                    continue;
                }

                numberRangeUsageArea = new ORM_CMN_NumberRange_UsageArea();
                numberRangeUsageArea.UsageArea_Name = new Dict()
                {
                    DictionaryID = Guid.NewGuid()
                };
                numberRangeUsageArea.UsageArea_Description = new Dict()
                {
                    DictionaryID = Guid.NewGuid()
                };
                foreach (var language in languages)
                {
                    numberRangeUsageArea.UsageArea_Name.UpdateEntry(language.CMN_LanguageID, item.Name);
                    numberRangeUsageArea.UsageArea_Description.UpdateEntry(language.CMN_LanguageID, string.Empty);
                }
                numberRangeUsageArea.Tenant_RefID           = tenantID;
                numberRangeUsageArea.GlobalStaticMatchingID = item.GlobalStaticMatchingID;
                numberRangeUsageArea.Save(Connection, Transaction);

                orm_numberRanges = new ORM_CMN_NumberRange();
                orm_numberRanges.NumberRange_Name            = item.Name;
                orm_numberRanges.Tenant_RefID                = tenantID;
                orm_numberRanges.NumberRange_UsageArea_RefID = numberRangeUsageArea.CMN_NumberRange_UsageAreaID;
                orm_numberRanges.FixedPrefix = item.FixedPrefix;
                orm_numberRanges.Formatting_LeadingFillCharacter = item.FillCharacter;
                orm_numberRanges.Formatting_NumberLength         = item.Length;
                orm_numberRanges.Value_Current = item.CurrentValue;
                orm_numberRanges.Value_Start   = item.StartValue;
                orm_numberRanges.Value_End     = item.EndValue;
                orm_numberRanges.Save(Connection, Transaction);
            }


            #endregion

            #region create inventory change reasons

            string inventoryChangeReasonsJson = ReadFromFile.LoadContentFromFile(@"InventoryChangeReasons.json");
            List <InventoryChangeReasons> inventoryChangeReasons = JsonConvert.DeserializeObject <List <InventoryChangeReasons> >(inventoryChangeReasonsJson);

            ORM_LOG_WRH_InventoryChangeReason orm_inventoryChangeReason;
            foreach (var reason in inventoryChangeReasons)
            {
                #region save inventory change reason

                orm_inventoryChangeReason = new ORM_LOG_WRH_InventoryChangeReason();
                orm_inventoryChangeReason.GlobalPropertyMatchingID = InventoryChangeReasons.InventoryChangeReasonGlobalPropertyMatchingID + "-" + reason.Name;
                orm_inventoryChangeReason.InventoryChange_Name     = new Dict()
                {
                    DictionaryID = Guid.NewGuid()
                };
                orm_inventoryChangeReason.InventoryChange_Description = new Dict()
                {
                    DictionaryID = Guid.NewGuid()
                };
                orm_inventoryChangeReason.Tenant_RefID = tenantID;

                foreach (var language in languages)
                {
                    orm_inventoryChangeReason.InventoryChange_Name.UpdateEntry(language.CMN_LanguageID, reason.Name);
                    orm_inventoryChangeReason.InventoryChange_Description.UpdateEntry(language.CMN_LanguageID, string.Empty);
                }

                orm_inventoryChangeReason.Save(Connection, Transaction);

                #endregion
            }

            #endregion

            #region create shipment statuses
            var shipmentStatuses = Enum.GetValues(typeof(EShipmentStatus));

            var shipmentStatusDicts = EnumUtils.GetDictObjectsForStaticListData <EShipmentStatus>(
                ResourceFilePath.ShipmentStatus, ORM_LOG_SHP_Shipment_Status.TableName, languagesISOs);

            var statusCodeCount = 1;
            ORM_LOG_SHP_Shipment_Status shipmentStatus;
            foreach (EShipmentStatus status in shipmentStatuses)
            {
                shipmentStatus = new ORM_LOG_SHP_Shipment_Status();
                shipmentStatus.GlobalPropertyMatchingID = EnumUtils.GetEnumDescription((EShipmentStatus)status);
                shipmentStatus.Status_Code  = statusCodeCount++;
                shipmentStatus.Status_Name  = shipmentStatusDicts[EnumUtils.GetEnumDescription((EShipmentStatus)status)];
                shipmentStatus.Tenant_RefID = tenantID;

                shipmentStatus.Save(Connection, Transaction);
            }
            #endregion

            if (Parameter.IsCustomerRegistration)
            {
                #region create procurement order statuses
                var procurementStatuses = Enum.GetValues(typeof(EProcurementStatus));
                ORM_ORD_PRC_ProcurementOrder_Status procurementOrderStatus;
                foreach (EProcurementStatus status in procurementStatuses)
                {
                    procurementOrderStatus = new ORM_ORD_PRC_ProcurementOrder_Status();
                    procurementOrderStatus.GlobalPropertyMatchingID = EnumUtils.GetEnumDescription(status);
                    procurementOrderStatus.Tenant_RefID             = tenantID;

                    procurementOrderStatus.Save(Connection, Transaction);
                }
                #endregion
            }
            else
            {
                #region create customer order statuses
                var customerOrderStatuses = Enum.GetValues(typeof(ECustomerOrderStatus));

                var customerOrderStatusesDicts = EnumUtils.GetDictObjectsForStaticListData <ECustomerOrderStatus>(
                    ResourceFilePath.CustomerOrderStatus, ORM_ORD_CUO_CustomerOrder_Status.TableName, languagesISOs);

                var count = 1;
                ORM_ORD_CUO_CustomerOrder_Status customerOrderStatus;
                foreach (var status in customerOrderStatuses)
                {
                    customerOrderStatus = new ORM_ORD_CUO_CustomerOrder_Status();
                    customerOrderStatus.GlobalPropertyMatchingID = EnumUtils.GetEnumDescription((ECustomerOrderStatus)status);
                    customerOrderStatus.Status_Code  = count++;
                    customerOrderStatus.Status_Name  = customerOrderStatusesDicts[EnumUtils.GetEnumDescription((ECustomerOrderStatus)status)];
                    customerOrderStatus.Tenant_RefID = tenantID;

                    customerOrderStatus.Save(Connection, Transaction);
                }
                #endregion
            }

            returnValue.Result = true;
            return(returnValue);

            #endregion UserCode
        }
Example #6
0
 public IEnumerable <BrothMicrodilutionStandard> Standards(SpeciesTestingMethod testingMethod)
 {
     return(EnumUtils.AllEnumValues <BrothMicrodilutionStandard>().Where(t => t != BrothMicrodilutionStandard.None));
 }
Example #7
0
        /// <summary>
        /// Parses the CSS rule.
        /// </summary>
        /// <param name="curStyle">Current style.</param>
        /// <param name="rule">Rule.</param>
        internal static void ParseCSSRule(ref TextStyleParameters curStyle, CssParserRule rule)
        {
            foreach (var declaration in rule.Declarations)
            {
                if (_textStyleProperties.ContainsKey(declaration.Property))
                {
                    var cleanedValue = declaration.Value.Replace("\"", "");
                    cleanedValue = cleanedValue.Trim();
                    var prop = _textStyleProperties [declaration.Property];
                    switch (prop.PropertyType.Name)
                    {
                    case "String":
                        curStyle.SetValue(prop.Name, cleanedValue);
                        break;

                    case "Int32":
                        int numInt;
                        if (int.TryParse(cleanedValue, out numInt))
                        {
                            curStyle.SetValue(prop.Name, numInt);
                        }
                        break;

                    case "Single":
                        cleanedValue = cleanedValue.Replace("px", "");
                        float numFloat;
                        if (float.TryParse(cleanedValue, out numFloat))
                        {
                            curStyle.SetValue(prop.Name, numFloat);
                        }
                        else
                        {
                            throw new Exception("Failed to Parse Single value " + cleanedValue);
                        }
                        break;

                    case "Single[]":
                        var parts        = cleanedValue.Split(new char [] { ' ', ',' }, StringSplitOptions.RemoveEmptyEntries);
                        var parsedValues = new float [parts.Length];
                        for (int i = 0; i < parts.Length; i++)
                        {
                            float numArrayFloat;
                            if (float.TryParse(parts [i], out numArrayFloat))
                            {
                                parsedValues [i] = numArrayFloat;
                            }
                        }
                        curStyle.SetValue(prop.Name, parsedValues);
                        break;

                    case "TextStyleAlign":
                        curStyle.TextAlign = EnumUtils.FromDescription <TextStyleAlign> (cleanedValue);
                        break;

                    case "TextStyleDecoration":
                        curStyle.TextDecoration = EnumUtils.FromDescription <TextStyleDecoration> (cleanedValue);
                        break;

                    case "TextStyleTextTransform":
                        curStyle.TextTransform = EnumUtils.FromDescription <TextStyleTextTransform> (cleanedValue);
                        break;

                    case "TextStyleTextOverflow":
                        curStyle.TextOverflow = EnumUtils.FromDescription <TextStyleTextOverflow> (cleanedValue);
                        break;

                    case "TextStyleFontStyle":
                        curStyle.FontStyle = EnumUtils.FromDescription <TextStyleFontStyle> (cleanedValue);
                        break;

                    case "TextStyleFontWeight":
                        curStyle.FontWeight = EnumUtils.FromDescription <TextStyleFontWeight> (cleanedValue);
                        break;

                    default:
                        throw new InvalidCastException("Could not find the appropriate type " + prop.PropertyType.Name);
                    }
                }
            }
        }
        public void DoWindowContents(Rect settingsRect)
        {
            if (DoMigrations)
            {
                if (!migratedOutputImageSettings)
                {
                    //Yes, I know for the people who used to use 1080 as scaling and have upgraded this will turn off scaling for them.
                    //Unfortunately I don't think there's a better way to handle this.
                    scaleOutputImage = outputImageFixedHeight > 0 && outputImageFixedHeight != DefaultOutputImageFixedHeight;
                    if (!scaleOutputImage)
                    {
                        outputImageFixedHeight = DefaultOutputImageFixedHeight;
                    }
                    migratedOutputImageSettings = true;
                    Log.Warning("Migrated output image settings");
                }
                if (!migratedInterval)
                {
                    whichInterval = RenderIntervalHelper.Intervals.IndexOf(interval);
                    if (whichInterval < 0)
                    {
                        whichInterval = RenderIntervalHelper.Intervals.IndexOf(DefaultInterval);
                    }
                    migratedInterval = true;
                    Log.Warning("Migrated interval settings");
                }
            }

            Listing_Standard ls = new Listing_Standard();
            var leftHalf        = new Rect(settingsRect.x, settingsRect.y, settingsRect.width / 2 - 12f, settingsRect.height);
            var rightHalf       = new Rect(settingsRect.x + settingsRect.width / 2 + 12f, settingsRect.y, settingsRect.width / 2 - 12f, settingsRect.height);

            ls.Begin(leftHalf);

            // Left half (general settings)
            ls.CheckboxLabeled("LPR_SettingsEnabledLabel".Translate(), ref enabled, "LPR_SettingsEnabledDescription".Translate());
            TextAnchor backupAnchor = Text.Anchor;

            Text.Anchor = TextAnchor.MiddleLeft;
            if (ls.ButtonTextLabeled("LPR_SettingsRenderFeedbackLabel".Translate(), ("LPR_RenderFeedback_" + renderFeedback).Translate()))
            {
                List <FloatMenuOption> menuEntries = new List <FloatMenuOption>();
                var feedbackTypes = (RenderFeedback[])Enum.GetValues(typeof(RenderFeedback));
                foreach (var type in feedbackTypes)
                {
                    menuEntries.Add(new FloatMenuOption(("LPR_RenderFeedback_" + EnumUtils.ToFriendlyString(type)).Translate(), delegate
                    {
                        renderFeedback = type;
                    }));
                }
                Find.WindowStack.Add(new FloatMenu(menuEntries));
            }
            Text.Anchor = backupAnchor;

            ls.Gap();
            ls.Label("LPR_SettingsRenderSettingsLabel".Translate(), -1, "LPR_SettingsRenderSettingsDescription".Translate());
            ls.GapLine();
            ls.CheckboxLabeled("LPR_SettingsRenderDesignationsLabel".Translate(), ref renderDesignations, "LPR_SettingsRenderDesignationsDescription".Translate());
            ls.CheckboxLabeled("LPR_SettingsRenderThingIconsLabel".Translate(), ref renderThingIcons, "LPR_SettingsRenderThingIconsDescription".Translate());
            ls.CheckboxLabeled("LPR_SettingsRenderGameConditionsLabel".Translate(), ref renderGameConditions, "LPR_SettingsRenderGameConditionsDescription".Translate());
            ls.CheckboxLabeled("LPR_SettingsRenderWeatherLabel".Translate(), ref renderWeather, "LPR_SettingsRenderWeatherDescription".Translate());
            ls.GapLine();

            ls.Gap();
            ls.Label("LPR_SettingsSmoothRenderAreaStepsLabel".Translate() + smoothRenderAreaSteps.ToString(": #0"), -1, "LPR_SettingsSmoothRenderAreaStepsDescription".Translate());
            smoothRenderAreaSteps = (int)ls.Slider(smoothRenderAreaSteps, 0, 30);

            ls.Label($"{"LPR_SettingsIntervalLabel".Translate()} {RenderIntervalHelper.GetLabel(interval)}", -1, "LPR_SettingsIntervalDescription".Translate());
            whichInterval = (int)ls.Slider(whichInterval, 0, RenderIntervalHelper.Intervals.Count - 1);
            ls.Label("LPR_SettingsTimeOfDayLabel".Translate() + timeOfDay.ToString(" 00H"), -1, "LPR_SettingsTimeOfDayDescription".Translate());
            timeOfDay = (int)ls.Slider(timeOfDay, 0, 23);

            ls.End();

            // Right half (file settings)
            ls.Begin(rightHalf);

            backupAnchor = Text.Anchor;
            Text.Anchor  = TextAnchor.MiddleLeft;
            if (ls.ButtonTextLabeled("LPR_SettingsEncodingLabel".Translate(), ("LPR_ImgEncoding_" + EnumUtils.ToFriendlyString(encoding)).Translate()))
            {
                List <FloatMenuOption> menuEntries = new List <FloatMenuOption>();
                var encodingTypes = (EncodingType[])Enum.GetValues(typeof(EncodingType));
                foreach (var encodingType in encodingTypes)
                {
                    menuEntries.Add(new FloatMenuOption(("LPR_ImgEncoding_" + EnumUtils.ToFriendlyString(encodingType)).Translate(), delegate
                    {
                        encoding = encodingType;
                    }));
                }
                Find.WindowStack.Add(new FloatMenu(menuEntries));
            }
            Text.Anchor = backupAnchor;

            if (encoding == EncodingType.UnityJPG)
            {
                ls.Label("LPR_JPGQualityLabel".Translate() + jpgQuality.ToString(": ##0"), -1, "LPR_JPGQualityDescription".Translate());
                jpgQuality = (int)ls.Slider(jpgQuality, 1, 100);
            }

            ls.Label("LPR_SettingsPixelPerCellLabel".Translate() + pixelPerCell.ToString(": ##0 pcc"), -1, "LPR_SettingsPixelPerCellDescription".Translate());
            pixelPerCell = (int)ls.Slider(pixelPerCell, 1, 64);

            ls.Gap();
            ls.CheckboxLabeled("LPR_SettingsScaleOutputImageLabel".Translate(), ref scaleOutputImage, "LPR_SettingsScaleOutputImageDescription".Translate());
            if (scaleOutputImage)
            {
                ls.Label("LPR_SettingsOutputImageFixedHeightLabel".Translate());
                ls.TextFieldNumeric(ref outputImageFixedHeight, ref outputImageFixedHeightBuffer, 1);
                ls.Gap();
            }

            ls.GapLine();
            if (scaleOutputImage)
            {
                ls.Gap(); // All about that visual balance
            }
            ls.Label("LPR_SettingsExportPathLabel".Translate(), -1, "LPR_SettingsExportPathDescription".Translate());
            exportPath = ls.TextEntry(exportPath);

            ls.Gap();
            ls.CheckboxLabeled("LPR_SettingsCreateSubdirsLabel".Translate(), ref createSubdirs, "LPR_SettingsCreateSubdirsDescription".Translate());
            backupAnchor = Text.Anchor;
            Text.Anchor  = TextAnchor.MiddleLeft;
            if (ls.ButtonTextLabeled("LPR_SettingsFileNamePatternLabel".Translate(), ("LPR_FileNamePattern_" + fileNamePattern).Translate()))
            {
                List <FloatMenuOption> menuEntries = new List <FloatMenuOption>();
                var patterns = (FileNamePattern[])Enum.GetValues(typeof(FileNamePattern));
                foreach (var pattern in patterns)
                {
                    menuEntries.Add(new FloatMenuOption(("LPR_FileNamePattern_" + EnumUtils.ToFriendlyString(pattern)).Translate(), delegate
                    {
                        fileNamePattern = pattern;
                    }));
                }
                Find.WindowStack.Add(new FloatMenu(menuEntries));
            }
            Text.Anchor = backupAnchor;

            ls.End();
        }
Example #9
0
        protected static FR_L5SO_SSHwP_1030 Execute(DbConnection Connection, DbTransaction Transaction, P_L5SO_SSHwP_1030 Parameter, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null)
        {
            #region UserCode
            var returnValue = new FR_L5SO_SSHwP_1030();
            returnValue.Result = new L5SO_SSHwP_1030();

            var oldShipmentHeader = new CL1_LOG_SHP.ORM_LOG_SHP_Shipment_Header();
            oldShipmentHeader.Load(Connection, Transaction, Parameter.HeaderID);

            var oldPositions = CL1_LOG_SHP.ORM_LOG_SHP_Shipment_Position.Query.Search(Connection, Transaction,
                                                                                      new CL1_LOG_SHP.ORM_LOG_SHP_Shipment_Position.Query
            {
                LOG_SHP_Shipment_Header_RefID = Parameter.HeaderID,
                IsDeleted    = false,
                Tenant_RefID = securityTicket.TenantID
            });

            bool isThereAnyDifference = false;
            foreach (var item in Parameter.Positions)
            {
                var oldPosition = oldPositions.Single(x => x.LOG_SHP_Shipment_PositionID == item.PositionID);

                if (oldPosition.QuantityToShip > item.PickingQuantity)
                {
                    isThereAnyDifference = true;
                    break;
                }
            }

            if (!isThereAnyDifference)
            {
                throw new ShipmentHeaderException(ResultMessage.SplitShipment_ThereIsNoDifferenceBetweenNewAndOldOne);
            }

            #region Create New ShippmentHeader

            var incrNumberParam = new P_L2NR_GaIINfUA_1454()
            {
                GlobalStaticMatchingID = EnumUtils.GetEnumDescription(ENumberRangeUsageAreaType.ShipmentNumber)
            };
            var shipmentOrderNumber = cls_Get_and_Increase_IncreasingNumber_for_UsageArea.Invoke(Connection, Transaction, incrNumberParam, securityTicket).Result.Current_IncreasingNumber;


            var newShipmentHeader = new CL1_LOG_SHP.ORM_LOG_SHP_Shipment_Header();
            newShipmentHeader.LOG_SHP_Shipment_HeaderID = Guid.NewGuid();
            newShipmentHeader.ShipmentHeader_Number     = shipmentOrderNumber;
            newShipmentHeader.Tenant_RefID               = securityTicket.TenantID;
            newShipmentHeader.Creation_Timestamp         = DateTime.Now;
            newShipmentHeader.IsPartialShippingAllowed   = oldShipmentHeader.IsPartialShippingAllowed;
            newShipmentHeader.Shippipng_AddressUCD_RefID = oldShipmentHeader.Shippipng_AddressUCD_RefID;
            newShipmentHeader.Source_Warehouse_RefID     = oldShipmentHeader.Source_Warehouse_RefID;
            newShipmentHeader.ShipmentPriority           = oldShipmentHeader.ShipmentPriority;
            newShipmentHeader.ShipmentType_RefID         = oldShipmentHeader.ShipmentType_RefID;

            newShipmentHeader.RecipientBusinessParticipant_RefID = oldShipmentHeader.RecipientBusinessParticipant_RefID;

            newShipmentHeader.Save(Connection, Transaction);

            var assignmentQuery = new CL1_LOG_SHP.ORM_LOG_SHP_ShipmentHeader_2_CustomerOrderHeader.Query();
            assignmentQuery.LOG_SHP_Shipment_Header_RefID = oldShipmentHeader.LOG_SHP_Shipment_HeaderID;
            assignmentQuery.IsDeleted    = false;
            assignmentQuery.Tenant_RefID = securityTicket.TenantID;

            var oldAssignment = CL1_LOG_SHP.ORM_LOG_SHP_ShipmentHeader_2_CustomerOrderHeader.Query.Search(Connection, Transaction, assignmentQuery).Single();

            var shipmentToCustomerOrderHeader = new CL1_LOG_SHP.ORM_LOG_SHP_ShipmentHeader_2_CustomerOrderHeader();
            shipmentToCustomerOrderHeader.ORD_CUO_CustomerOrder_Header_RefID = oldAssignment.ORD_CUO_CustomerOrder_Header_RefID;
            shipmentToCustomerOrderHeader.LOG_SHP_Shipment_Header_RefID      = newShipmentHeader.LOG_SHP_Shipment_HeaderID;
            shipmentToCustomerOrderHeader.Tenant_RefID       = securityTicket.TenantID;
            shipmentToCustomerOrderHeader.Creation_Timestamp = DateTime.Now;
            shipmentToCustomerOrderHeader.Save(Connection, Transaction);

            #region Status

            var statusCreated = CL1_LOG_SHP.ORM_LOG_SHP_Shipment_Status.Query.Search(Connection, Transaction,
                                                                                     new CL1_LOG_SHP.ORM_LOG_SHP_Shipment_Status.Query()
            {
                GlobalPropertyMatchingID = EnumUtils.GetEnumDescription(EShipmentStatus.Created),
                Tenant_RefID             = securityTicket.TenantID,
                IsDeleted = false
            }).Single();

            var account = new CL1_USR.ORM_USR_Account();
            account.Load(Connection, Transaction, securityTicket.AccountID);

            var shipmentStatusHistory = new CL1_LOG_SHP.ORM_LOG_SHP_Shipment_StatusHistory();
            shipmentStatusHistory.LOG_SHP_Shipment_Header_RefID         = newShipmentHeader.LOG_SHP_Shipment_HeaderID;
            shipmentStatusHistory.LOG_SHP_Shipment_Status_RefID         = statusCreated.LOG_SHP_Shipment_StatusID;
            shipmentStatusHistory.PerformedBy_BusinessParticipant_RefID = account.BusinessParticipant_RefID;
            shipmentStatusHistory.Tenant_RefID = account.Tenant_RefID;
            shipmentStatusHistory.Save(Connection, Transaction);

            #endregion

            #endregion

            var param = new P_L5SO_GSPwPaSfSH_1141()
            {
                ShippmentHeaderID = Parameter.HeaderID,
                LanguageID        = Parameter.LanguageID
            };
            var splittingPositions = cls_Get_ShipmentPositions_with_Prices_and_Stock_for_ShipmentHeaderID.Invoke(Connection, Transaction, param, securityTicket).Result;

            decimal totalAmountForOldHeader = 0;
            decimal totalAmountForNewHeader = 0;
            foreach (var item in Parameter.Positions)
            {
                var oldPosition = oldPositions.Single(x => x.LOG_SHP_Shipment_PositionID == item.PositionID);

                var newQuantity       = oldPosition.QuantityToShip - item.PickingQuantity;
                var positionToSplit   = splittingPositions.Single(x => x.ShipmentPositionID == item.PositionID);
                var availableQuantity = positionToSplit.QuantityAvailable;

                decimal unitPrice = oldPosition.ShipmentPosition_PricePerUnitValueWithoutTax;

                if (item.PickingQuantity > availableQuantity + positionToSplit.ReservedQuantity)
                {
                    throw new ShipmentHeaderException(ResultMessage.SplitShipment_FreeQuantityNotAvailable);
                }

                if (newQuantity > 0)
                {
                    var newPosition = new CL1_LOG_SHP.ORM_LOG_SHP_Shipment_Position
                    {
                        LOG_SHP_Shipment_PositionID   = Guid.NewGuid(),
                        LOG_SHP_Shipment_Header_RefID = newShipmentHeader.LOG_SHP_Shipment_HeaderID,
                        Tenant_RefID          = securityTicket.TenantID,
                        CMN_PRO_Product_RefID = oldPosition.CMN_PRO_Product_RefID,
                        QuantityToShip        = newQuantity,
                        ShipmentPosition_PricePerUnitValueWithoutTax = unitPrice,
                        ShipmentPosition_ValueWithoutTax             = unitPrice * (decimal)newQuantity
                    };
                    newPosition.Save(Connection, Transaction);

                    totalAmountForNewHeader += newPosition.ShipmentPosition_ValueWithoutTax;

                    var oldAssignmentCustomerOrderToShipmentPosition = CL1_ORD_CUO.ORM_ORD_CUO_CustomerOrder_Position_2_ShipmentPosition.Query.Search(Connection, Transaction,
                                                                                                                                                      new CL1_ORD_CUO.ORM_ORD_CUO_CustomerOrder_Position_2_ShipmentPosition.Query
                    {
                        LOG_SHP_Shipment_Position_RefID = oldPosition.LOG_SHP_Shipment_PositionID,
                        IsDeleted    = false,
                        Tenant_RefID = securityTicket.TenantID
                    }).Single();

                    var customerOrder2ShipmentPosition = new CL1_ORD_CUO.ORM_ORD_CUO_CustomerOrder_Position_2_ShipmentPosition
                    {
                        AssignmentID       = Guid.NewGuid(),
                        Creation_Timestamp = DateTime.Now,
                        Tenant_RefID       = securityTicket.TenantID,
                        IsDeleted          = false,
                        LOG_SHP_Shipment_Position_RefID      = newPosition.LOG_SHP_Shipment_PositionID,
                        ORD_CUO_CustomerOrder_Position_RefID = oldAssignmentCustomerOrderToShipmentPosition.ORD_CUO_CustomerOrder_Position_RefID,
                        CMN_BPT_CTM_OrganizationalUnit_RefID = oldAssignmentCustomerOrderToShipmentPosition.CMN_BPT_CTM_OrganizationalUnit_RefID
                    };
                    customerOrder2ShipmentPosition.Save(Connection, Transaction);
                }

                oldPosition.QuantityToShip = item.PickingQuantity;
                oldPosition.ShipmentPosition_ValueWithoutTax = unitPrice * (decimal)item.PickingQuantity;
                oldPosition.IsDeleted = (oldPosition.QuantityToShip == 0);

                oldPosition.Save(Connection, Transaction);

                totalAmountForOldHeader += oldPosition.ShipmentPosition_ValueWithoutTax;
            }

            oldShipmentHeader.ShipmentHeader_ValueWithoutTax = totalAmountForOldHeader;
            oldShipmentHeader.Save(Connection, Transaction);

            newShipmentHeader.ShipmentHeader_ValueWithoutTax = totalAmountForNewHeader;
            newShipmentHeader.Save(Connection, Transaction);

            // set return value to ok and new header's id
            returnValue.Result.NewHeaderID = newShipmentHeader.LOG_SHP_Shipment_HeaderID;
            returnValue.Result.Message     = CL5_APOLogistic_ShippingOrder.Utils.ResultMessage.SplitShipment_OK;

            return(returnValue);

            #endregion UserCode
        }
 public override bool GetPress(ControllerButton button, bool usePrevState = false)
 {
     return(IsValidButton(button) && EnumUtils.GetFlag(usePrevState ? prevButtonPressed : currButtonPressed, (int)button));
 }
 public override bool GetPressUp(ControllerButton button)
 {
     return(IsValidButton(button) && EnumUtils.GetFlag(prevButtonPressed, (int)button) && !EnumUtils.GetFlag(currButtonPressed, (int)button));
 }
            // return true if frame skipped
            public override bool Update()
            {
                if (!ChangeProp.Set(ref updatedFrameCount, Time.frameCount))
                {
                    return(true);
                }

                var deviceIndex = m_map.GetMappedDeviceByRoleValue(m_roleValue);

                // treat this frame as updated if both prevDeviceIndex and currentDeviceIndex are invalid
                if (!VRModule.IsValidDeviceIndex(prevDeviceIndex) && !VRModule.IsValidDeviceIndex(deviceIndex))
                {
                    return(false);
                }

                // get device state
                var currState = VRModule.GetCurrentDeviceState(deviceIndex);

                // copy to previous states
                prevDeviceIndex   = deviceIndex;
                prevButtonPressed = currButtonPressed;
                for (int i = CONTROLLER_AXIS_COUNT - 1; i >= 0; --i)
                {
                    prevAxisValue[i] = currAxisValue[i];
                }

                trackedDeviceModel = currState.deviceModel;

                // update button states
                EnumUtils.SetFlag(ref currButtonPressed, (int)ControllerButton.System, currState.GetButtonPress(VRModuleRawButton.System));
                EnumUtils.SetFlag(ref currButtonPressed, (int)ControllerButton.Menu, currState.GetButtonPress(VRModuleRawButton.ApplicationMenu));
                EnumUtils.SetFlag(ref currButtonPressed, (int)ControllerButton.MenuTouch, currState.GetButtonTouch(VRModuleRawButton.ApplicationMenu));
                EnumUtils.SetFlag(ref currButtonPressed, (int)ControllerButton.Trigger, currState.GetButtonPress(VRModuleRawButton.Trigger));
                EnumUtils.SetFlag(ref currButtonPressed, (int)ControllerButton.TriggerTouch, currState.GetButtonTouch(VRModuleRawButton.Trigger));
                EnumUtils.SetFlag(ref currButtonPressed, (int)ControllerButton.Pad, currState.GetButtonPress(VRModuleRawButton.Touchpad));
                EnumUtils.SetFlag(ref currButtonPressed, (int)ControllerButton.PadTouch, currState.GetButtonTouch(VRModuleRawButton.Touchpad));
                EnumUtils.SetFlag(ref currButtonPressed, (int)ControllerButton.Grip, currState.GetButtonPress(VRModuleRawButton.Grip));
                EnumUtils.SetFlag(ref currButtonPressed, (int)ControllerButton.GripTouch, currState.GetButtonTouch(VRModuleRawButton.Grip));
                EnumUtils.SetFlag(ref currButtonPressed, (int)ControllerButton.CapSenseGrip, currState.GetButtonPress(VRModuleRawButton.CapSenseGrip));
                EnumUtils.SetFlag(ref currButtonPressed, (int)ControllerButton.CapSenseGripTouch, currState.GetButtonTouch(VRModuleRawButton.CapSenseGrip));
                EnumUtils.SetFlag(ref currButtonPressed, (int)ControllerButton.AKey, currState.GetButtonPress(VRModuleRawButton.A));
                EnumUtils.SetFlag(ref currButtonPressed, (int)ControllerButton.AKeyTouch, currState.GetButtonTouch(VRModuleRawButton.A));

                EnumUtils.SetFlag(ref currButtonPressed, (int)ControllerButton.Axis3, currState.GetButtonPress(VRModuleRawButton.Axis3));
                EnumUtils.SetFlag(ref currButtonPressed, (int)ControllerButton.Axis3Touch, currState.GetButtonTouch(VRModuleRawButton.Axis3));
                EnumUtils.SetFlag(ref currButtonPressed, (int)ControllerButton.Axis4, currState.GetButtonPress(VRModuleRawButton.Axis4));
                EnumUtils.SetFlag(ref currButtonPressed, (int)ControllerButton.Axis4Touch, currState.GetButtonTouch(VRModuleRawButton.Axis4));

                // update axis values
                currAxisValue[(int)ControllerAxis.PadX]         = currState.GetAxisValue(VRModuleRawAxis.TouchpadX);
                currAxisValue[(int)ControllerAxis.PadY]         = currState.GetAxisValue(VRModuleRawAxis.TouchpadY);
                currAxisValue[(int)ControllerAxis.Trigger]      = currState.GetAxisValue(VRModuleRawAxis.Trigger);
                currAxisValue[(int)ControllerAxis.CapSenseGrip] = currState.GetAxisValue(VRModuleRawAxis.CapSenseGrip);
                currAxisValue[(int)ControllerAxis.IndexCurl]    = currState.GetAxisValue(VRModuleRawAxis.IndexCurl);
                currAxisValue[(int)ControllerAxis.MiddleCurl]   = currState.GetAxisValue(VRModuleRawAxis.MiddleCurl);
                currAxisValue[(int)ControllerAxis.RingCurl]     = currState.GetAxisValue(VRModuleRawAxis.RingCurl);
                currAxisValue[(int)ControllerAxis.PinkyCurl]    = currState.GetAxisValue(VRModuleRawAxis.PinkyCurl);

                // update hair trigger
                var currTriggerValue = currAxisValue[(int)ControllerAxis.Trigger];

                EnumUtils.SetFlag(ref currButtonPressed, (int)ControllerButton.FullTrigger, currTriggerValue == 1f);
                if (EnumUtils.GetFlag(prevButtonPressed, (int)ControllerButton.HairTrigger))
                {
                    EnumUtils.SetFlag(ref currButtonPressed, (int)ControllerButton.HairTrigger, currTriggerValue >= (hairTriggerLimit - hairDelta) && currTriggerValue > 0.0f);
                }
                else
                {
                    EnumUtils.SetFlag(ref currButtonPressed, (int)ControllerButton.HairTrigger, currTriggerValue > (hairTriggerLimit + hairDelta) || currTriggerValue >= 1.0f);
                }

                if (EnumUtils.GetFlag(currButtonPressed, (int)ControllerButton.HairTrigger))
                {
                    hairTriggerLimit = Mathf.Max(hairTriggerLimit, currTriggerValue);
                }
                else
                {
                    hairTriggerLimit = Mathf.Min(hairTriggerLimit, currTriggerValue);
                }

                // record pad down axis values
                if (GetPressDown(ControllerButton.Pad))
                {
                    padDownAxis = new Vector2(currAxisValue[(int)ControllerAxis.PadX], currAxisValue[(int)ControllerAxis.PadY]);
                }

                if (GetPressDown(ControllerButton.PadTouch))
                {
                    padTouchDownAxis = new Vector2(currAxisValue[(int)ControllerAxis.PadX], currAxisValue[(int)ControllerAxis.PadY]);
                }

                // record press down time and click count
                var timeNow = Time.unscaledTime;

                for (int button = 0; button < CONTROLLER_BUTTON_COUNT; ++button)
                {
                    if (GetPressDown((ControllerButton)button))
                    {
                        if (timeNow - lastPressDownTime[button] < clickInterval)
                        {
                            ++clickCount[button];
                        }
                        else
                        {
                            clickCount[button] = 1;
                        }

                        lastPressDownTime[button] = timeNow;
                    }
                }

                // invoke event listeners
                for (ControllerButton button = 0; button < (ControllerButton)CONTROLLER_BUTTON_COUNT; ++button)
                {
                    if (GetPress(button))
                    {
                        if (GetPressDown(button))
                        {
                            // PressDown event
                            TryInvokeListener(button, ButtonEventType.Down);
                            TryInvokeTypeListener(button, ButtonEventType.Down);
                        }

                        // Press event
                        TryInvokeListener(button, ButtonEventType.Press);
                        TryInvokeTypeListener(button, ButtonEventType.Press);
                    }
                    else if (GetPressUp(button))
                    {
                        // PressUp event
                        TryInvokeListener(button, ButtonEventType.Up);
                        TryInvokeTypeListener(button, ButtonEventType.Up);

                        if (timeNow - lastPressDownTime[(int)button] < clickInterval)
                        {
                            // Click event
                            TryInvokeListener(button, ButtonEventType.Click);
                            TryInvokeTypeListener(button, ButtonEventType.Click);
                        }
                    }
                }

                return(false);
            }
 /// <summary>
 /// 定义 Object 的 acl 属性。有效值:private,public-read-write,public-read;默认值:private
 /// <see cref="Common.CosACL"/>
 /// </summary>
 /// <param name="cosACL"></param>
 public void SetCosACL(CosACL cosACL)
 {
     SetRequestHeader(CosRequestHeaderKey.X_COS_ACL, EnumUtils.GetValue(cosACL));
 }
        private void FilterItems()
        {
            IReadOnlyList <ItemVm> filteredItems = new List <ItemVm>(_items);

            filteredItems = _itemFilterer.FilterByItemSearch(filteredItems, _view.ItemSearchValue, _view.ItemSearchType, EnumUtils.ToNullableEnum <StrictLooseFilterMode>(_view.ItemSearchFilterMode));
            filteredItems = _itemFilterer.FilterByItemCondition(filteredItems, EnumUtils.ToNullableEnum <ItemCondition>(_view.ItemCondition));
            filteredItems = _itemFilterer.FilterByItemType(filteredItems, EnumUtils.ToListOfEnum <ItemType>(_view.ItemTypes));
            filteredItems = _itemFilterer.FilterByItemColor(filteredItems, _colors.Where(color => color.Checked).Select(color => color.Id).ToList());
            filteredItems = _itemFilterer.FilterByItemCount(filteredItems, _view.ItemCount, EnumUtils.ToNullableEnum <MinMaxFilterMode>(_view.ItemCountFilterMode));

            _view.Items = filteredItems;
        }
Example #15
0
        public string ScoreboardObjectivesAdd(string objectiveName, ScoreboardCriteria criteria, string displayName = "")
        {
            if (string.IsNullOrWhiteSpace(objectiveName))
            {
                throw new ArgumentNullException("objectiveName", "You must provide the objective name.");
            }

            string cmd = string.Empty;

            if (!string.IsNullOrWhiteSpace(displayName))
            {
                cmd = string.Format(TonkaCommands.CMD_SCOREBOARD_OBJ_ADD_2, objectiveName, EnumUtils.GetEnumDefaultValue(criteria), displayName);
            }
            else
            {
                cmd = string.Format(TonkaCommands.CMD_SCOREBOARD_OBJ_ADD, objectiveName, EnumUtils.GetEnumDefaultValue(criteria));
            }
            string result = SendCommand(cmd);

            return(result);
        }
Example #16
0
        public void GetTransactionsForSearchCriterias(KeyValuePair <string, string>[] queryExpected,
                                                      TransactionsTestSource.FunctionHolder getCall)
        {
            var httpClient = Substitute.For <IHttpClient>();
            var response   = new HttpResponseMessage(HttpStatusCode.OK)
            {
                Content = new StringContent((@"{
                            results : [{
                                receiptId : '134567',
                                type : 'Create',
                                judoId : '12456',
                                originalAmount : 20,
                                amount : 20,
                                netAmount : 20,
                                cardDetails :
                                    {
                                        cardLastfour : '1345',
                                        endDate : '1214',
                                        cardToken : 'ASb345AE',
                                        cardType : 'VISA'
                                    },
                                currency : 'GBP',
                                consumer : 
                                    {
                                        consumerToken : 'B245SEB',
                                        yourConsumerReference : 'Consumer1'
                                    }
                             }]}"))
            };

            response.Content.Headers.ContentType = new MediaTypeHeaderValue("application/json");
            var responseTask = new TaskCompletionSource <HttpResponseMessage>();

            responseTask.SetResult(response);

            httpClient.SendAsync(Arg.Any <HttpRequestMessage>()).Returns(responseTask.Task);

            var client = new Client(new Connection(httpClient,
                                                   DotNetLoggerFactory.Create,
                                                   "http://judo.com"));

            var judo = new JudoPayApi(DotNetLoggerFactory.Create, client);

            getCall.Func(judo.Transactions);

            httpClient.Received().SendAsync(Arg.Any <HttpRequestMessage>());
            var calls = httpClient.ReceivedCalls();

// ReSharper disable once PossibleNullReferenceException
            var request = calls.FirstOrDefault(call => call.GetMethodInfo().Name == "SendAsync").
                          GetArguments().FirstOrDefault() as HttpRequestMessage;

            Assert.IsNotNull(request);

            var numberOfMatchingParameters = request.RequestUri.Query
                                             .Remove(0, 1)
                                             .Split('&').Select(kv =>
            {
                var keyValue = kv.Split('=');
                return(new KeyValuePair <string, string>(keyValue[0], keyValue[1]));
            }).Intersect(queryExpected).Count();

            Assert.AreEqual(queryExpected.Count(), numberOfMatchingParameters);
            Assert.AreEqual(EnumUtils.GetEnumDescription(TransactionType.PAYMENT), request.RequestUri.AbsolutePath.Split('/').Last());
        }
Example #17
0
        public string ScoreboardTeamsOptionColor(string teamName, ScoreboardTeamColors color)
        {
            if (string.IsNullOrWhiteSpace(teamName))
            {
                throw new ArgumentNullException("teamName", "You must provide the team name.");
            }

            string cmd = string.Empty;

            cmd = string.Format(TonkaCommands.CMD_SCOREBOARD_TEAMS_OPT_COLOR, teamName, EnumUtils.GetEnumDefaultValue(color));
            string result = SendCommand(cmd);

            return(result);
        }
Example #18
0
        static Command ParseArguments(string[] args, TrainerSettings trainerSettings)
        {
            if (null == args || args.Length == 0)
            {
                throw new ArgumentNullException(nameof(args));
            }

            if (null == trainerSettings)
            {
                throw new ArgumentNullException(nameof(trainerSettings));
            }

            Command cmd = Command.Unknown;

            switch (args[0].ToLower())
            {
            case "b":
            case "battle":
                cmd = Command.Battle;
                break;

            case "br":
            case "battleroyale":
                cmd = Command.BattleRoyale;
                break;

            case "c":
            case "cull":
                cmd = Command.Cull;
                break;

            case "e":
            case "enumerate":
                cmd = Command.Enumerate;
                break;

            case "a":
            case "analyze":
                cmd = Command.Analyze;
                break;

            case "g":
            case "generate":
                cmd = Command.Generate;
                break;

            case "l":
            case "lifecycle":
                cmd = Command.Lifecycle;
                break;

            case "m":
            case "mate":
                cmd = Command.Mate;
                break;

            case "t":
            case "tournament":
                cmd = Command.Tournament;
                break;

            case "at":
            case "autotrain":
                cmd = Command.AutoTrain;
                break;

            case "top":
                cmd = Command.Top;
                break;

            case "mt":
            case "mergetop":
                cmd = Command.MergeTop;
                break;

            case "ea":
            case "exportai":
                cmd = Command.ExportAI;
                break;

            case "bit":
            case "buildinitialtables":
                cmd = Command.BuildInitialTables;
                break;
            }

            if (cmd == Command.Unknown)
            {
                throw new Exception(string.Format("Unknown command: {0}", args[0]));
            }

            for (int i = 1; i < args.Length; i++)
            {
                switch (args[i].Substring(1).ToLower())
                {
                case "pp":
                case "profilespath":
                    trainerSettings.ProfilesPath = args[++i];
                    break;

                case "wpp":
                case "whiteprofilepath":
                    trainerSettings.WhiteProfilePath = args[++i];
                    break;

                case "bpp":
                case "blackprofilepath":
                    trainerSettings.BlackProfilePath = args[++i];
                    break;

                case "ckc":
                case "cullkeepcount":
                    trainerSettings.CullKeepCount = int.Parse(args[++i]);
                    break;

                case "gc":
                case "generatecount":
                    trainerSettings.GenerateCount = int.Parse(args[++i]);
                    break;

                case "gminw":
                case "generateminweight":
                    trainerSettings.GenerateMinWeight = double.Parse(args[++i]);
                    break;

                case "gmaxw":
                case "generatemaxweight":
                    trainerSettings.GenerateMaxWeight = double.Parse(args[++i]);
                    break;

                case "lg":
                case "lifecyclegenerations":
                    trainerSettings.LifecycleGenerations = int.Parse(args[++i]);
                    break;

                case "lb":
                case "lifecyclebattles":
                    trainerSettings.LifecycleBattles = int.Parse(args[++i]);
                    break;

                case "mb":
                case "maxbattles":
                    trainerSettings.MaxBattles = int.Parse(args[++i]);
                    break;

                case "mcb":
                case "maxconcurrentbattles":
                    trainerSettings.MaxConcurrentBattles = int.Parse(args[++i]);
                    break;

                case "bsp":
                case "battleshuffleprofiles":
                    trainerSettings.BattleShuffleProfiles = bool.Parse(args[++i]);
                    break;

                case "mdraws":
                case "maxdraws":
                    trainerSettings.MaxDraws = int.Parse(args[++i]);
                    break;

                case "bbtl":
                case "bulkbattletimelimit":
                    trainerSettings.BulkBattleTimeLimit = TimeSpan.Parse(args[++i]);
                    break;

                case "pr":
                case "provisionalrules":
                    trainerSettings.ProvisionalRules = bool.Parse(args[++i]);
                    break;

                case "pgc":
                case "provisionalgamecount":
                    trainerSettings.ProvisionalGameCount = int.Parse(args[++i]);
                    break;

                case "mminm":
                case "mateminmix":
                    trainerSettings.MateMinMix = double.Parse(args[++i]);
                    break;

                case "mmaxm":
                case "matemaxmix":
                    trainerSettings.MateMaxMix = double.Parse(args[++i]);
                    break;

                case "mpc":
                case "mateparentcount":
                    trainerSettings.MateParentCount = int.Parse(args[++i]);
                    break;

                case "msp":
                case "mateshuffleparents":
                    trainerSettings.MateShuffleParents = bool.Parse(args[++i]);
                    break;

                case "tts":
                case "TransTableSize":
                    trainerSettings.TransTableSize = int.Parse(args[++i]);
                    break;

                case "mdepth":
                case "maxdepth":
                    trainerSettings.MaxDepth = int.Parse(args[++i]);
                    break;

                case "tmt":
                case "turnmaxtime":
                    trainerSettings.TurnMaxTime = TimeSpan.Parse(args[++i]);
                    break;

                case "btl":
                case "battletimelimit":
                    trainerSettings.BattleTimeLimit = TimeSpan.Parse(args[++i]);
                    break;

                case "gt":
                case "gametype":
                    trainerSettings.GameType = EnumUtils.ParseExpansionPieces(args[++i]);
                    break;

                case "tpp":
                case "targetprofilepath":
                    trainerSettings.TargetProfilePath = args[++i];
                    break;

                case "findpuzzlecandidates":
                case "fpc":
                    trainerSettings.FindPuzzleCandidates = bool.Parse(args[++i]);
                    break;

                case "maxhelperthreads":
                case "mht":
                    trainerSettings.MaxHelperThreads = int.Parse(args[++i]);
                    break;

                case "topcount":
                case "tc":
                    trainerSettings.TopCount = int.Parse(args[++i]);
                    break;

                case "agt":
                case "allgametypes":
                    trainerSettings.AllGameTypes = bool.Parse(args[++i]);
                    break;

                case "provisionalfirst":
                case "pf":
                    trainerSettings.ProvisionalFirst = bool.Parse(args[++i]);
                    break;

                case "itd":
                case "initialtabledepth":
                    trainerSettings.InitialTableDepth = int.Parse(args[++i]);
                    break;

                default:
                    throw new Exception(string.Format("Unknown parameter: {0}", args[i]));
                }
            }

            return(cmd);
        }
Example #19
0
        public static void AddFakeLfgAndShowWindow()
        {
            Game.Me.PlayerId = 10;
            WindowManager.LfgListWindow.ShowWindow();
            var party = new Listing
            {
                LeaderId   = 10,
                Message    = "SJG exp only",
                LeaderName = "Foglio",
                IsExpanded = true
            };
            var idx = 20U;

            foreach (var cl in EnumUtils.ListFromEnum <Class>().Where(x => x != Class.None && x != Class.Common))
            {
                party.Players.Add(new User(WindowManager.LfgListWindow.Dispatcher)
                {
                    PlayerId = idx, IsLeader = true, Online = true, Name = $"Member{cl}", UserClass = cl, Location = "Sirjuka Gallery"
                });
                party.Applicants.Add(new User(WindowManager.LfgListWindow.Dispatcher)
                {
                    PlayerId = idx + 100, Name = $"Applicant{cl}", Online = true, UserClass = cl, Location = "Sirjuka Gallery"
                });
                idx++;
            }

            var raid = new Listing
            {
                LeaderId   = 11,
                Message    = "WHHM 166+",
                LeaderName = "Foglio",
                IsExpanded = true,
                IsRaid     = true
            };

            raid.Players.Add(new User(WindowManager.LfgListWindow.Dispatcher)
            {
                PlayerId = 11, IsLeader = true, Online = true, Name = "Foglio"
            });
            raid.Applicants.Add(new User(WindowManager.LfgListWindow.Dispatcher)
            {
                PlayerId = 2, Name = "Applicant", Online = true, UserClass = Class.Priest
            });

            var trade = new Listing
            {
                LeaderId   = 12,
                Message    = "WTS stuff",
                LeaderName = "Foglio",
                IsExpanded = true
            };

            trade.Players.Add(new User(WindowManager.LfgListWindow.Dispatcher)
            {
                PlayerId = 12, IsLeader = true, Online = true, Name = "Foglio"
            });

            var trade2 = new Listing
            {
                LeaderId   = 13,
                Message    = "WTS more stuff",
                LeaderName = "Foglio",
                IsExpanded = true
            };

            trade2.Players.Add(new User(WindowManager.LfgListWindow.Dispatcher)
            {
                PlayerId = 13, IsLeader = true, Online = true, Name = "Foglio"
            });
            var twitch = new Listing
            {
                LeaderId   = 14,
                Message    = "twitch.tv/FoglioTera",
                LeaderName = "Foglio",
                IsExpanded = true
            };

            twitch.Players.Add(new User(WindowManager.LfgListWindow.Dispatcher)
            {
                PlayerId = 14, IsLeader = true, Online = true, Name = "Foglio"
            });


            WindowManager.ViewModels.LfgVM.AddOrRefreshListing(party);
            WindowManager.ViewModels.LfgVM.AddOrRefreshListing(raid);
            WindowManager.ViewModels.LfgVM.AddOrRefreshListing(trade);
            WindowManager.ViewModels.LfgVM.AddOrRefreshListing(trade2);
            WindowManager.ViewModels.LfgVM.AddOrRefreshListing(twitch);
        }
        protected static FR_Base Execute(DbConnection Connection, DbTransaction Transaction, P_L5BTS_CSwRC_1156 Parameter, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null)
        {
            #region UserCode
            var returnValue = new FR_Base();

            var webAvailabilityType = ORM_CMN_CAL_AVA_Availability_Type.Query.Search(Connection, Transaction, new ORM_CMN_CAL_AVA_Availability_Type.Query()
            {
                GlobalPropertyMatchingID = EnumUtils.GetEnumDescription(AvailabilityType.WebBooking),
                Tenant_RefID             = securityTicket.TenantID,
                IsDeleted = false
            }).Single();

            var standardAvailabilityType = ORM_CMN_CAL_AVA_Availability_Type.Query.Search(Connection, Transaction, new ORM_CMN_CAL_AVA_Availability_Type.Query()
            {
                GlobalPropertyMatchingID = EnumUtils.GetEnumDescription(AvailabilityType.Standard),
                Tenant_RefID             = securityTicket.TenantID,
                IsDeleted = false
            }).Single();

            var slot2ATs = ORM_PPS_TSK_BOK_BookableTimeSlots_2_AvailabilityType.Query.Search(Connection, Transaction, new ORM_PPS_TSK_BOK_BookableTimeSlots_2_AvailabilityType.Query()
            {
                Tenant_RefID = securityTicket.TenantID,
                IsDeleted    = false
            }).ToArray();

            foreach (var time in Parameter.Slots)
            {
                var slot = ORM_PPS_TSK_BOK_BookableTimeSlot.Query.Search(Connection, Transaction, new ORM_PPS_TSK_BOK_BookableTimeSlot.Query()
                {
                    Tenant_RefID = securityTicket.TenantID,
                    IsDeleted    = false,
                    PPS_TSK_BOK_BookableTimeSlotID = time.SlotID,
                    TaskTemplate_RefID             = Parameter.AppointmentTypeID,
                    Office_RefID = Parameter.OfficeID
                }).SingleOrDefault();
                if (slot == null)
                {
                    slot = new ORM_PPS_TSK_BOK_BookableTimeSlot()
                    {
                        PPS_TSK_BOK_BookableTimeSlotID = Guid.NewGuid(),
                        FreeSlotsForTaskTemplateITPL   = Guid.NewGuid().ToString(),
                        FreeInterval_Start             = time.Start,
                        FreeInterval_End   = time.End,
                        Office_RefID       = Parameter.OfficeID,
                        TaskTemplate_RefID = Parameter.AppointmentTypeID,
                        Tenant_RefID       = securityTicket.TenantID
                    };
                }

                var slot2AT = slot2ATs.SingleOrDefault(s => s.PPS_TSK_BOK_BookableTimeSlot_RefID == slot.PPS_TSK_BOK_BookableTimeSlotID);

                if (slot2AT == null)
                {
                    slot2AT = new ORM_PPS_TSK_BOK_BookableTimeSlots_2_AvailabilityType()
                    {
                        CMN_CAL_AVA_Availability_TypeID = time.IsWebBookable ? webAvailabilityType.CMN_CAL_AVA_Availability_TypeID : standardAvailabilityType.CMN_CAL_AVA_Availability_TypeID,
                        AssignmentID = Guid.NewGuid(),
                        Tenant_RefID = securityTicket.TenantID,
                        PPS_TSK_BOK_BookableTimeSlot_RefID = slot.PPS_TSK_BOK_BookableTimeSlotID,
                    };
                    slot2AT.Save(Connection, Transaction);
                }
                else
                {
                    if (slot2AT.CMN_CAL_AVA_Availability_TypeID != webAvailabilityType.CMN_CAL_AVA_Availability_TypeID && time.IsWebBookable)
                    {
                        slot2AT.CMN_CAL_AVA_Availability_TypeID = webAvailabilityType.CMN_CAL_AVA_Availability_TypeID;
                        slot2AT.Save(Connection, Transaction);
                    }
                    if (slot2AT.CMN_CAL_AVA_Availability_TypeID != standardAvailabilityType.CMN_CAL_AVA_Availability_TypeID && !time.IsWebBookable)
                    {
                        slot2AT.CMN_CAL_AVA_Availability_TypeID = standardAvailabilityType.CMN_CAL_AVA_Availability_TypeID;
                        slot2AT.Save(Connection, Transaction);
                    }
                }

                slot.Save(Connection, Transaction);

                foreach (var combination in time.Combinations)
                {
                    var resourceCombination = new ORM_PPS_TSK_BOK_AvailableResourceCombination()
                    {
                        PPS_TSK_BOK_AvailableResourceCombinationID = Guid.NewGuid(),
                        BookableTimeSlot_RefID = slot.PPS_TSK_BOK_BookableTimeSlotID,
                        IsAvailable            = true,
                        Tenant_RefID           = securityTicket.TenantID
                    };
                    resourceCombination.Save(Connection, Transaction);

                    foreach (var device in combination.DeviceInstance)
                    {
                        var reqDeviceInstance = new ORM_PPS_TSK_BOK_DeviceResource()
                        {
                            PPS_TSK_BOK_DeviceResourceID       = Guid.NewGuid(),
                            PPS_DEV_Device_Instance_RefID      = device.DeviceInstanceID,
                            AvailableResourceCombination_RefID = resourceCombination.PPS_TSK_BOK_AvailableResourceCombinationID,
                            Tenant_RefID = securityTicket.TenantID
                        };
                        reqDeviceInstance.Save(Connection, Transaction);
                    }

                    foreach (var staff in combination.Staff)
                    {
                        var reqStaff = new ORM_PPS_TSK_BOK_StaffResource()
                        {
                            PPS_TSK_BOK_StaffResourceID = Guid.NewGuid(),
                            CMN_BPT_EMP_Employee_RefID  = staff.StaffID,
                            CreatedFor_TaskTemplateRequiredStaff_RefID = staff.CreatedFor_TaskTemplateRequiredStaff_RefID,
                            AvailableResourceCombination_RefID         = resourceCombination.PPS_TSK_BOK_AvailableResourceCombinationID,
                            Tenant_RefID = securityTicket.TenantID
                        };
                        reqStaff.Save(Connection, Transaction);
                    }
                }

                if (time.CombinationForDelete != null)
                {
                    foreach (var combinationID in time.CombinationForDelete.CombinationIDs)
                    {
                        var resourceCombination = ORM_PPS_TSK_BOK_AvailableResourceCombination.Query.Search(Connection, Transaction, new ORM_PPS_TSK_BOK_AvailableResourceCombination.Query()
                        {
                            Tenant_RefID           = securityTicket.TenantID,
                            IsDeleted              = false,
                            BookableTimeSlot_RefID = slot.PPS_TSK_BOK_BookableTimeSlotID,
                            PPS_TSK_BOK_AvailableResourceCombinationID = combinationID
                        }).SingleOrDefault();
                        if (resourceCombination != null)
                        {
                            ORM_PPS_TSK_BOK_StaffResource.Query.SoftDelete(Connection, Transaction, new ORM_PPS_TSK_BOK_StaffResource.Query()
                            {
                                Tenant_RefID = securityTicket.TenantID,
                                IsDeleted    = false,
                                AvailableResourceCombination_RefID = resourceCombination.PPS_TSK_BOK_AvailableResourceCombinationID
                            });

                            ORM_PPS_TSK_BOK_DeviceResource.Query.SoftDelete(Connection, Transaction, new ORM_PPS_TSK_BOK_DeviceResource.Query()
                            {
                                Tenant_RefID = securityTicket.TenantID,
                                IsDeleted    = false,
                                AvailableResourceCombination_RefID = resourceCombination.PPS_TSK_BOK_AvailableResourceCombinationID
                            });

                            resourceCombination.IsDeleted = true;
                            resourceCombination.Save(Connection, Transaction);
                        }
                    }
                }
            }

            return(returnValue);

            #endregion UserCode
        }
        protected static FR_L5BC_SBPCN_0951 Execute(DbConnection Connection, DbTransaction Transaction, P_L5BC_SBPCN_0951 Parameter, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null)
        {
            #region UserCode
            var returnValue = new FR_L5BC_SBPCN_0951();
            returnValue.Result = new L5BC_SBPCN_0951();
            var resultsBillReimbursements = new List <Guid>();

            #region Load BillPosition Credits, if exist
            var billPositionsCreditIds = cls_Get_Reimbursements_and_GrantedCreditNotes_for_BillPositions.Invoke(
                Connection,
                Transaction,
                new P_L5BC_GRaGCNfBP_1021()
            {
                BillPositionIDs = Parameter.BillPositionCredits.Select(bpc => bpc.BillPositionID).ToArray()
            },
                securityTicket).Result;
            #endregion

            #region Load or Create BillPosition GrantedCreditNote
            var billGrantedCreditNote = new ORM_ACC_CRN_GrantedCreditNote();
            if (billPositionsCreditIds != null && billPositionsCreditIds.Count() > 0)
            {
                #region Load GrantedCreditNote
                billGrantedCreditNote.Load(
                    Connection,
                    Transaction,
                    billPositionsCreditIds[0].ACC_CRN_GrantedCreditNoteID);
                if (billGrantedCreditNote.ACC_CRN_GrantedCreditNoteID == Guid.Empty)
                {
                    returnValue.Status = FR_Status.Error_Internal;
                    returnValue.Result = null;
                    return(returnValue);
                }

                #region Load related Reimbursements to extract TotalAmount without Reimbursements linked to Parameter.BillPositions
                var grantedCreditNoteReimbursements = ORM_BIL_BillPosition_Reimbursement.Query.Search(
                    Connection,
                    Transaction,
                    new ORM_BIL_BillPosition_Reimbursement.Query()
                {
                    ACC_CRN_GrantedCreditNote_RefID = billGrantedCreditNote.ACC_CRN_GrantedCreditNoteID,
                    Tenant_RefID = securityTicket.TenantID,
                    IsDeleted    = false
                });
                if (grantedCreditNoteReimbursements == null || grantedCreditNoteReimbursements.Count <= 0)
                {
                    returnValue.Status = FR_Status.Error_Internal;
                    returnValue.Result = null;
                    return(returnValue);
                }
                var selectedBillPositions = Parameter.BillPositionCredits.Select(bp => bp.BillPositionID).ToList();
                grantedCreditNoteReimbursements
                    = grantedCreditNoteReimbursements.Where(gcnr => !selectedBillPositions.Any(bp => bp == gcnr.BIL_BillPosition_RefID)).ToList();

                billGrantedCreditNote.CreditNote_Value = grantedCreditNoteReimbursements.Sum(gcnr => gcnr.ReimbursedValue);
                #endregion

                #endregion
            }
            else
            {
                #region Create GrantedCreditNote
                #region Get GrantedCreditNote Number
                var grantedCreditNoteNumber = cls_Get_and_Increase_IncreasingNumber_for_UsageArea.Invoke(
                    Connection,
                    Transaction,
                    new P_L2NR_GaIINfUA_1454()
                {
                    GlobalStaticMatchingID = EnumUtils.GetEnumDescription(ENumberRangeUsageAreaType.BillNumber)
                },
                    securityTicket).Result.Current_IncreasingNumber;
                #endregion

                billGrantedCreditNote.ACC_CRN_GrantedCreditNoteID = Guid.NewGuid();
                billGrantedCreditNote.CreditNote_Number           = grantedCreditNoteNumber;
                billGrantedCreditNote.CreditNote_Currency_RefID   = Parameter.BillPositionCredits[0].BillHeaderCurencyID;
                billGrantedCreditNote.DateOnCreditNote            = DateTime.Now;
                billGrantedCreditNote.Tenant_RefID = securityTicket.TenantID;
                #endregion
            }
            #endregion

            foreach (var billPosition in Parameter.BillPositionCredits)
            {
                var billReimbursement = new ORM_BIL_BillPosition_Reimbursement();

                #region Load or Create BillPosition Reimbursement
                if (billPositionsCreditIds != null && billPositionsCreditIds.Any(bpc => bpc.BIL_BillPosition_RefID == billPosition.BillPositionID))
                {
                    #region Load Reimbursement
                    billReimbursement.Load(
                        Connection,
                        Transaction,
                        billPositionsCreditIds.Where(bpc => bpc.BIL_BillPosition_RefID == billPosition.BillPositionID).First().BIL_BillPosition_ReimbursementID);
                    if (billReimbursement.BIL_BillPosition_ReimbursementID == Guid.Empty)
                    {
                        returnValue.Status = FR_Status.Error_Internal;
                        returnValue.Result = null;
                        return(returnValue);
                    }
                    #endregion
                }
                else
                {
                    #region Create Reimbursement
                    billReimbursement.BIL_BillPosition_RefID          = billPosition.BillPositionID;
                    billReimbursement.ACC_CRN_GrantedCreditNote_RefID = billGrantedCreditNote.ACC_CRN_GrantedCreditNoteID;
                    billReimbursement.Tenant_RefID = securityTicket.TenantID;
                    #endregion
                }
                #endregion

                #region Update or Save Reimbursement and GrantedCreditNote
                billReimbursement.ReimbursedQuantity = billPosition.ReimbursedQuantity;
                billReimbursement.ReimbursedValue    = billPosition.ReimbursedValue;
                var saveBillReimbursement = billReimbursement.Save(Connection, Transaction);
                if (saveBillReimbursement.Status != FR_Status.Success)
                {
                    returnValue.Status = FR_Status.Error_Internal;
                    returnValue.Result = null;
                    return(returnValue);
                }
                resultsBillReimbursements.Add(billReimbursement.ACC_CRN_GrantedCreditNote_RefID);

                billGrantedCreditNote.CreditNote_Value += billReimbursement.ReimbursedValue;
                #endregion
            }

            #region Save BillPosition GrantedCreditNote
            var saveGrantedCreditNote = billGrantedCreditNote.Save(Connection, Transaction);
            if (saveGrantedCreditNote.Status != FR_Status.Success)
            {
                returnValue.Status = FR_Status.Error_Internal;
                returnValue.Result = null;
                return(returnValue);
            }
            #endregion

            returnValue.Result.GrantedCreditNoteID          = billGrantedCreditNote.ACC_CRN_GrantedCreditNoteID;
            returnValue.Result.BillPositionReimbursementIDs = resultsBillReimbursements.ToArray();
            returnValue.Status = FR_Status.Success;

            return(returnValue);

            #endregion UserCode
        }
Example #22
0
        private void DisplayActivitySummary(Asset asset)
        {
            DateRange timeFrame = SiteUtils.GetDateRangeFromTimeFrame(EnumUtils.GetEnumFromValue <TimeFrame>(TimeFrameDropDownList1.SelectedId));
            DataRow   row       = AssetReportMapper.Instance.GetAssetStats(asset.AssetId.GetValueOrDefault(), timeFrame);

            int assetDownloads       = Convert.ToInt32(row["AssetDownloads"]);
            int totalDownloads       = Convert.ToInt32(row["TotalDownloads"]);
            int assetOrderRequests   = Convert.ToInt32(row["AssetOrderRequests"]);
            int totalOrderRequests   = Convert.ToInt32(row["TotalOrderRequests"]);
            int assetViews           = Convert.ToInt32(row["AssetViews"]);
            int totalViews           = Convert.ToInt32(row["TotalViews"]);
            int assetSearchHits      = Convert.ToInt32(row["AssetSearchHits"]);
            int totalSearchHits      = Convert.ToInt32(row["TotalSearchHits"]);
            int assetAddedToCart     = Convert.ToInt32(row["AssetAddedToCart"]);
            int totalAddedToCart     = Convert.ToInt32(row["TotalAddedToCart"]);
            int assetAddedToLightbox = Convert.ToInt32(row["AssetAddedToLightbox"]);
            int totalAddedToLightbox = Convert.ToInt32(row["TotalAddedToLightbox"]);

            SiteUtils.PopulateCell(DownloadsCell, assetDownloads, totalDownloads);
            SiteUtils.PopulateCell(OrderRequestsCell, assetOrderRequests, totalOrderRequests);
            SiteUtils.PopulateCell(ViewsCell, assetViews, totalViews);
            SiteUtils.PopulateCell(SearchHitsCell, assetSearchHits, totalSearchHits);
            SiteUtils.PopulateCell(AddToCartCell, assetAddedToCart, totalAddedToCart);
            SiteUtils.PopulateCell(AddToLightboxCell, assetAddedToLightbox, totalAddedToLightbox);

            // Register the FusionCharts javascript
            if (!Page.ClientScript.IsClientScriptIncludeRegistered("FusionCharts"))
            {
                Page.ClientScript.RegisterClientScriptInclude("FusionCharts", ResolveUrl("~/FusionCharts/FusionCharts.js"));
            }

            // Setup the XML for the chart
            XElement xml = new XElement("graph",
                                        new XAttribute("xaxisname", string.Empty),
                                        new XAttribute("yaxisname", "Count"),
                                        new XAttribute("hovercapbg", "dedebe"),
                                        new XAttribute("hovercapborder", "413189"),
                                        new XAttribute("rotateNames", 0),
                                        new XAttribute("numdivlines", 9),
                                        new XAttribute("canvasBaseDepth", 2),
                                        new XAttribute("canvasBgDepth", 2),
                                        new XAttribute("divLineColor", "cccccc"),
                                        new XAttribute("divLineAlpha", 80),
                                        new XAttribute("divLineThickness", 1),
                                        new XAttribute("decimalPrecision", 0),
                                        new XAttribute("showAlternateHGridColor", 1),
                                        new XAttribute("AlternateHGridAlpha", 30),
                                        new XAttribute("AlternateHGridColor", "cccccc"),
                                        new XAttribute("zeroPlaneShowBorder", 1),
                                        new XElement("categories",
                                                     new XAttribute("font", "Arial"),
                                                     new XAttribute("fontSize", 11),
                                                     new XAttribute("fontColor", "000000"),
                                                     new XElement("category", new XAttribute("name", "Downloads")),
                                                     new XElement("category", new XAttribute("name", "   Order&#10;Requests"), new XAttribute("hoverText", "Order Requests")),
                                                     new XElement("category", new XAttribute("name", "Views")),
                                                     new XElement("category", new XAttribute("name", "Search&#10;  Hits"), new XAttribute("hoverText", "Search Hits")),
                                                     new XElement("category", new XAttribute("name", "Added&#10;   To&#10; Cart"), new XAttribute("hoverText", "Added To Cart")),
                                                     new XElement("category", new XAttribute("name", " Added&#10;   To&#10;Lightbox"), new XAttribute("hoverText", "Added To Lightbox"))
                                                     ),
                                        new XElement("dataset",
                                                     new XAttribute("seriesname", "This Asset"),
                                                     new XAttribute("color", "413189"),
                                                     new XElement("set", new XAttribute("value", assetDownloads)),
                                                     new XElement("set", new XAttribute("value", assetOrderRequests)),
                                                     new XElement("set", new XAttribute("value", assetViews)),
                                                     new XElement("set", new XAttribute("value", assetSearchHits)),
                                                     new XElement("set", new XAttribute("value", assetAddedToCart)),
                                                     new XElement("set", new XAttribute("value", assetAddedToLightbox))
                                                     ),
                                        new XElement("dataset",
                                                     new XAttribute("seriesname", "All Assets"),
                                                     new XAttribute("color", "bcbbcb"),
                                                     new XElement("set", new XAttribute("value", totalDownloads)),
                                                     new XElement("set", new XAttribute("value", totalOrderRequests)),
                                                     new XElement("set", new XAttribute("value", totalViews)),
                                                     new XElement("set", new XAttribute("value", totalSearchHits)),
                                                     new XElement("set", new XAttribute("value", totalAddedToCart)),
                                                     new XElement("set", new XAttribute("value", totalAddedToLightbox))
                                                     )
                                        );

            // Setup the chart
            ChartLiteral.Text = FusionCharts.RenderChart(ResolveUrl("~/FusionCharts/FCF_MSColumn3D.swf"), string.Empty, xml.ToUnformattedXmlForFusionCharts(), "AssetInfoChart_" + ChartLiteral.ClientID, "550", "350", false, false);
        }
        protected static FR_Guids Execute(DbConnection Connection, DbTransaction Transaction, P_L5CO_CCOaMR_1102 Parameter, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null)
        {
            #region UserCode
            var returnValue = new FR_Guids();
            var result      = new List <Guid>();

            #region Current_CustomerOrderStatus

            var orderedStatusID = ORM_ORD_CUO_CustomerOrder_Status.Query.Search(Connection, Transaction,
                                                                                new ORM_ORD_CUO_CustomerOrder_Status.Query
            {
                GlobalPropertyMatchingID = EnumUtils.GetEnumDescription(ECustomerOrderStatus.Ordered),
                Tenant_RefID             = securityTicket.TenantID,
                IsDeleted = false
            }).SingleOrDefault().ORD_CUO_CustomerOrder_StatusID;

            #endregion

            #region Get All OrganizationalUnits

            var organizationalUnits = ORM_CMN_BPT_CTM_OrganizationalUnit.Query.Search(Connection, Transaction, new ORM_CMN_BPT_CTM_OrganizationalUnit.Query()
            {
                Tenant_RefID = securityTicket.TenantID,
                IsDeleted    = false
            });
            #endregion

            foreach (var procurement in Parameter.Procurements)
            {
                #region CustomerOrder_Number

                var incrNumberParam = new P_L2NR_GaIINfUA_1454()
                {
                    GlobalStaticMatchingID = EnumUtils.GetEnumDescription(ENumberRangeUsageAreaType.CustomerOrderNumber)
                };
                var customerOrderNumber = cls_Get_and_Increase_IncreasingNumber_for_UsageArea.Invoke(Connection, Transaction, incrNumberParam, securityTicket).Result.Current_IncreasingNumber;

                #endregion

                var cuoHeader = new ORM_ORD_CUO_CustomerOrder_Header();
                cuoHeader.ORD_CUO_CustomerOrder_HeaderID    = Guid.NewGuid();
                cuoHeader.ProcurementOrderITL               = procurement.ProcurementHeaderInfo.ProcurementOrderInfo.ITL;
                cuoHeader.Current_CustomerOrderStatus_RefID = orderedStatusID;
                cuoHeader.CustomerOrder_Number              = customerOrderNumber;
                cuoHeader.CustomerOrder_Date = DateTime.Now;
                cuoHeader.OrderingCustomer_BusinessParticipant_RefID = Parameter.CustomerBusinessParticipantID;
                cuoHeader.CreatedBy_BusinessParticipant_RefID        = Parameter.CustomerBusinessParticipantID;
                cuoHeader.CanceledBy_BusinessParticipant_RefID       = Guid.Empty;
                cuoHeader.CustomerOrder_Currency_RefID = Guid.Empty;
                cuoHeader.TotalValue_BeforeTax         = 0;
                cuoHeader.IsCustomerOrderFinalized     = false;
                cuoHeader.DeliveryDeadline             = new DateTime();
                cuoHeader.IsPartialShippingAllowed     = true;
                cuoHeader.Tenant_RefID       = securityTicket.TenantID;
                cuoHeader.Creation_Timestamp = DateTime.Now;
                cuoHeader.Save(Connection, Transaction);

                #region CustomerOrderStatusHistory

                var statusHistory = new ORM_ORD_CUO_CustomerOrder_StatusHistory()
                {
                    ORD_CUO_CustomerOrder_StatusHistoryID = Guid.NewGuid(),
                    CustomerOrder_Header_RefID            = cuoHeader.ORD_CUO_CustomerOrder_HeaderID,
                    CustomerOrder_Status_RefID            = orderedStatusID,
                    StatusHistoryComment = "",
                    PerformedBy_BusinessParticipant_RefID = Parameter.CustomerBusinessParticipantID,
                    Creation_Timestamp = DateTime.Now,
                    Tenant_RefID       = securityTicket.TenantID
                };

                statusHistory.Save(Connection, Transaction);

                #endregion

                var     count   = 1;
                decimal ammount = 0;

                foreach (var position in procurement.ProcurementPositions)
                {
                    #region FindArticle

                    var product = ORM_CMN_PRO_Product.Query.Search(Connection, Transaction,
                                                                   new ORM_CMN_PRO_Product.Query()
                    {
                        ProductITL   = position.Product.ProductITL,
                        IsDeleted    = false,
                        Tenant_RefID = securityTicket.TenantID,
                        IsProductAvailableForOrdering = true
                    }).Single();

                    var packageInfo = ORM_CMN_PRO_PAC_PackageInfo.Query.Search(Connection, Transaction,
                                                                               new ORM_CMN_PRO_PAC_PackageInfo.Query()
                    {
                        CMN_PRO_PAC_PackageInfoID = product.PackageInfo_RefID,
                        IsDeleted    = false,
                        Tenant_RefID = securityTicket.TenantID
                    }).SingleOrDefault();

                    #endregion

                    #region Find Price

                    decimal priceAmount = 0;

                    if (position.Product.SourceCatalogITL == EnumUtils.GetEnumDescription(EPublicCatalogs.ABDA))
                    {
                        var abdaCatalogSubscription = ORM_CMN_PRO_SubscribedCatalog.Query.Search(Connection, Transaction,
                                                                                                 new ORM_CMN_PRO_SubscribedCatalog.Query()
                        {
                            CatalogCodeITL = EnumUtils.GetEnumDescription(EPublicCatalogs.ABDA),
                            Tenant_RefID   = securityTicket.TenantID,
                            IsDeleted      = false
                        }
                                                                                                 ).SingleOrDefault();

                        var price = ORM_CMN_SLS_Price.Query.Search(Connection, Transaction, new ORM_CMN_SLS_Price.Query()
                        {
                            CMN_PRO_Product_RefID  = product.CMN_PRO_ProductID,
                            PricelistRelease_RefID = abdaCatalogSubscription.SubscribedCatalog_PricelistRelease_RefID,
                            IsDeleted = false
                        }).Single();

                        priceAmount = price.PriceAmount;
                    }
                    else
                    {
                        var catalog = ORM_CMN_PRO_Catalog.Query.Search(Connection, Transaction,
                                                                       new ORM_CMN_PRO_Catalog.Query()
                        {
                            CatalogCodeITL = position.Product.SourceCatalogITL,
                            IsDeleted      = false,
                            Tenant_RefID   = securityTicket.TenantID
                        }).Single();

                        var lastPublishedRevision = ORM_CMN_PRO_Catalog_Revision.Query.Search(Connection, Transaction,
                                                                                              new ORM_CMN_PRO_Catalog_Revision.Query()
                        {
                            CMN_PRO_Catalog_RefID = catalog.CMN_PRO_CatalogID,
                            IsDeleted             = false,
                            Tenant_RefID          = securityTicket.TenantID,
                        }).Where(j => j.PublishedOn_Date != new DateTime()).OrderBy(i => i.RevisionNumber).Last();

                        var price = ORM_CMN_SLS_Price.Query.Search(Connection, Transaction,
                                                                   new ORM_CMN_SLS_Price.Query()
                        {
                            CMN_PRO_Product_RefID  = product.CMN_PRO_ProductID,
                            PricelistRelease_RefID = lastPublishedRevision.Default_PricelistRelease_RefID,
                            CMN_Currency_RefID     = catalog.Catalog_Currency_RefID,
                            IsDeleted    = false,
                            Tenant_RefID = securityTicket.TenantID
                        }).Single();

                        priceAmount = price.PriceAmount;
                    }

                    #endregion

                    var cuoPosition = new ORM_ORD_CUO_CustomerOrder_Position();
                    cuoPosition.ORD_CUO_CustomerOrder_PositionID = Guid.NewGuid();
                    cuoPosition.CustomerOrder_Header_RefID       = cuoHeader.ORD_CUO_CustomerOrder_HeaderID;
                    cuoPosition.Position_OrdinalNumber           = count++;
                    cuoPosition.Position_Quantity                = position.TotalOrderQuantity;
                    cuoPosition.Position_ValuePerUnit            = priceAmount;
                    cuoPosition.Position_ValueTotal              = priceAmount * (decimal)position.TotalOrderQuantity;
                    cuoPosition.Position_Comment                 = String.Empty;
                    cuoPosition.Position_Unit_RefID              = packageInfo.PackageContent_MeasuredInUnit_RefID;
                    cuoPosition.Position_RequestedDateOfDelivery = new DateTime();
                    cuoPosition.CMN_PRO_Product_RefID            = product.CMN_PRO_ProductID;
                    cuoPosition.CMN_PRO_Product_Release_RefID    = Guid.Empty;
                    cuoPosition.CMN_PRO_Product_Variant_RefID    = Guid.Empty;
                    cuoPosition.IsProductReplacementAllowed      = position.Product.IsProductReplacementAllowed;

                    cuoPosition.Tenant_RefID       = securityTicket.TenantID;
                    cuoPosition.Creation_Timestamp = DateTime.Now;
                    cuoPosition.Save(Connection, Transaction);

                    #region Product 2 OrganizationalUnit

                    foreach (var item in position.TargetOrgUnitInfo)
                    {
                        var orgUnit = organizationalUnits.Where(i => i.CustomerTenant_OfficeITL == item.OfficeITL).Single();

                        var assignement = new ORM_ORD_CUO_Position_CustomerOrganizationalUnitDistribution()
                        {
                            ORD_CUO_Position_CustomerOrganizationalUnitDistributionID = Guid.NewGuid(),
                            Quantity = item.SubQuantity,
                            CMN_BPT_CTM_OrganizationalUnit_RefID = orgUnit.CMN_BPT_CTM_OrganizationalUnitID,
                            ORD_CUO_CustomerOrder_Position_RefID = cuoPosition.ORD_CUO_CustomerOrder_PositionID,
                            Creation_Timestamp = DateTime.Now,
                            Tenant_RefID       = securityTicket.TenantID
                        };

                        assignement.Save(Connection, Transaction);
                    }

                    #endregion

                    ammount += cuoPosition.Position_ValueTotal;
                }

                #region Create comments

                if (procurement.ProcurementComments != null)
                {
                    foreach (var item in procurement.ProcurementComments)
                    {
                        var orgUnit = organizationalUnits.Where(i => i.CustomerTenant_OfficeITL == item.OfficeITL).Single();

                        var assignement = new ORM_ORD_CUO_CustomerOrder_Note()
                        {
                            ORD_CUO_CustomerOrder_NoteID         = Guid.NewGuid(),
                            CustomerOrder_Header_RefID           = cuoHeader.ORD_CUO_CustomerOrder_HeaderID,
                            CustomerOrder_Position_RefID         = Guid.Empty,
                            CMN_BPT_CTM_OrganizationalUnit_RefID = orgUnit.CMN_BPT_CTM_OrganizationalUnitID,
                            Title               = item.Title,
                            Comment             = item.Content,
                            NotePublishDate     = item.PublilshDate,
                            SequenceOrderNumber = item.SequenceNumber,
                            Creation_Timestamp  = DateTime.Now,
                            Tenant_RefID        = securityTicket.TenantID
                        };

                        assignement.Save(Connection, Transaction);
                    }
                }

                #endregion

                cuoHeader.TotalValue_BeforeTax = ammount;
                cuoHeader.Save(Connection, Transaction);

                result.Add(cuoHeader.ORD_CUO_CustomerOrder_HeaderID);
            }

            returnValue.Result = result.ToArray();
            return(returnValue);

            #endregion UserCode
        }
Example #24
0
        /// <summary>   Process this. </summary>
        ///
        /// <remarks>   Ken, 10/3/2020. </remarks>
        ///
        /// <param name="entityDomainModel">        The entity domain model. </param>
        /// <param name="businessModel">            The business model. </param>
        /// <param name="projectType">              Type of the project. </param>
        /// <param name="projectFolderRoot">        The project folder root. </param>
        /// <param name="entitiesProject"></param>
        /// <param name="generatorConfiguration">   The generator configuration. </param>
        /// <param name="appUIHierarchyNodeObject"></param>
        ///
        /// <returns>   True if it succeeds, false if it fails. </returns>

        public bool Process(EntityDomainModel entityDomainModel, BusinessModel businessModel, Guid projectType, string projectFolderRoot, IVSProject entitiesProject, IGeneratorConfiguration generatorConfiguration, out AppUIHierarchyNodeObject appUIHierarchyNodeObject)
        {
            var appSystemObject         = businessModel.GetDescendants().Single(a => a.IsApp && a.Name == generatorConfiguration.AppName);
            var topLevelObject          = businessModel.TopLevelObject;
            var topHierarchyNodeObjects = new List <UIHierarchyNodeObject>();
            var allHierarchyNodeObjects = new List <UIHierarchyNodeObject>();
            var appSettingsObjects      = new Dictionary <AppSettingsKind, BusinessModelObject>();
            IMemoryModuleBuilder  memoryModuleBuilder;
            ModuleBuilder         entititesModuleBuilder;
            UIHierarchyNodeObject topHierarchyNodeObject = null;
            string debugUIHierarchy;

            // create the UI hierarchy

            appUIHierarchyNodeObject = null;

            topLevelObject.GetDescendantsAndSelf <BusinessModelObject, UIHierarchyNodeObject>(o => o.Children, (o, n) =>
            {
                var hierarchyNodeObject = new UIHierarchyNodeObject(o);

                if (topHierarchyNodeObject == null)
                {
                    topHierarchyNodeObject = hierarchyNodeObject;
                }

                if (n != null)
                {
                    n.AddChild(hierarchyNodeObject);
                }

                return(hierarchyNodeObject);
            });

            // prune the tree

            topHierarchyNodeObject.GetDescendantsAndSelf(n => n.Children, n =>
            {
                if (n.Parent != null)
                {
                    var parent = n.Parent;

                    if (!parent.ShowInUI)
                    {
                        var newParent = parent.Parent;

                        if (newParent == null)
                        {
                            n.Parent = null;

                            if (n.ShowInUI)
                            {
                                topHierarchyNodeObjects.Add(n);
                            }
                        }
                        else
                        {
                            newParent.Children.Remove(parent);
                            newParent.AddChild(n);
                        }
                    }
                }
            });

            foreach (var hierarchyNodeObject in topHierarchyNodeObjects)
            {
                allHierarchyNodeObjects.AddRange(hierarchyNodeObject.GetDescendantsAndSelf());
            }

            // create the app UI Hierarchy

            appUIHierarchyNodeObject = allHierarchyNodeObjects.Single(n => n.Id == appSystemObject.Id).CreateCopy <AppUIHierarchyNodeObject>();

            foreach (var hierarchyNodeObject in topHierarchyNodeObjects)
            {
                hierarchyNodeObject.Name = "Home";

                appUIHierarchyNodeObject.TopUIHierarchyNodeObjects.Add(hierarchyNodeObject);
            }

            // attach entities

            foreach (var entity in entityDomainModel.Entities)
            {
                if (entity.IsInherentDataItem)
                {
                    appUIHierarchyNodeObject.InherentEntities.Add(entity);
                }
                else
                {
                    var hierarchyNodeObject = allHierarchyNodeObjects.Single(n => n.Id == entity.ParentDataItem);

                    foreach (var shadowHierarchyNodeObject in allHierarchyNodeObjects.Where(n => n.ShadowItem == hierarchyNodeObject.Id))
                    {
                        shadowHierarchyNodeObject.Entities.Add(entity);
                    }

                    hierarchyNodeObject.Entities.Add(entity);
                }

                appUIHierarchyNodeObject.AllEntities.Add(entity);
            }

            // create new entities from app settings kind

            foreach (var appSettingsObject in topLevelObject.GetDescendants().Where(o => o.AppSettingsKind != null))
            {
                var appSettingsKind = EnumUtils.GetValue <AppSettingsKind>(appSettingsObject.AppSettingsKind);

                appSettingsObjects.Add(appSettingsKind, appSettingsObject);
            }

            foreach (var pair in appSettingsObjects)
            {
                var appSettingsKind = pair.Key;
                var handler         = generatorConfiguration.GetAppSettingsKindHandler(appSettingsKind);

                if (handler != null)
                {
                    handler.Process(entityDomainModel, businessModel, appUIHierarchyNodeObject, appSettingsObjects, projectType, projectFolderRoot, generatorConfiguration);
                }
            }

            // create new entities from many-to-many containers

            foreach (var entity in appUIHierarchyNodeObject.AllEntities.ToList().Where(e => e.HasRelatedEntityAttributes()))
            {
                foreach (var containsManyToManyAttribute in entity.GetRelatedEntityAttributes().Where(a => a.Properties.Single(p => p.PropertyName == "RelatedEntity").ChildProperties.Any(p2 => p2.PropertyName == "RelationshipKind" && p2.PropertyValue == "ContainsManyToMany")))
                {
                    var relatedEntityProperty      = containsManyToManyAttribute.Properties.Single(p => p.PropertyName == "RelatedEntity");
                    var containsManyToManyProperty = relatedEntityProperty.ChildProperties.Single(p2 => p2.PropertyName == "RelationshipKind" && p2.PropertyValue == "ContainsManyToMany");
                    var existingEntityProperty     = containsManyToManyProperty.ChildProperties.Single(p3 => p3.PropertyName == "ExistingEntity");
                    var existingEntityName         = existingEntityProperty.PropertyValue;
                    var existingEntity             = appUIHierarchyNodeObject.AllEntities.Single(e => e.Name == existingEntityName);
                    var containerNameProperty      = containsManyToManyProperty.ChildProperties.Single(p3 => p3.PropertyName == "ContainerName");
                    var containerName         = containerNameProperty.PropertyValue;
                    var associateEntityObject = new EntityObject()
                    {
                        Name = containerName,
                        IsInherentDataItem = true,
                        Attributes         = new List <AttributeObject>()
                        {
                            new AttributeObject
                            {
                                Name          = entity.Name,
                                AttributeType = "related entity",
                                Properties    = new List <EntityPropertyItem>()
                                {
                                    new EntityPropertyItem()
                                    {
                                        PropertyName    = "RelatedEntity",
                                        PropertyValue   = "IsLookupOfManyToOne",
                                        ChildProperties = new List <EntityPropertyItem>()
                                        {
                                            new EntityPropertyItem()
                                            {
                                                PropertyName  = "ExistingEntity",
                                                PropertyValue = entity.Name
                                            }
                                        }
                                    }
                                }
                            },
                            new AttributeObject
                            {
                                Name          = existingEntityName,
                                AttributeType = "related entity",
                                Properties    = new List <EntityPropertyItem>()
                                {
                                    new EntityPropertyItem()
                                    {
                                        PropertyName    = "RelatedEntity",
                                        PropertyValue   = "IsLookupOfManyToOne",
                                        ChildProperties = new List <EntityPropertyItem>()
                                        {
                                            new EntityPropertyItem()
                                            {
                                                PropertyName  = "ExistingEntity",
                                                PropertyValue = existingEntityName
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    };

                    if (entity.HasIdentityEntityKind(IdentityEntityKind.User) && existingEntity.HasIdentityEntityKind(IdentityEntityKind.Role))
                    {
                        associateEntityObject.Properties = new List <EntityPropertyItem>()
                        {
                            new EntityPropertyItem()
                            {
                                PropertyName    = "IdentityEntity",
                                ChildProperties = new List <EntityPropertyItem>()
                                {
                                    new EntityPropertyItem()
                                    {
                                        PropertyName  = "IdentityEntityKind",
                                        PropertyValue = IdentityEntityKind.UserToRole.ToString()
                                    }
                                }
                            }
                        };
                    }

                    appUIHierarchyNodeObject.InherentEntities.Add(associateEntityObject);
                    appUIHierarchyNodeObject.AllEntities.Add(associateEntityObject);
                }
            }

            debugUIHierarchy = appUIHierarchyNodeObject.DebugPrintUIHierarchy();

            // build types

            memoryModuleBuilder    = generatorConfiguration.GetMemoryModuleBuilder();
            entititesModuleBuilder = memoryModuleBuilder.CreateMemoryModuleBuilder(entitiesProject);

            appUIHierarchyNodeObject.EntitiesModuleBuilder = entititesModuleBuilder;

            foreach (var entity in appUIHierarchyNodeObject.AllEntities)
            {
                generatorConfiguration.CreateTypeForEntity(entititesModuleBuilder, entity, appUIHierarchyNodeObject);
            }

            return(true);
        }
Example #25
0
 private static void UpdateListItem(ReportListItem data, Report report, IPersistenceContext context)
 {
     data.ReportRef    = report.GetRef();
     data.ReportStatus = EnumUtils.GetEnumValueInfo(report.Status, context);
 }
Example #26
0
        static IntrinsicTable()
        {
            _intrinTable = new IntrinsicInfo[EnumUtils.GetCount(typeof(Intrinsic))];

            Add(Intrinsic.X86Addpd, new IntrinsicInfo(X86Instruction.Addpd, IntrinsicType.Binary));
            Add(Intrinsic.X86Addps, new IntrinsicInfo(X86Instruction.Addps, IntrinsicType.Binary));
            Add(Intrinsic.X86Addsd, new IntrinsicInfo(X86Instruction.Addsd, IntrinsicType.Binary));
            Add(Intrinsic.X86Addss, new IntrinsicInfo(X86Instruction.Addss, IntrinsicType.Binary));
            Add(Intrinsic.X86Andnpd, new IntrinsicInfo(X86Instruction.Andnpd, IntrinsicType.Binary));
            Add(Intrinsic.X86Andnps, new IntrinsicInfo(X86Instruction.Andnps, IntrinsicType.Binary));
            Add(Intrinsic.X86Andpd, new IntrinsicInfo(X86Instruction.Andpd, IntrinsicType.Binary));
            Add(Intrinsic.X86Andps, new IntrinsicInfo(X86Instruction.Andps, IntrinsicType.Binary));
            Add(Intrinsic.X86Blendvpd, new IntrinsicInfo(X86Instruction.Blendvpd, IntrinsicType.Ternary));
            Add(Intrinsic.X86Blendvps, new IntrinsicInfo(X86Instruction.Blendvps, IntrinsicType.Ternary));
            Add(Intrinsic.X86Cmppd, new IntrinsicInfo(X86Instruction.Cmppd, IntrinsicType.TernaryImm));
            Add(Intrinsic.X86Cmpps, new IntrinsicInfo(X86Instruction.Cmpps, IntrinsicType.TernaryImm));
            Add(Intrinsic.X86Cmpsd, new IntrinsicInfo(X86Instruction.Cmpsd, IntrinsicType.TernaryImm));
            Add(Intrinsic.X86Cmpss, new IntrinsicInfo(X86Instruction.Cmpss, IntrinsicType.TernaryImm));
            Add(Intrinsic.X86Comisdeq, new IntrinsicInfo(X86Instruction.Comisd, IntrinsicType.Comis_));
            Add(Intrinsic.X86Comisdge, new IntrinsicInfo(X86Instruction.Comisd, IntrinsicType.Comis_));
            Add(Intrinsic.X86Comisdlt, new IntrinsicInfo(X86Instruction.Comisd, IntrinsicType.Comis_));
            Add(Intrinsic.X86Comisseq, new IntrinsicInfo(X86Instruction.Comiss, IntrinsicType.Comis_));
            Add(Intrinsic.X86Comissge, new IntrinsicInfo(X86Instruction.Comiss, IntrinsicType.Comis_));
            Add(Intrinsic.X86Comisslt, new IntrinsicInfo(X86Instruction.Comiss, IntrinsicType.Comis_));
            Add(Intrinsic.X86Cvtdq2pd, new IntrinsicInfo(X86Instruction.Cvtdq2pd, IntrinsicType.Unary));
            Add(Intrinsic.X86Cvtdq2ps, new IntrinsicInfo(X86Instruction.Cvtdq2ps, IntrinsicType.Unary));
            Add(Intrinsic.X86Cvtpd2dq, new IntrinsicInfo(X86Instruction.Cvtpd2dq, IntrinsicType.Unary));
            Add(Intrinsic.X86Cvtpd2ps, new IntrinsicInfo(X86Instruction.Cvtpd2ps, IntrinsicType.Unary));
            Add(Intrinsic.X86Cvtps2dq, new IntrinsicInfo(X86Instruction.Cvtps2dq, IntrinsicType.Unary));
            Add(Intrinsic.X86Cvtps2pd, new IntrinsicInfo(X86Instruction.Cvtps2pd, IntrinsicType.Unary));
            Add(Intrinsic.X86Cvtsd2si, new IntrinsicInfo(X86Instruction.Cvtsd2si, IntrinsicType.UnaryToGpr));
            Add(Intrinsic.X86Cvtsd2ss, new IntrinsicInfo(X86Instruction.Cvtsd2ss, IntrinsicType.Binary));
            Add(Intrinsic.X86Cvtsi2si, new IntrinsicInfo(X86Instruction.Movd, IntrinsicType.UnaryToGpr));
            Add(Intrinsic.X86Cvtss2sd, new IntrinsicInfo(X86Instruction.Cvtss2sd, IntrinsicType.Binary));
            Add(Intrinsic.X86Divpd, new IntrinsicInfo(X86Instruction.Divpd, IntrinsicType.Binary));
            Add(Intrinsic.X86Divps, new IntrinsicInfo(X86Instruction.Divps, IntrinsicType.Binary));
            Add(Intrinsic.X86Divsd, new IntrinsicInfo(X86Instruction.Divsd, IntrinsicType.Binary));
            Add(Intrinsic.X86Divss, new IntrinsicInfo(X86Instruction.Divss, IntrinsicType.Binary));
            Add(Intrinsic.X86Haddpd, new IntrinsicInfo(X86Instruction.Haddpd, IntrinsicType.Binary));
            Add(Intrinsic.X86Haddps, new IntrinsicInfo(X86Instruction.Haddps, IntrinsicType.Binary));
            Add(Intrinsic.X86Maxpd, new IntrinsicInfo(X86Instruction.Maxpd, IntrinsicType.Binary));
            Add(Intrinsic.X86Maxps, new IntrinsicInfo(X86Instruction.Maxps, IntrinsicType.Binary));
            Add(Intrinsic.X86Maxsd, new IntrinsicInfo(X86Instruction.Maxsd, IntrinsicType.Binary));
            Add(Intrinsic.X86Maxss, new IntrinsicInfo(X86Instruction.Maxss, IntrinsicType.Binary));
            Add(Intrinsic.X86Minpd, new IntrinsicInfo(X86Instruction.Minpd, IntrinsicType.Binary));
            Add(Intrinsic.X86Minps, new IntrinsicInfo(X86Instruction.Minps, IntrinsicType.Binary));
            Add(Intrinsic.X86Minsd, new IntrinsicInfo(X86Instruction.Minsd, IntrinsicType.Binary));
            Add(Intrinsic.X86Minss, new IntrinsicInfo(X86Instruction.Minss, IntrinsicType.Binary));
            Add(Intrinsic.X86Movhlps, new IntrinsicInfo(X86Instruction.Movhlps, IntrinsicType.Binary));
            Add(Intrinsic.X86Movlhps, new IntrinsicInfo(X86Instruction.Movlhps, IntrinsicType.Binary));
            Add(Intrinsic.X86Mulpd, new IntrinsicInfo(X86Instruction.Mulpd, IntrinsicType.Binary));
            Add(Intrinsic.X86Mulps, new IntrinsicInfo(X86Instruction.Mulps, IntrinsicType.Binary));
            Add(Intrinsic.X86Mulsd, new IntrinsicInfo(X86Instruction.Mulsd, IntrinsicType.Binary));
            Add(Intrinsic.X86Mulss, new IntrinsicInfo(X86Instruction.Mulss, IntrinsicType.Binary));
            Add(Intrinsic.X86Paddb, new IntrinsicInfo(X86Instruction.Paddb, IntrinsicType.Binary));
            Add(Intrinsic.X86Paddd, new IntrinsicInfo(X86Instruction.Paddd, IntrinsicType.Binary));
            Add(Intrinsic.X86Paddq, new IntrinsicInfo(X86Instruction.Paddq, IntrinsicType.Binary));
            Add(Intrinsic.X86Paddw, new IntrinsicInfo(X86Instruction.Paddw, IntrinsicType.Binary));
            Add(Intrinsic.X86Pand, new IntrinsicInfo(X86Instruction.Pand, IntrinsicType.Binary));
            Add(Intrinsic.X86Pandn, new IntrinsicInfo(X86Instruction.Pandn, IntrinsicType.Binary));
            Add(Intrinsic.X86Pavgb, new IntrinsicInfo(X86Instruction.Pavgb, IntrinsicType.Binary));
            Add(Intrinsic.X86Pavgw, new IntrinsicInfo(X86Instruction.Pavgw, IntrinsicType.Binary));
            Add(Intrinsic.X86Pblendvb, new IntrinsicInfo(X86Instruction.Pblendvb, IntrinsicType.Ternary));
            Add(Intrinsic.X86Pcmpeqb, new IntrinsicInfo(X86Instruction.Pcmpeqb, IntrinsicType.Binary));
            Add(Intrinsic.X86Pcmpeqd, new IntrinsicInfo(X86Instruction.Pcmpeqd, IntrinsicType.Binary));
            Add(Intrinsic.X86Pcmpeqq, new IntrinsicInfo(X86Instruction.Pcmpeqq, IntrinsicType.Binary));
            Add(Intrinsic.X86Pcmpeqw, new IntrinsicInfo(X86Instruction.Pcmpeqw, IntrinsicType.Binary));
            Add(Intrinsic.X86Pcmpgtb, new IntrinsicInfo(X86Instruction.Pcmpgtb, IntrinsicType.Binary));
            Add(Intrinsic.X86Pcmpgtd, new IntrinsicInfo(X86Instruction.Pcmpgtd, IntrinsicType.Binary));
            Add(Intrinsic.X86Pcmpgtq, new IntrinsicInfo(X86Instruction.Pcmpgtq, IntrinsicType.Binary));
            Add(Intrinsic.X86Pcmpgtw, new IntrinsicInfo(X86Instruction.Pcmpgtw, IntrinsicType.Binary));
            Add(Intrinsic.X86Pmaxsb, new IntrinsicInfo(X86Instruction.Pmaxsb, IntrinsicType.Binary));
            Add(Intrinsic.X86Pmaxsd, new IntrinsicInfo(X86Instruction.Pmaxsd, IntrinsicType.Binary));
            Add(Intrinsic.X86Pmaxsw, new IntrinsicInfo(X86Instruction.Pmaxsw, IntrinsicType.Binary));
            Add(Intrinsic.X86Pmaxub, new IntrinsicInfo(X86Instruction.Pmaxub, IntrinsicType.Binary));
            Add(Intrinsic.X86Pmaxud, new IntrinsicInfo(X86Instruction.Pmaxud, IntrinsicType.Binary));
            Add(Intrinsic.X86Pmaxuw, new IntrinsicInfo(X86Instruction.Pmaxuw, IntrinsicType.Binary));
            Add(Intrinsic.X86Pminsb, new IntrinsicInfo(X86Instruction.Pminsb, IntrinsicType.Binary));
            Add(Intrinsic.X86Pminsd, new IntrinsicInfo(X86Instruction.Pminsd, IntrinsicType.Binary));
            Add(Intrinsic.X86Pminsw, new IntrinsicInfo(X86Instruction.Pminsw, IntrinsicType.Binary));
            Add(Intrinsic.X86Pminub, new IntrinsicInfo(X86Instruction.Pminub, IntrinsicType.Binary));
            Add(Intrinsic.X86Pminud, new IntrinsicInfo(X86Instruction.Pminud, IntrinsicType.Binary));
            Add(Intrinsic.X86Pminuw, new IntrinsicInfo(X86Instruction.Pminuw, IntrinsicType.Binary));
            Add(Intrinsic.X86Pmovsxbw, new IntrinsicInfo(X86Instruction.Pmovsxbw, IntrinsicType.Unary));
            Add(Intrinsic.X86Pmovsxdq, new IntrinsicInfo(X86Instruction.Pmovsxdq, IntrinsicType.Unary));
            Add(Intrinsic.X86Pmovsxwd, new IntrinsicInfo(X86Instruction.Pmovsxwd, IntrinsicType.Unary));
            Add(Intrinsic.X86Pmovzxbw, new IntrinsicInfo(X86Instruction.Pmovzxbw, IntrinsicType.Unary));
            Add(Intrinsic.X86Pmovzxdq, new IntrinsicInfo(X86Instruction.Pmovzxdq, IntrinsicType.Unary));
            Add(Intrinsic.X86Pmovzxwd, new IntrinsicInfo(X86Instruction.Pmovzxwd, IntrinsicType.Unary));
            Add(Intrinsic.X86Pmulld, new IntrinsicInfo(X86Instruction.Pmulld, IntrinsicType.Binary));
            Add(Intrinsic.X86Pmullw, new IntrinsicInfo(X86Instruction.Pmullw, IntrinsicType.Binary));
            Add(Intrinsic.X86Popcnt, new IntrinsicInfo(X86Instruction.Popcnt, IntrinsicType.PopCount));
            Add(Intrinsic.X86Por, new IntrinsicInfo(X86Instruction.Por, IntrinsicType.Binary));
            Add(Intrinsic.X86Pshufb, new IntrinsicInfo(X86Instruction.Pshufb, IntrinsicType.Binary));
            Add(Intrinsic.X86Pslld, new IntrinsicInfo(X86Instruction.Pslld, IntrinsicType.Binary));
            Add(Intrinsic.X86Pslldq, new IntrinsicInfo(X86Instruction.Pslldq, IntrinsicType.Binary));
            Add(Intrinsic.X86Psllq, new IntrinsicInfo(X86Instruction.Psllq, IntrinsicType.Binary));
            Add(Intrinsic.X86Psllw, new IntrinsicInfo(X86Instruction.Psllw, IntrinsicType.Binary));
            Add(Intrinsic.X86Psrad, new IntrinsicInfo(X86Instruction.Psrad, IntrinsicType.Binary));
            Add(Intrinsic.X86Psraw, new IntrinsicInfo(X86Instruction.Psraw, IntrinsicType.Binary));
            Add(Intrinsic.X86Psrld, new IntrinsicInfo(X86Instruction.Psrld, IntrinsicType.Binary));
            Add(Intrinsic.X86Psrlq, new IntrinsicInfo(X86Instruction.Psrlq, IntrinsicType.Binary));
            Add(Intrinsic.X86Psrldq, new IntrinsicInfo(X86Instruction.Psrldq, IntrinsicType.Binary));
            Add(Intrinsic.X86Psrlw, new IntrinsicInfo(X86Instruction.Psrlw, IntrinsicType.Binary));
            Add(Intrinsic.X86Psubb, new IntrinsicInfo(X86Instruction.Psubb, IntrinsicType.Binary));
            Add(Intrinsic.X86Psubd, new IntrinsicInfo(X86Instruction.Psubd, IntrinsicType.Binary));
            Add(Intrinsic.X86Psubq, new IntrinsicInfo(X86Instruction.Psubq, IntrinsicType.Binary));
            Add(Intrinsic.X86Psubw, new IntrinsicInfo(X86Instruction.Psubw, IntrinsicType.Binary));
            Add(Intrinsic.X86Punpckhbw, new IntrinsicInfo(X86Instruction.Punpckhbw, IntrinsicType.Binary));
            Add(Intrinsic.X86Punpckhdq, new IntrinsicInfo(X86Instruction.Punpckhdq, IntrinsicType.Binary));
            Add(Intrinsic.X86Punpckhqdq, new IntrinsicInfo(X86Instruction.Punpckhqdq, IntrinsicType.Binary));
            Add(Intrinsic.X86Punpckhwd, new IntrinsicInfo(X86Instruction.Punpckhwd, IntrinsicType.Binary));
            Add(Intrinsic.X86Punpcklbw, new IntrinsicInfo(X86Instruction.Punpcklbw, IntrinsicType.Binary));
            Add(Intrinsic.X86Punpckldq, new IntrinsicInfo(X86Instruction.Punpckldq, IntrinsicType.Binary));
            Add(Intrinsic.X86Punpcklqdq, new IntrinsicInfo(X86Instruction.Punpcklqdq, IntrinsicType.Binary));
            Add(Intrinsic.X86Punpcklwd, new IntrinsicInfo(X86Instruction.Punpcklwd, IntrinsicType.Binary));
            Add(Intrinsic.X86Pxor, new IntrinsicInfo(X86Instruction.Pxor, IntrinsicType.Binary));
            Add(Intrinsic.X86Rcpps, new IntrinsicInfo(X86Instruction.Rcpps, IntrinsicType.Unary));
            Add(Intrinsic.X86Rcpss, new IntrinsicInfo(X86Instruction.Rcpss, IntrinsicType.Unary));
            Add(Intrinsic.X86Roundpd, new IntrinsicInfo(X86Instruction.Roundpd, IntrinsicType.BinaryImm));
            Add(Intrinsic.X86Roundps, new IntrinsicInfo(X86Instruction.Roundps, IntrinsicType.BinaryImm));
            Add(Intrinsic.X86Roundsd, new IntrinsicInfo(X86Instruction.Roundsd, IntrinsicType.BinaryImm));
            Add(Intrinsic.X86Roundss, new IntrinsicInfo(X86Instruction.Roundss, IntrinsicType.BinaryImm));
            Add(Intrinsic.X86Rsqrtps, new IntrinsicInfo(X86Instruction.Rsqrtps, IntrinsicType.Unary));
            Add(Intrinsic.X86Rsqrtss, new IntrinsicInfo(X86Instruction.Rsqrtss, IntrinsicType.Unary));
            Add(Intrinsic.X86Shufpd, new IntrinsicInfo(X86Instruction.Shufpd, IntrinsicType.TernaryImm));
            Add(Intrinsic.X86Shufps, new IntrinsicInfo(X86Instruction.Shufps, IntrinsicType.TernaryImm));
            Add(Intrinsic.X86Sqrtpd, new IntrinsicInfo(X86Instruction.Sqrtpd, IntrinsicType.Unary));
            Add(Intrinsic.X86Sqrtps, new IntrinsicInfo(X86Instruction.Sqrtps, IntrinsicType.Unary));
            Add(Intrinsic.X86Sqrtsd, new IntrinsicInfo(X86Instruction.Sqrtsd, IntrinsicType.Unary));
            Add(Intrinsic.X86Sqrtss, new IntrinsicInfo(X86Instruction.Sqrtss, IntrinsicType.Unary));
            Add(Intrinsic.X86Subpd, new IntrinsicInfo(X86Instruction.Subpd, IntrinsicType.Binary));
            Add(Intrinsic.X86Subps, new IntrinsicInfo(X86Instruction.Subps, IntrinsicType.Binary));
            Add(Intrinsic.X86Subsd, new IntrinsicInfo(X86Instruction.Subsd, IntrinsicType.Binary));
            Add(Intrinsic.X86Subss, new IntrinsicInfo(X86Instruction.Subss, IntrinsicType.Binary));
            Add(Intrinsic.X86Unpckhpd, new IntrinsicInfo(X86Instruction.Unpckhpd, IntrinsicType.Binary));
            Add(Intrinsic.X86Unpckhps, new IntrinsicInfo(X86Instruction.Unpckhps, IntrinsicType.Binary));
            Add(Intrinsic.X86Unpcklpd, new IntrinsicInfo(X86Instruction.Unpcklpd, IntrinsicType.Binary));
            Add(Intrinsic.X86Unpcklps, new IntrinsicInfo(X86Instruction.Unpcklps, IntrinsicType.Binary));
            Add(Intrinsic.X86Xorpd, new IntrinsicInfo(X86Instruction.Xorpd, IntrinsicType.Binary));
            Add(Intrinsic.X86Xorps, new IntrinsicInfo(X86Instruction.Xorps, IntrinsicType.Binary));
        }
Example #27
0
        private static void UpdateListItem(OrderListItem data, Order order, IPersistenceContext context)
        {
            var practitionerAssembler = new ExternalPractitionerAssembler();
            var dsAssembler           = new DiagnosticServiceAssembler();
            var facilityAssembler     = new FacilityAssembler();

            data.OrderRef              = order.GetRef();
            data.PlacerNumber          = order.PlacerNumber;
            data.AccessionNumber       = order.AccessionNumber;
            data.DiagnosticService     = dsAssembler.CreateSummary(order.DiagnosticService);
            data.EnteredTime           = order.EnteredTime;
            data.SchedulingRequestTime = order.SchedulingRequestTime;
            data.OrderingPractitioner  = practitionerAssembler.CreateExternalPractitionerSummary(order.OrderingPractitioner, context);
            data.OrderingFacility      = facilityAssembler.CreateFacilitySummary(order.OrderingFacility);
            data.ReasonForStudy        = order.ReasonForStudy;
            data.OrderPriority         = EnumUtils.GetEnumValueInfo(order.Priority, context);
            data.CancelReason          = order.CancelInfo != null && order.CancelInfo.Reason != null?EnumUtils.GetEnumValueInfo(order.CancelInfo.Reason) : null;

            data.OrderStatus             = EnumUtils.GetEnumValueInfo(order.Status, context);
            data.OrderScheduledStartTime = order.ScheduledStartTime;
        }
Example #28
0
        public static IsobaricType Find(string isobaricTypeName)
        {
            var types = EnumUtils.EnumToArray <IsobaricType>();

            return(types.FirstOrDefault(m => m.ToString().Equals(isobaricTypeName)));
        }
Example #29
0
 static SmallRNAConsts()
 {
     Biotypes = EnumUtils.EnumToStringArray <SmallRNABiotype>();
 }
Example #30
0
 public static TRecognizerOptions GetOptions(int value) => EnumUtils.Convert <TRecognizerOptions>(value);