Beispiel #1
0
 public void LoadCollection(IGxCollection x)
 {
     foreach (IGxGenericCollectionItem x1 in this)
     {
         x.Add(x1.Sdt);
     }
 }
Beispiel #2
0
 public void execute(out IGxCollection aP0_ProgramNames)
 {
     this.AV10ProgramNames = new GxObjectCollection(context, "ProgramNames.ProgramName", "CalcularPeajes", "SdtProgramNames_ProgramName", "GeneXus.Programs");
     initialize();
     executePrivate();
     aP0_ProgramNames = this.AV10ProgramNames;
 }
Beispiel #3
0
        public void executeSubmit(out IGxCollection aP0_ProgramNames)
        {
            listprograms objlistprograms;

            objlistprograms = new listprograms();
            objlistprograms.AV10ProgramNames = new GxObjectCollection(context, "ProgramNames.ProgramName", "CalcularPeajes", "SdtProgramNames_ProgramName", "GeneXus.Programs");
            objlistprograms.context.SetSubmitInitialConfig(context);
            objlistprograms.initialize();
            ThreadPool.QueueUserWorkItem(new WaitCallback(executePrivateCatch), objlistprograms);
            aP0_ProgramNames = this.AV10ProgramNames;
        }
Beispiel #4
0
        public GxGenericCollection(IGxCollection x)
        {
            IList xarr = (IList)x;

            foreach (GxUserType x1 in xarr)
            {
                IGxGenericCollectionItem x2 = (IGxGenericCollectionItem) new T();
                x2.Sdt = x1;
                Add((T)x2);
            }
        }
Beispiel #5
0
        internal static bool VerifySecureSignedSDTToken(string cmpCtx, IGxCollection value, string signedToken, IGxContext context)
        {
            WebSecureToken Token = SecureTokenHelper.getWebSecureToken(signedToken, GetSecretKey(context));

            if (Token == null)
            {
                return(false);
            }
            IGxCollection PayloadObject = (IGxCollection)value.Clone();

            PayloadObject.FromJSonString(Token.Value);
            return(GxUserType.IsEqual(value, PayloadObject));
        }
Beispiel #6
0
        public void Load(IGxCollection Key)
        {
            Type me = GetType();

            for (int i = 1; i <= Key.Count; i++)
            {
                object LoadKeyItem     = Key.Item(i);
                Type   LoadKeyItemType = LoadKeyItem.GetType();
                string Name            = LoadKeyItemType.InvokeMember("gxTpr_Name", BindingFlags.GetProperty, null, LoadKeyItem, Array.Empty <object>()) as string;
                string Value           = LoadKeyItemType.InvokeMember("gxTpr_Value", BindingFlags.GetProperty, null, LoadKeyItem, Array.Empty <object>()) as string;

                string FieldName  = "gxTpr_" + Name.Substring(0, 1).ToUpper() + Name.Substring(1).ToLower();
                Type   MemberType = me.GetProperty(FieldName).PropertyType;
                me.InvokeMember(FieldName, BindingFlags.SetProperty, null, this, new object[] { Convert.ChangeType(Value, MemberType, System.Globalization.CultureInfo.CurrentCulture) });
            }
            getTransaction().Load();
        }
        public int ExecDataInitialization(List <DynTrnInitializer> dataProviders)
        {
            try
            {
                string ns;
                if (Config.GetValueOf("AppMainNamespace", out ns))
                {
                    foreach (DynTrnInitializer dataProvider in dataProviders)
                    {
                        Console.WriteLine(GXResourceManager.GetMessage("GXM_runpgm", new object[] { dataProvider.Name }));

                        string   dataProviderClassName       = dataProvider.Name.ToLower();
                        string[] dataProviderClassNameTokens = dataProviderClassName.Split('.');
                        dataProviderClassNameTokens[dataProviderClassNameTokens.Length - 1] = "a" + dataProviderClassNameTokens[dataProviderClassNameTokens.Length - 1];
                        dataProviderClassName = string.Join(".", dataProviderClassNameTokens);
                        var      dp    = ClassLoader.FindInstance(dataProviderClassName, ns, dataProviderClassName, new Object[] { context }, null);
                        object[] parms = new object[1];                         //Dataproviders receive 1 sdt collection parameter
                        ClassLoader.ExecuteVoidRef(dp, "execute", parms);
                        IGxCollection bcs = (IGxCollection)parms[0];

                        int idx = 1;
                        while (idx <= bcs.Count)
                        {
                            var bc = ((GxSilentTrnSdt)bcs.Item(idx));
                            if (!bc.InsertOrUpdate() || !bc.Success())
                            {
                                Console.WriteLine(MessagesToString(bc.GetMessages()));
                            }
                            idx++;
                        }
                    }
                    if (dataProviders.Count > 0)
                    {
                        context.CommitDataStores("ExecDataInitialization");
                    }
                }
                this.cleanup();
                return(0);
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
                GXLogging.Error(log, ex);
                return(1);
            }
        }
Beispiel #8
0
        public void SetValue(string Name, string Value)
        {
            Type   me         = GetType();
            string FieldName  = "gxTpr_" + Name.Substring(0, 1).ToUpper() + Name.Substring(1).ToLower();
            Type   MemberType = me.GetProperty(FieldName).PropertyType;

            if (MemberType.IsAssignableFrom(typeof(Guid)))
            {
                me.InvokeMember(FieldName, BindingFlags.SetProperty, null, this, new object[] { new Guid(Value) });
            }
            else if (typeof(IGxCollection).IsAssignableFrom(MemberType))
            {
                Object        levelInstance = me.InvokeMember(FieldName, BindingFlags.GetProperty, null, this, Array.Empty <object>());
                IGxCollection Col           = levelInstance as IGxCollection;
                Col.FromJSonString(Value);
            }
            else
            {
                me.InvokeMember(FieldName, BindingFlags.SetProperty, null, this, new object[] { Convert.ChangeType(Value, MemberType, System.Globalization.CultureInfo.InvariantCulture) });
            }
        }
Beispiel #9
0
        public string GetValue(string Name)
        {
            if (string.IsNullOrEmpty(Name))
            {
                GXLogging.Warn(log, "GetValue of empty SDT property at " + this.GetType());
                return(string.Empty);
            }
            else
            {
                Type   me        = GetType();
                string FieldName = "gxTpr_" + Name.Substring(0, 1).ToUpper() + Name.Substring(1).ToLower();
                object objValue  = me.GetProperty(FieldName).GetValue(this, Array.Empty <object>());
                if (objValue is DateTime)
                {
                    DateTime dt = (DateTime)objValue;
                    if (dt.Year > 200)
                    {
                        objValue = new DateTime(dt.Year - 1900, dt.Month, dt.Day, dt.Hour, dt.Minute, dt.Second, dt.Millisecond);
                    }
                }
                else if (objValue is Guid)
                {
                    objValue = objValue.ToString();
                }
                else
                {
                    IGxCollection objColValue = objValue as IGxCollection;
                    if (objColValue != null)
                    {
                        return(objColValue.ToJSonString());
                    }
                }

                return(Convert.ChangeType(objValue, typeof(string), System.Globalization.CultureInfo.InvariantCulture) as string);
            }
        }
Beispiel #10
0
 public GxGenericCollection(IGxCollection x, bool wrapped) : this(x)
 {
     isWrapped = wrapped;
 }