Exemplo n.º 1
0
 public UdpClientChannel(IDictionary properties, IClientChannelSinkProvider provider)
 {
     ChannelName = properties.GetValue("name", UdpChannelHelper.DefaultName);
     ChannelPriority = properties.GetValue("priority", UdpChannelHelper.DefaultPriority);
     ClientSinkProvider = provider ?? UdpChannelHelper.CreateClientSinkProvider();
     SetupClientProviderChain(ClientSinkProvider, new UdpClientChannelSinkProvider());
 }
Exemplo n.º 2
0
        public override object Deserialize(IDictionary<string, object> dictionary, Type type, JavaScriptSerializer serializer)
        {
            if (dictionary != null)
            {
                var role = new Role();

                role.Id = dictionary.GetValue<int>(RedmineKeys.ID);
                role.Name = dictionary.GetValue<string>(RedmineKeys.NAME);

                var permissions = dictionary.GetValue<ArrayList>(RedmineKeys.PERMISSIONS);
                if (permissions != null)
                {
                    role.Permissions = new List<Permission>();
                    foreach (var permission in permissions)
                    {
                        var perms = new Permission() { Info = permission.ToString() };
                        role.Permissions.Add(perms);
                    }

                }

                return role;
            }
            return null;
        }
        public override object Deserialize(IDictionary<string, object> dictionary, Type type, JavaScriptSerializer serializer)
        {
            if (dictionary != null)
            {
                var customField = new IssueCustomField();

                customField.Id = dictionary.GetValue<int>(RedmineKeys.ID);
                customField.Name = dictionary.GetValue<string>(RedmineKeys.NAME);
                customField.Multiple = dictionary.GetValue<bool>(RedmineKeys.MULTIPLE);

                var val = dictionary.GetValue<object>(RedmineKeys.VALUE);

                if (val != null)
                {
                    if (customField.Values == null) customField.Values = new List<CustomFieldValue>();
                    var list = val as ArrayList;
                    if (list != null)
                    {
                        foreach (string value in list)
                        {
                            customField.Values.Add(new CustomFieldValue { Info = value });
                        }
                    }
                    else
                    {
                        customField.Values.Add(new CustomFieldValue { Info = val as string });
                    }
                }
                return customField;
            }

            return null;
        }
Exemplo n.º 4
0
 public StyleRuleMetadata(IDictionary<string, object> metadata)
 {
     this.AfterNames = metadata.GetValue("After", DefaultNamesValue).Where(n => n != null).ToList();
     this.BeforeNames = metadata.GetValue("Before", DefaultNamesValue).Where(n => n != null).ToList();
     this.LanguageName = (string)metadata["LanguageName"];
     this.Name = (string)metadata["Name"];
 }
        public override object Deserialize(IDictionary<string, object> dictionary, Type type, JavaScriptSerializer serializer)
        {
            WfClientRelativeLinkDescriptor relativeLink = (WfClientRelativeLinkDescriptor)base.Deserialize(dictionary, type, serializer);

            relativeLink.Category = dictionary.GetValue("category", string.Empty);
            relativeLink.Url = dictionary.GetValue("url", string.Empty);

            return relativeLink;
        }
        public override object Deserialize(IDictionary<string, object> dictionary, Type type, JavaScriptSerializer serializer)
        {
            WfClientDynamicResourceDescriptor conditionResourceDesp = (WfClientDynamicResourceDescriptor)base.Deserialize(dictionary, type, serializer);

            conditionResourceDesp.Name = dictionary.GetValue("name", string.Empty);
            conditionResourceDesp.Condition = JSONSerializerExecute.Deserialize<WfClientConditionDescriptor>(dictionary.GetValue("condition", (object)null));

            return conditionResourceDesp;
        }
		public override object Deserialize(IDictionary<string, object> dictionary, Type type, JavaScriptSerializer serializer)
		{
			WeChatBaseResponse data = new WeChatBaseResponse();

			data.Ret = dictionary.GetValue("ret", 0);
			data.ErrMsg = dictionary.GetValue("err_msg", string.Empty);

			return data;
		}
        public override object Deserialize(IDictionary<string, object> dictionary, Type type, JavaScriptSerializer serializer)
        {
            string columnName = dictionary.GetValue("columnName", string.Empty);

            SOARolePropertyValue pv = new SOARolePropertyValue(new SOARolePropertyDefinition() { Name = columnName });

            pv.Value = dictionary.GetValue("value", string.Empty);

            return pv;
        }
        public override object Deserialize(IDictionary<string, object> dictionary, Type type, JavaScriptSerializer serializer)
        {
            if (dictionary != null)
            {
                var timeEntryActivity = new TimeEntryActivity { Id = dictionary.GetValue<int>("id"), Name = dictionary.GetValue<string>("name"), IsDefault = dictionary.GetValue<bool>("is_default") };
                return timeEntryActivity;
            }

            return null;
        }
        public override object Deserialize(IDictionary<string, object> dictionary, Type type, JavaScriptSerializer serializer)
        {
            WfClientApplication application = new WfClientApplication();

            application.CodeName = dictionary.GetValue("codeName", string.Empty);
            application.Name = dictionary.GetValue("name", string.Empty);
            application.Sort = dictionary.GetValue("sort", 0);

            return application;
        }
Exemplo n.º 11
0
        public override object Deserialize(IDictionary<string, object> dictionary, Type type, JavaScriptSerializer serializer)
        {
            if (dictionary != null)
            {
                var tracker = new Tracker { Id = dictionary.GetValue<int>("id"), Name = dictionary.GetValue<string>("name") };
                return tracker;
            }

            return null;
        }
        public override object Deserialize(IDictionary<string, object> dictionary, Type type, JavaScriptSerializer serializer)
        {
            WfClientTransitionDescriptor transition = (WfClientTransitionDescriptor)base.Deserialize(dictionary, type, serializer);

            transition.FromActivityKey = dictionary.GetValue("fromActivityKey", string.Empty);
            transition.ToActivityKey = dictionary.GetValue("toActivityKey", string.Empty);
            transition.Condition = JSONSerializerExecute.Deserialize<WfClientConditionDescriptor>(dictionary.GetValue("condition", (object)null));

            return transition;
        }
Exemplo n.º 13
0
        public override object Deserialize(IDictionary<string, object> dictionary, Type type, JavaScriptSerializer serializer)
        {
            if (dictionary != null)
            {
                var project = new Project();

                project.Id = dictionary.GetValue<int>("id");
                project.Description = dictionary.GetValue<string>("description");
                project.HomePage = dictionary.GetValue<string>("homepage");
                project.Name = dictionary.GetValue<string>("name");
                project.Identifier = dictionary.GetValue<string>("identifier");
                project.Status = dictionary.GetValue<ProjectStatus>("status");
                project.CreatedOn = dictionary.GetValue<DateTime?>("created_on");
                project.UpdatedOn = dictionary.GetValue<DateTime?>("updated_on");
                project.Trackers = dictionary.GetValueAsCollection<ProjectTracker>("trackers");
                project.CustomFields = dictionary.GetValueAsCollection<IssueCustomField>("custom_fields");
                project.IsPublic = dictionary.GetValue<bool>("is_public");
                project.Parent = dictionary.GetValueAsIdentifiableName("parent");
                project.IssueCategories = dictionary.GetValueAsCollection<ProjectIssueCategory>("issue_categories");
                project.EnabledModules = dictionary.GetValueAsCollection<ProjectEnabledModule>("enabled_modules");
                return project;
            }

            return null;
        }
Exemplo n.º 14
0
        public override object Deserialize(IDictionary<string, object> dictionary, Type type, JavaScriptSerializer serializer)
        {
            if (dictionary != null)
            {
                var project = new Project();

                project.Id = dictionary.GetValue<int>(RedmineKeys.ID);
                project.Description = dictionary.GetValue<string>(RedmineKeys.DESCRIPTION);
                project.HomePage = dictionary.GetValue<string>(RedmineKeys.HOMEPAGE);
                project.Name = dictionary.GetValue<string>(RedmineKeys.NAME);
                project.Identifier = dictionary.GetValue<string>(RedmineKeys.IDENTIFIER);
                project.Status = dictionary.GetValue<ProjectStatus>(RedmineKeys.STATUS);
                project.CreatedOn = dictionary.GetValue<DateTime?>(RedmineKeys.CREATED_ON);
                project.UpdatedOn = dictionary.GetValue<DateTime?>(RedmineKeys.UPDATED_ON);
                project.Trackers = dictionary.GetValueAsCollection<ProjectTracker>(RedmineKeys.TRACKERS);
                project.CustomFields = dictionary.GetValueAsCollection<IssueCustomField>(RedmineKeys.CUSTOM_FIELDS);
                project.IsPublic = dictionary.GetValue<bool>(RedmineKeys.IS_PUBLIC);
                project.Parent = dictionary.GetValueAsIdentifiableName(RedmineKeys.PARENT);
                project.IssueCategories = dictionary.GetValueAsCollection<ProjectIssueCategory>(RedmineKeys.ISSUE_CATEGORIES);
                project.EnabledModules = dictionary.GetValueAsCollection<ProjectEnabledModule>(RedmineKeys.ENABLED_MODULES);
                return project;
            }

            return null;
        }
 public override object Deserialize(IDictionary<string, object> dictionary, Type type, JavaScriptSerializer serializer)
 {
     if ((dictionary != null))
     {
         var projectTracker = new ProjectIssueCategory();
         projectTracker.Id = dictionary.GetValue<int>("id");
         projectTracker.Name = dictionary.GetValue<string>("name");
         return projectTracker;
     }
     return null;
 }
 public override object Deserialize(IDictionary<string, object> dictionary, Type type, JavaScriptSerializer serializer)
 {
     if ((dictionary != null))
     {
         var projectTracker = new ProjectTracker();
         projectTracker.Id = dictionary.GetValue<int>(RedmineKeys.ID);
         projectTracker.Name = dictionary.GetValue<string>(RedmineKeys.NAME);
         return projectTracker;
     }
     return null;
 }
        public override object Deserialize(IDictionary<string, object> dictionary, Type type, JavaScriptSerializer serializer)
        {
            WfClientRolePropertyRow row = new WfClientRolePropertyRow();

            row.RowNumber = dictionary.GetValue("rowNumber", 0);
            row.Operator = dictionary.GetValue("operator", string.Empty);
            row.OperatorType = dictionary.GetValue("operatorType", WfClientRoleOperatorType.User);
            JSONSerializerExecute.FillDeserializedCollection(dictionary["values"], row.Values);

            return row;
        }
 public override object Deserialize(IDictionary<string, object> dictionary, Type type, JavaScriptSerializer serializer)
 {
     if ((dictionary != null))
     {
         var projectEnableModule = new ProjectEnabledModule();
         projectEnableModule.Id = dictionary.GetValue<int>("id");
         projectEnableModule.Name = dictionary.GetValue<string>("name");
         return projectEnableModule;
     }
     return null;
 }
        public override object Deserialize(IDictionary<string, object> dictionary, Type type, JavaScriptSerializer serializer)
        {
            WfClientProgram program = new WfClientProgram();

            program.ApplicationCodeName = dictionary.GetValue("applicationCodeName", string.Empty);
            program.CodeName = dictionary.GetValue("codeName", string.Empty);
            program.Name = dictionary.GetValue("name", string.Empty);
            program.Sort = dictionary.GetValue("sort", 0);

            return program;
        }
Exemplo n.º 20
0
 public UdpServerChannel(IDictionary properties, IServerChannelSinkProvider provider)
 {
     ChannelName = properties.GetValue("name", UdpChannelHelper.DefaultName);
     ChannelPriority = properties.GetValue("priority", UdpChannelHelper.DefaultPriority);
     MachineName = properties.GetValue("machineName", Dns.GetHostName());
     Port = properties.GetValue("port", UdpChannelHelper.DefaultPort);
     ChannelDataStore = UdpChannelHelper.CreateChannelDataStore(MachineName, Port);
     ServerSinkProvider = provider ?? UdpChannelHelper.CreateServerSinkProvider();
     SetupServerSinkChain(ServerSinkProvider);
     StartListening(null);
 }
        public override object Deserialize(IDictionary<string, object> dictionary, Type type, JavaScriptSerializer serializer)
        {
            WfClientProcessInfo processInfo = (WfClientProcessInfo)base.Deserialize(dictionary, type, serializer);

            processInfo.CurrentActivity = JSONSerializerExecute.Deserialize<WfClientActivity>(dictionary.GetValue("currentActivity", (WfClientActivity)null));
            processInfo.PreviousActivity = JSONSerializerExecute.Deserialize<WfClientActivity>(dictionary.GetValue("previousActivity", (WfClientActivity)null));

            JSONSerializerExecute.FillDeserializedCollection(dictionary.GetValue("nextActivities", (object)null), processInfo.NextActivities);

            return processInfo;
        }
        public override object Deserialize(IDictionary<string, object> dictionary, Type type, JavaScriptSerializer serializer)
        {
            WfClientBranchProcessTemplateDescriptor template = (WfClientBranchProcessTemplateDescriptor)base.Deserialize(dictionary, type, serializer);

            template.Condition = JSONSerializerExecute.Deserialize<WfClientConditionDescriptor>(dictionary.GetValue("condition", (object)null));

            JSONSerializerExecute.FillDeserializedCollection<WfClientResourceDescriptor>(dictionary.GetValue("resources", (object)null), template.Resources);
            JSONSerializerExecute.FillDeserializedCollection<WfClientResourceDescriptor>(dictionary.GetValue("cancelSubProcessNotifier", (object)null), template.CancelSubProcessNotifier);
            JSONSerializerExecute.FillDeserializedCollection<WfClientRelativeLinkDescriptor>(dictionary.GetValue("relativeLinks", (object)null), template.RelativeLinks);

            return template;
        }
        public override object Deserialize(IDictionary<string, object> dictionary, Type type, JavaScriptSerializer serializer)
        {
            if (dictionary != null)
            {
                var entity = new IdentifiableName();

                entity.Id = dictionary.GetValue<int>(RedmineKeys.ID);
                entity.Name = dictionary.GetValue<string>(RedmineKeys.NAME);

                return entity;
            }
            return null;
        }
        public override object Deserialize(IDictionary<string, object> dictionary, Type type, JavaScriptSerializer serializer)
        {
            WfClientTransferParams transferParams = new WfClientTransferParams();

            transferParams.NextActivityDescriptorKey = dictionary.GetValue("nextActivityDescriptorKey", string.Empty);
            transferParams.FromTransitionDescriptorKey = dictionary.GetValue("fromTransitionDescriptorKey", string.Empty);
            transferParams.Operator = JSONSerializerExecute.Deserialize<WfClientUser>(dictionary.GetValue("operator", (object)null));

            JSONSerializerExecute.FillDeserializedCollection(dictionary["branchTransferParams"], transferParams.BranchTransferParams);
            JSONSerializerExecute.FillDeserializedCollection(dictionary["assignees"], transferParams.Assignees);

            return transferParams;
        }
Exemplo n.º 25
0
        public override object Deserialize(IDictionary<string, object> dictionary, Type type, JavaScriptSerializer serializer)
        {
            if (dictionary != null)
            {
                var watcher = new Watcher();

                watcher.Id = dictionary.GetValue<int>("id");
                watcher.Name = dictionary.GetValue<string>("name");

                return watcher;
            }

            return null;
        }
        public override object Deserialize(IDictionary<string, object> dictionary, Type type, JavaScriptSerializer serializer)
        {
            WfClientProcessDescriptor processDesp = (WfClientProcessDescriptor)base.Deserialize(dictionary, type, serializer);

            JSONSerializerExecute.FillDeserializedCollection<WfClientActivityDescriptor>(dictionary.GetValue("activities", (object)null), processDesp.Activities);

            processDesp.NormalizeAllTransitions();

            JSONSerializerExecute.FillDeserializedCollection<WfClientVariableDescriptor>(dictionary.GetValue("variables", (object)null), processDesp.Variables);
            JSONSerializerExecute.FillDeserializedCollection<WfClientRelativeLinkDescriptor>(dictionary.GetValue("relativeLinks", (object)null), processDesp.RelativeLinks);
            JSONSerializerExecute.FillDeserializedCollection<WfClientResourceDescriptor>(dictionary.GetValue("cancelEventReceivers", (object)null), processDesp.CancelEventReceivers);

            return processDesp;
        }
Exemplo n.º 27
0
        public override object Deserialize(IDictionary<string, object> dictionary, Type type, JavaScriptSerializer serializer)
        {
            if (dictionary != null)
            {
                var userGroup = new GroupUser();

                userGroup.Id = dictionary.GetValue<int>(RedmineKeys.ID);
                userGroup.Name = dictionary.GetValue<string>(RedmineKeys.NAME);

                return userGroup;
            }

            return null;
        }
Exemplo n.º 28
0
        public override object Deserialize(IDictionary<string, object> dictionary, Type type, JavaScriptSerializer serializer)
        {
            if (dictionary != null)
            {
                var userGroup = new UserGroup();

                userGroup.Id = dictionary.GetValue<int>("id");
                userGroup.Name = dictionary.GetValue<string>("name");

                return userGroup;
            }

            return null;
        }
        public override object Deserialize(IDictionary<string, object> dictionary, Type type, JavaScriptSerializer serializer)
        {
            if (dictionary != null)
            {
                var entity = new TrackerCustomField();

                entity.Id = dictionary.GetValue<int>("id");
                entity.Name = dictionary.GetValue<string>("name");

                return entity;
            }

            return null;
        }
Exemplo n.º 30
0
        public override object Deserialize(IDictionary<string, object> dictionary, Type type, JavaScriptSerializer serializer)
        {
            if (dictionary != null)
            {
                var role = new Role();

                role.Id = dictionary.GetValue<int>("id");
                role.Name = dictionary.GetValue<string>("name");
                role.Permissions = dictionary.GetValueAsCollection<Permission>("permissions");

                return role;
            }
            return null;
        }
 public static string GetMessage(this IDictionary dictionary)
 {
     return(dictionary.GetValue <string>("message"));
 }
Exemplo n.º 32
0
        public override object Deserialize(IDictionary <string, object> dictionary, Type type, JavaScriptSerializer serializer)
        {
            if (dictionary != null)
            {
                User user = new User();
                user.Login                = dictionary.GetValue <string>("login");
                user.Id                   = dictionary.GetValue <int>("id");
                user.FirstName            = dictionary.GetValue <string>("firstname");
                user.LastName             = dictionary.GetValue <string>("lastname");
                user.Email                = dictionary.GetValue <string>("mail");
                user.AuthenticationModeId = dictionary.GetValue <int?>("auth_source_id");
                user.CreatedOn            = dictionary.GetValue <DateTime?>("created_on");
                user.LastLoginOn          = dictionary.GetValue <DateTime?>("last_login_on");
                user.ApiKey               = dictionary.GetValue <string>("api_key");
                user.Status               = dictionary.GetValue <UserStatus>("status");
                user.MustChangePassword   = dictionary.GetValue <bool>("must_change_passwd");
                user.CustomFields         = dictionary.GetValueAsCollection <IssueCustomField>("custom_fields");
                user.Memberships          = dictionary.GetValueAsCollection <Membership>("memberships");
                user.Groups               = dictionary.GetValueAsCollection <UserGroup>("groups");

                return(user);
            }
            return(null);
        }
Exemplo n.º 33
0
 private static IList <int> ParseByMonthDays(IDictionary <string, string> values)
 {
     return(ParseByMonthDays(values.GetValue("BYMONTHDAY", (string)null)));
 }
Exemplo n.º 34
0
 public static DateTime GetDateTime(this IDictionary <string, object> aValues, string aParam, DateTime aDefault)
 {
     return(TryParse.DateTime(aValues.GetValue(aParam)));
 }
 public Maybe <Type> GetTypeByContractName(string contractName)
 {
     return(_contract2Type.GetValue(contractName));
 }
 public static SFSUser GetSFSUser(this IDictionary dictionary)
 {
     return(dictionary.GetValue <SFSUser>("user"));
 }
 public static ISFSObject GetParams(this IDictionary dictionary)
 {
     return(dictionary.GetValue <ISFSObject>("params"));
 }
 public static List <MMOItem> GetAddedItemss(this IDictionary dictionary)
 {
     return(dictionary.GetValue <List <MMOItem> >("addedItems"));
 }
Exemplo n.º 39
0
        public override object Deserialize(IDictionary <string, object> dictionary, Type type, JavaScriptSerializer serializer)
        {
            WfClientProcessStartupParams startupParams = new WfClientProcessStartupParams();

            startupParams.AutoStartInitialActivity = dictionary.GetValue("autoStartInitialActivity", true);
            startupParams.AutoCommit = dictionary.GetValue("autoCommit", false);
            startupParams.CheckStartProcessUserPermission = dictionary.GetValue("checkStartProcessUserPermission", true);
            startupParams.DefaultTaskTitle     = dictionary.GetValue("defaultTaskTitle", string.Empty);
            startupParams.DefaultUrl           = dictionary.GetValue("defaultUrl", string.Empty);
            startupParams.ProcessDescriptorKey = dictionary.GetValue("processDescriptorKey", string.Empty);
            startupParams.RelativeID           = dictionary.GetValue("relativeID", string.Empty);
            startupParams.RelativeURL          = dictionary.GetValue("relativeURL", string.Empty);
            startupParams.ResourceID           = dictionary.GetValue("resourceID", string.Empty);
            startupParams.RuntimeProcessName   = dictionary.GetValue("runtimeProcessName", string.Empty);
            startupParams.AutoPersist          = dictionary.GetValue("autoPersist", true);

            startupParams.Creator    = JSONSerializerExecute.Deserialize <WfClientUser>(dictionary.GetValue("creator", (object)null));
            startupParams.Department = JSONSerializerExecute.Deserialize <WfClientOrganization>(dictionary.GetValue("department", (object)null));

            startupParams.Opinion = JSONSerializerExecute.Deserialize <WfClientOpinion>(dictionary.GetValue("opinion", (object)null));

            JSONSerializerExecute.FillDeserializedCollection(dictionary.GetValue("assignees", (object)null), startupParams.Assignees);
            JSONSerializerExecute.FillDeserializedDictionary(dictionary, "applicationRuntimeParameters", startupParams.ApplicationRuntimeParameters);
            JSONSerializerExecute.FillDeserializedDictionary(dictionary, "processContext", startupParams.ProcessContext);

            return(startupParams);
        }
 public static List <User> GetRemovedUsers(this IDictionary dictionary)
 {
     return(dictionary.GetValue <List <User> >("removedUsers"));
 }
 public static MMORoom GetMMORoom(this IDictionary dictionary)
 {
     return(dictionary.GetValue <MMORoom>("room"));
 }
 public static User GetSender(this IDictionary dictionary)
 {
     return(dictionary.GetValue <User>("sender"));
 }
Exemplo n.º 43
0
 public static int GetInt32(this IDictionary <string, object> aValues, string aParam, int aDefault = 0)
 {
     return(TryParse.Int32(aValues.GetValue(aParam), aDefault));
 }
 public static string GetCommande(this IDictionary dictionary)
 {
     return(dictionary.GetValue <string>("cmd"));
 }
Exemplo n.º 45
0
 public static bool GetBool(this IDictionary <string, object> aValues, string aParam, bool aDefault = false)
 {
     return(TryParse.Bool(aValues.GetValue(aParam), aDefault));
 }
 private static IList <ByDay> ParseByDayWithOffset(IDictionary <string, string> values)
 {
     return(ParseByDayWithOffset(values.GetValue("BYDAY", (string?)null)));
 }
 public Maybe <string> GetContractNameByType(Type messageType)
 {
     return(_type2Contract.GetValue(messageType));
 }
 private static IList <DayOfWeek> ParseByDay(IDictionary <string, string> values)
 {
     return(ParseByDay(values.GetValue("BYDAY", (string?)null)));
 }
Exemplo n.º 49
0
 private static IList <int> ParseBySetPos(IDictionary <string, string> values)
 {
     return(ParseBySetPos(values.GetValue("BYSETPOS", (string)null)));
 }
Exemplo n.º 50
0
        public override object Deserialize(IDictionary <string, object> dictionary, Type type, JavaScriptSerializer serializer)
        {
            WfClientBranchProcessTransferParams transferParams = new WfClientBranchProcessTransferParams();

            transferParams.Template = JSONSerializerExecute.Deserialize <WfClientBranchProcessTemplateDescriptor>(dictionary.GetValue("template", (object)null));

            JSONSerializerExecute.FillDeserializedCollection(dictionary["branchParams"], transferParams.BranchParams);

            return(transferParams);
        }
Exemplo n.º 51
0
 private static IList <Month> ParseByMonth(IDictionary <string, string> values)
 {
     return(ParseByMonth(values.GetValue("BYMONTH", (string)null)));
 }
Exemplo n.º 52
0
 static public ELEMENT_TYPE GetValue <KEY_TYPE, ELEMENT_TYPE>(this IDictionary <KEY_TYPE, ELEMENT_TYPE> item, KEY_TYPE key)
 {
     return(item.GetValue(key, default(ELEMENT_TYPE)));
 }
Exemplo n.º 53
0
        public override object Map(KCMapObjectRequest request)
        {
            foreach (PropertyDescriptor property in TypeDescriptor.GetProperties(request.Target))
            {
                PXResult <KCMapping> exportMappingRow = _mappingMaint.ExportMappingRow.Select(request.EntityType, property.Name, request.ViewName).FirstOrDefault();
                if (exportMappingRow == null)
                {
                    continue;
                }
                KCMapping mapping = exportMappingRow.GetItem <KCMapping>();
                KCAcumaticaMappingField acumaticaField = exportMappingRow.GetItem <KCAcumaticaMappingField>();
                string formula = mapping.RuleType == KCRuleTypesConstants.Expression
                              ? mapping.SourceExpression
                              : acumaticaField?.FieldName;

                IDictionary <string, object> mappingValue = GetMappingValue(request, property);
                if (mappingValue == null || (property.PropertyType != typeof(bool?) && property.PropertyType != typeof(bool) && mappingValue.GetValue(formula) == null))
                {
                    continue;
                }
                MapField(request.EntityType, request.Target, property, mappingValue, formula);
            }

            return(request.Target);
        }
 public static object GetObject(this IDictionary dictionary, string key)
 {
     return(dictionary.GetValue <object>(key));
 }
Exemplo n.º 55
0
        /// <summary>
        ///     When overridden in a derived class, converts the provided dictionary into an object of the specified type.
        /// </summary>
        /// <param name="dictionary">
        ///     An <see cref="T:System.Collections.Generic.IDictionary`2" /> instance of property data stored
        ///     as name/value pairs.
        /// </param>
        /// <param name="type">The type of the resulting object.</param>
        /// <param name="serializer">The <see cref="T:System.Web.Script.Serialization.JavaScriptSerializer" /> instance.</param>
        /// <returns>
        ///     The deserialized object.
        /// </returns>
        public override object Deserialize(IDictionary <string, object> dictionary, Type type,
                                           JavaScriptSerializer serializer)
        {
            if (dictionary != null)
            {
                var file = new File {
                };

                file.Author      = dictionary.GetValueAsIdentifiableName(RedmineKeys.AUTHOR);
                file.ContentType = dictionary.GetValue <string>(RedmineKeys.CONTENT_TYPE);
                file.ContentUrl  = dictionary.GetValue <string>(RedmineKeys.CONTENT_URL);
                file.CreatedOn   = dictionary.GetValue <DateTime?>(RedmineKeys.CREATED_ON);
                file.Description = dictionary.GetValue <string>(RedmineKeys.DESCRIPTION);
                file.Digest      = dictionary.GetValue <string>(RedmineKeys.DIGEST);
                file.Downloads   = dictionary.GetValue <int>(RedmineKeys.DOWNLOADS);
                file.Filename    = dictionary.GetValue <string>(RedmineKeys.FILENAME);
                file.Filesize    = dictionary.GetValue <int>(RedmineKeys.FILESIZE);
                file.Id          = dictionary.GetValue <int>(RedmineKeys.ID);
                file.Token       = dictionary.GetValue <string>(RedmineKeys.TOKEN);
                var versionId = dictionary.GetValue <int?>(RedmineKeys.VERSION_ID);
                if (versionId.HasValue)
                {
                    file.Version = new IdentifiableName {
                        Id = versionId.Value
                    };
                }
                else
                {
                    file.Version = dictionary.GetValueAsIdentifiableName(RedmineKeys.VERSION);
                }
                return(file);
            }

            return(null);
        }
Exemplo n.º 56
0
 public static string GetString(this IDictionary <string, object> aValues, string aParam, string aDefault = "")
 {
     return(TryParse.String(aValues.GetValue(aParam), aDefault));
 }
Exemplo n.º 57
0
        public override object Deserialize(IDictionary<string, object> dictionary, Type type, JavaScriptSerializer serializer)
        {
            if (dictionary != null)
            {
                User user = new User();
                user.Login = dictionary.GetValue<string>(RedmineKeys.LOGIN);
                user.Id = dictionary.GetValue<int>(RedmineKeys.ID);
                user.FirstName = dictionary.GetValue<string>(RedmineKeys.FIRSTNAME);
                user.LastName = dictionary.GetValue<string>(RedmineKeys.LASTNAME);
                user.Email = dictionary.GetValue<string>(RedmineKeys.MAIL);
                user.AuthenticationModeId = dictionary.GetValue<int?>(RedmineKeys.AUTH_SOURCE_ID);
                user.CreatedOn = dictionary.GetValue<DateTime?>(RedmineKeys.CREATED_ON);
                user.LastLoginOn = dictionary.GetValue<DateTime?>(RedmineKeys.LAST_LOGIN_ON);
                user.ApiKey = dictionary.GetValue<string>(RedmineKeys.API_KEY);
                user.Status = dictionary.GetValue<UserStatus>(RedmineKeys.STATUS);
                user.MustChangePassword = dictionary.GetValue<bool>(RedmineKeys.MUST_CHANGE_PASSWD);
                user.CustomFields = dictionary.GetValueAsCollection<IssueCustomField>(RedmineKeys.CUSTOM_FIELDS);
                user.Memberships = dictionary.GetValueAsCollection<Membership>(RedmineKeys.MEMBERSHIPS);
                user.Groups = dictionary.GetValueAsCollection<UserGroup>(RedmineKeys.GROUPS);

                return user;
            }
            return null;
        }
 public static bool GetSuccess(this IDictionary dictionary)
 {
     return(dictionary.GetValue <bool>("success"));
 }
 public static ArrayList GetChangedVars(this IDictionary dictionary)
 {
     return(dictionary.GetValue <ArrayList>("changedVars"));
 }
 private static IList <int> ParseByYearDay(IDictionary <string, string> values)
 {
     return(ParseByYearDay(values.GetValue("BYYEARDAY", (string?)null)));
 }