internal static void SetTableInMapping(HttpContextBase httpContext, object control, MetaTable table, IDictionary<string, object> defaultValues) {
     MappingInfo mappingInfo = GetMappingInfo(control, httpContext);
     mappingInfo.Table = table;
     if (defaultValues != null) {
         mappingInfo.DefaultValueMapping = new DefaultValueMapping(defaultValues);
     }
 }
        internal static IEnumerable<Parameter> GetPrimaryKeyParameters(MetaTable table) {
            var result = new List<Parameter>();
            foreach (var primaryKeyColumn in table.PrimaryKeyColumns) {
                string name = primaryKeyColumn.Name;
                string value = Misc.GetRouteValue(name);

                var param = CreateParameter(name, value, primaryKeyColumn);
                result.Add(param);
            }
            return result;
        }
 internal static IEnumerable<Parameter> GetColumnParameters(MetaTable table, string columnName) {
     if (String.IsNullOrEmpty(columnName)) {
         // If no column is specified, we're setting the primary key from the query string
         return GetPrimaryKeyParameters(table);
     } else {
         var column = table.GetColumn(columnName);
         var fkColumn = column as MetaForeignKeyColumn;
         if (fkColumn != null) {
             // Handle the case where we're setting one of our foreign keys from the query string
             return GetForeignKeyParameters(fkColumn);
         } else {
             // Handle other columns (e.g. booleans)
             return GetRegularColumnParameters(column);
         }
     }
 }
        public void Construction()
        {
            {
                var mt = new MetaTable("publicdata:samples.github_timeline");
                mt.project_id.Is("publicdata");
                mt.dataset_id.Is("samples");
                mt.table_id.Is("github_timeline");
            }

            {
                var mt = new MetaTable("[publicdata:samples.github_timeline]");
                mt.project_id.Is("publicdata");
                mt.dataset_id.Is("samples");
                mt.table_id.Is("github_timeline");
            }
        }
Example #5
0
		public virtual IHttpHandler CreateHandler (DynamicDataRoute route, MetaTable table, string action)
		{
			// .NET bug emulation mode
			if (route == null || table == null || action == null)
				throw new NullReferenceException ();

			// NOTE: all code below is a result of guessing as no tests succeed for this
			// call so far!

			IHttpHandler ret = null;
			
			// Give custom pages a chance
			string viewName = String.IsNullOrEmpty (action) ? route.ViewName : action;
			string path = GetCustomPageVirtualPath (table, viewName);

			// Pages might be in app resources, need to use a VPP
			VirtualPathProvider vpp = HostingEnvironment.VirtualPathProvider;
			
			if (vpp != null && vpp.FileExists (path))
				ret = BuildManager.CreateInstanceFromVirtualPath (path, typeof (Page)) as IHttpHandler;

			if (ret != null)
				return ret;

			path = GetScaffoldPageVirtualPath (table, viewName);
			if (vpp != null && vpp.FileExists (path))
				ret = BuildManager.CreateInstanceFromVirtualPath (path, typeof (Page)) as IHttpHandler;
			
			return ret;
		}
Example #6
0
        protected override void ExtractForeignKeyData(ITransaction tx, MetaTable table)
        {
            var foreignKeyMap = new Dictionary <string, MetaForeignKey>();

            var fromTableColMap = new Dictionary <string, Dictionary <int, string> >();
            var toTableColMap   = new Dictionary <string, Dictionary <int, string> >();

            try
            {
                var       dbConnection = (DbConnection)tx.Connection;
                DataTable fkTable      = dbConnection.GetSchema("Foreign_Keys", new[] { null, null, table.Name, null });
                if (fkTable == null)
                {
                    Logger.GetLogger(Config.LoggerName).Fatal(
                        string.Format("Unable to read the list of foregin keys in table {0}", table.Name));
                    return;
                }
                foreach (DataRow fkRow in fkTable.Rows)
                {
                    string fkName = fkRow["FK_NAME"].ToString();
                    if (!foreignKeyMap.ContainsKey(fkName))
                    {
                        var foreignKey = new MetaForeignKey();
                        table.ForeignKeys.Add(foreignKey);
                        foreignKeyMap.Add(fkName, foreignKey);
                        foreignKey.Name       = fkName;
                        foreignKey.ToTable    = fkRow["FK_TABLE_NAME"].ToString();
                        foreignKey.UpdateRule = (ReferentialRuleType)fkRow["UPDATE_RULE"];
                        foreignKey.DeleteRule = (ReferentialRuleType)fkRow["DELETE_RULE"];

                        fromTableColMap.Add(fkName, new Dictionary <int, string>());
                        toTableColMap.Add(fkName, new Dictionary <int, string>());
                    }

                    fromTableColMap[fkName].Add(fromTableColMap[fkName].Count, fkRow["PK_COLUMN_NAME"].ToString());
                    toTableColMap[fkName].Add(toTableColMap[fkName].Count, fkRow["FK_COLUMN_NAME"].ToString());
                }

                foreach (string key in foreignKeyMap.Keys)
                {
                    MetaForeignKey foreignKey = foreignKeyMap[key];

                    var fromList = new List <int>(fromTableColMap[key].Keys);
                    fromList.Sort();

                    var toList = new List <int>(toTableColMap[key].Keys);
                    toList.Sort();

                    IEnumerator <int> toListEnumerator = toList.GetEnumerator();
                    toListEnumerator.Reset();

                    foreach (int ordinal in fromList)
                    {
                        string fromCol = fromTableColMap[key][ordinal];
                        string toCol   = null;
                        if (toListEnumerator.MoveNext())
                        {
                            toCol = toTableColMap[key][toListEnumerator.Current];
                        }
                        foreignKey.ColumnMappings.Add(new MetaForeignKeyColumnMapping(fromCol, toCol));
                    }
                }
            }
            catch (Exception e)
            {
                Logger.GetLogger(Config.LoggerName).Fatal(
                    string.Format("Exception occured while trying to read foreign key information in table {0}",
                                  table.Name), e);
                throw new DBPatchingException(e.Message, e);
            }
        }
Example #7
0
 protected void Page_Init(object sender, EventArgs e)
 {
     table = DynamicDataRouteHandler.GetRequestMetaTable(Context);
     FormView1.SetMetaTable(table);
     DetailsDataSource.EntityTypeFilter = table.EntityType.Name;
 }
 private static bool AreEntitiesEqual(MetaTable table, object entity1, object entity2)
 {
     return(Enumerable.SequenceEqual(table.GetPrimaryKeyValues(entity1), table.GetPrimaryKeyValues(entity2)));
 }
Example #9
0
 protected void Page_Load(object sender, EventArgs e)
 {
     table = DetailsDataSource.GetTable();
     Title = table.DisplayName;
 }
Example #10
0
        private void InitClass()
        {
            DataSetName        = "dsmeta";
            Prefix             = "";
            Namespace          = "http://tempuri.org/dsmeta.xsd";
            EnforceConstraints = false;

            #region create DataTables
            MetaTable T;
            //////////////////// SISEST_CORSOLAUREA /////////////////////////////////
            var tsisest_corsolaurea = new sisest_corsolaureaTable();
            tsisest_corsolaurea.addBaseColumns("idcorsolaurea", "descrizione", "codicecorso", "idsor1", "idsor2", "idsor3", "lt", "lu");
            Tables.Add(tsisest_corsolaurea);
            tsisest_corsolaurea.defineKey("idcorsolaurea");

            //////////////////// SORTING3 /////////////////////////////////
            T = new MetaTable("sorting3");
            T.defineColumn("ct", typeof(DateTime), false);
            T.defineColumn("cu", typeof(String), false);
            T.defineColumn("defaultN1", typeof(Decimal));
            T.defineColumn("defaultN2", typeof(Decimal));
            T.defineColumn("defaultN3", typeof(Decimal));
            T.defineColumn("defaultN4", typeof(Decimal));
            T.defineColumn("defaultN5", typeof(Decimal));
            T.defineColumn("defaultS1", typeof(String));
            T.defineColumn("defaultS2", typeof(String));
            T.defineColumn("defaultS3", typeof(String));
            T.defineColumn("defaultS4", typeof(String));
            T.defineColumn("defaultS5", typeof(String));
            T.defineColumn("defaultv1", typeof(Decimal));
            T.defineColumn("defaultv2", typeof(Decimal));
            T.defineColumn("defaultv3", typeof(Decimal));
            T.defineColumn("defaultv4", typeof(Decimal));
            T.defineColumn("defaultv5", typeof(Decimal));
            T.defineColumn("description", typeof(String), false);
            T.defineColumn("flagnodate", typeof(String));
            T.defineColumn("lt", typeof(DateTime), false);
            T.defineColumn("lu", typeof(String), false);
            T.defineColumn("movkind", typeof(String));
            T.defineColumn("printingorder", typeof(String));
            T.defineColumn("rtf", typeof(Byte[]));
            T.defineColumn("sortcode", typeof(String), false);
            T.defineColumn("txt", typeof(String));
            T.defineColumn("idsorkind", typeof(Int32), false);
            T.defineColumn("idsor", typeof(Int32), false);
            T.defineColumn("paridsor", typeof(Int32));
            T.defineColumn("nlevel", typeof(Byte), false);
            T.defineColumn("start", typeof(Int16));
            T.defineColumn("stop", typeof(Int16));
            T.defineColumn("email", typeof(String));
            Tables.Add(T);
            T.defineKey("idsor");

            //////////////////// SORTING1 /////////////////////////////////
            T = new MetaTable("sorting1");
            T.defineColumn("ct", typeof(DateTime), false);
            T.defineColumn("cu", typeof(String), false);
            T.defineColumn("defaultN1", typeof(Decimal));
            T.defineColumn("defaultN2", typeof(Decimal));
            T.defineColumn("defaultN3", typeof(Decimal));
            T.defineColumn("defaultN4", typeof(Decimal));
            T.defineColumn("defaultN5", typeof(Decimal));
            T.defineColumn("defaultS1", typeof(String));
            T.defineColumn("defaultS2", typeof(String));
            T.defineColumn("defaultS3", typeof(String));
            T.defineColumn("defaultS4", typeof(String));
            T.defineColumn("defaultS5", typeof(String));
            T.defineColumn("defaultv1", typeof(Decimal));
            T.defineColumn("defaultv2", typeof(Decimal));
            T.defineColumn("defaultv3", typeof(Decimal));
            T.defineColumn("defaultv4", typeof(Decimal));
            T.defineColumn("defaultv5", typeof(Decimal));
            T.defineColumn("description", typeof(String), false);
            T.defineColumn("flagnodate", typeof(String));
            T.defineColumn("lt", typeof(DateTime), false);
            T.defineColumn("lu", typeof(String), false);
            T.defineColumn("movkind", typeof(String));
            T.defineColumn("printingorder", typeof(String));
            T.defineColumn("rtf", typeof(Byte[]));
            T.defineColumn("sortcode", typeof(String), false);
            T.defineColumn("txt", typeof(String));
            T.defineColumn("idsorkind", typeof(Int32), false);
            T.defineColumn("idsor", typeof(Int32), false);
            T.defineColumn("paridsor", typeof(Int32));
            T.defineColumn("nlevel", typeof(Byte), false);
            T.defineColumn("start", typeof(Int16));
            T.defineColumn("stop", typeof(Int16));
            T.defineColumn("email", typeof(String));
            Tables.Add(T);
            T.defineKey("idsor");

            //////////////////// SORTING2 /////////////////////////////////
            T = new MetaTable("sorting2");
            T.defineColumn("ct", typeof(DateTime), false);
            T.defineColumn("cu", typeof(String), false);
            T.defineColumn("defaultN1", typeof(Decimal));
            T.defineColumn("defaultN2", typeof(Decimal));
            T.defineColumn("defaultN3", typeof(Decimal));
            T.defineColumn("defaultN4", typeof(Decimal));
            T.defineColumn("defaultN5", typeof(Decimal));
            T.defineColumn("defaultS1", typeof(String));
            T.defineColumn("defaultS2", typeof(String));
            T.defineColumn("defaultS3", typeof(String));
            T.defineColumn("defaultS4", typeof(String));
            T.defineColumn("defaultS5", typeof(String));
            T.defineColumn("defaultv1", typeof(Decimal));
            T.defineColumn("defaultv2", typeof(Decimal));
            T.defineColumn("defaultv3", typeof(Decimal));
            T.defineColumn("defaultv4", typeof(Decimal));
            T.defineColumn("defaultv5", typeof(Decimal));
            T.defineColumn("description", typeof(String), false);
            T.defineColumn("flagnodate", typeof(String));
            T.defineColumn("lt", typeof(DateTime), false);
            T.defineColumn("lu", typeof(String), false);
            T.defineColumn("movkind", typeof(String));
            T.defineColumn("printingorder", typeof(String));
            T.defineColumn("rtf", typeof(Byte[]));
            T.defineColumn("sortcode", typeof(String), false);
            T.defineColumn("txt", typeof(String));
            T.defineColumn("idsorkind", typeof(Int32), false);
            T.defineColumn("idsor", typeof(Int32), false);
            T.defineColumn("paridsor", typeof(Int32));
            T.defineColumn("nlevel", typeof(Byte), false);
            T.defineColumn("start", typeof(Int16));
            T.defineColumn("stop", typeof(Int16));
            T.defineColumn("email", typeof(String));
            Tables.Add(T);
            T.defineKey("idsor");

            #endregion


            #region DataRelation creation
            DataColumn [] CPar;
            DataColumn [] CChild;
            CPar = new DataColumn[1] {
                sorting3.Columns["idsor"]
            };
            CChild = new DataColumn[1] {
                sisest_corsolaurea.Columns["idsor3"]
            };
            Relations.Add(new DataRelation("sorting3_sisest_corsolaurea", CPar, CChild, false));

            CPar = new DataColumn[1] {
                sorting1.Columns["idsor"]
            };
            CChild = new DataColumn[1] {
                sisest_corsolaurea.Columns["idsor1"]
            };
            Relations.Add(new DataRelation("sorting1_sisest_corsolaurea", CPar, CChild, false));

            CPar = new DataColumn[1] {
                sorting2.Columns["idsor"]
            };
            CChild = new DataColumn[1] {
                sisest_corsolaurea.Columns["idsor2"]
            };
            Relations.Add(new DataRelation("sorting2_sisest_corsolaurea", CPar, CChild, false));

            #endregion
        }
Example #11
0
        /// <summary>
        /// Build the SQL for a query without executing it
        /// </summary>
        /// <param name="query"></param>
        /// <returns></returns>

        public List <List <string> > BuildSqlStatementList(
            Query query)
        {
            MetaTable rootTable = null;

            SqlList = new List <List <string> >();
            ExecuteQuery(query, true, false);             // build SQL for search step without actual execution

            if (query.SingleStepExecution && DrivingTable != null && DrivingTable.MetaTable != null)
            {
                rootTable = DrivingTable.MetaTable;
            }

            else
            {
                rootTable = RootTables[0];                                 // just a single root for now
            }
            bool result = PrepareForRetrieval(rootTable, out KeysForRoot); // get sql for other tables to be retrieved from

            Dictionary <string, MultiTablePivotBrokerTypeData> mbsi = MetaBrokerStateInfo;

            for (int ti = 0; ti < Qtd.Length; ti++)
            {
                GenericMetaBroker mb = Qtd[ti].Broker as GenericMetaBroker;
                QueryTable        qt = mb.Qt;
                MetaTable         mt = qt.MetaTable;

                // Create broker label to appear in SqlList

                if (mb.PivotInCode)
                {
                    if (!mb.IsKeyMultipivotBrokerInGroup)
                    {
                        continue;
                    }

                    string tableList = "";
                    for (int ti2 = 0; ti2 < Qtd.Length; ti2++)                     // get list of tables
                    {
                        GenericMetaBroker mb2 = Qtd[ti2].Broker as GenericMetaBroker;
                        if (!mb2.PivotInCode || mb2.MpGroupKey != mb.MpGroupKey)
                        {
                            continue;
                        }
                        if (tableList != "")
                        {
                            tableList += ", ";
                        }
                        tableList += mb2.Qt.MetaTable.Name;
                    }

                    mb.Label = "Retrieval SQL (Mobius-pivot-in-code) for metatable";
                    if (tableList.Contains(","))
                    {
                        mb.Label += "s";
                    }
                    mb.Label += ": " + tableList;
                }

                else
                {
                    if (mt.MetaBrokerType == MetaBrokerType.Generic)
                    {
                        mb.Label = "Retrieval SQL for metatable: " + mt.Name;
                    }

                    else
                    {
                        mb.Label = "Retrieval SQL for metatable: " + mt.Name;
                    }
                }

                // Create SQL for broker and store in SqlList via call to AddSqlToSqlStatementList

                mb.ExecuteQuery(Qtd[ti].Eqp);
            }

            return(SqlList);
        }
Example #12
0
        private void initClass()
        {
            DataSetName = "dsmeta";
            Prefix      = "";
            Namespace   = "http://tempuri.org/dsmeta.xsd";

            #region create DataTables
            //////////////////// INVENTORYTREE /////////////////////////////////
            var tinventorytree = new inventorytreeTable();
            tinventorytree.addBaseColumns("idinv", "codeinv", "paridinv", "nlevel", "description", "txt", "rtf", "cu", "ct", "lu", "lt", "idaccmotiveunload", "idaccmotiveload", "lookupcode", "idaccmotivediscount", "idaccmotivetransfer");
            Tables.Add(tinventorytree);
            tinventorytree.defineKey("idinv");

            //////////////////// INVENTORYTREESORTING /////////////////////////////////
            var tinventorytreesorting = new MetaTable("inventorytreesorting");
            tinventorytreesorting.defineColumn("idsor", typeof(int), false);
            tinventorytreesorting.defineColumn("idinv", typeof(int), false);
            tinventorytreesorting.defineColumn("cu", typeof(string), false);
            tinventorytreesorting.defineColumn("ct", typeof(DateTime), false);
            tinventorytreesorting.defineColumn("lu", typeof(string), false);
            tinventorytreesorting.defineColumn("lt", typeof(DateTime), false);
            tinventorytreesorting.defineColumn("!codiceclass", typeof(string));
            tinventorytreesorting.defineColumn("!description", typeof(string));
            tinventorytreesorting.defineColumn("!sortingkind", typeof(string));
            Tables.Add(tinventorytreesorting);
            tinventorytreesorting.defineKey("idinv", "idsor");

            //////////////////// INVENTORYSORTINGLEVEL /////////////////////////////////
            var tinventorysortinglevel = new MetaTable("inventorysortinglevel");
            tinventorysortinglevel.defineColumn("nlevel", typeof(byte), false);
            tinventorysortinglevel.defineColumn("description", typeof(string), false);
            tinventorysortinglevel.defineColumn("codelen", typeof(byte), false);
            tinventorysortinglevel.defineColumn("flag", typeof(byte), false);
            tinventorysortinglevel.defineColumn("cu", typeof(string), false);
            tinventorysortinglevel.defineColumn("ct", typeof(DateTime), false);
            tinventorysortinglevel.defineColumn("lu", typeof(string), false);
            tinventorysortinglevel.defineColumn("lt", typeof(DateTime), false);
            Tables.Add(tinventorysortinglevel);
            tinventorysortinglevel.defineKey("nlevel");

            //////////////////// INVENTORYTREEVIEW /////////////////////////////////
            var tinventorytreeview = new MetaTable("inventorytreeview");
            tinventorytreeview.defineColumn("idinv", typeof(int), false);
            tinventorytreeview.defineColumn("codeinv", typeof(string), false);
            tinventorytreeview.defineColumn("nlevel", typeof(byte), false);
            tinventorytreeview.defineColumn("leveldescr", typeof(string), false);
            tinventorytreeview.defineColumn("paridinv", typeof(int));
            tinventorytreeview.defineColumn("description", typeof(string), false);
            tinventorytreeview.defineColumn("idinv_lev1", typeof(int), false);
            tinventorytreeview.defineColumn("codeinv_lev1", typeof(string), false);
            tinventorytreeview.defineColumn("lookupcode", typeof(string));
            tinventorytreeview.defineColumn("idaccmotiveunload", typeof(string));
            tinventorytreeview.defineColumn("codemotiveunload", typeof(string));
            tinventorytreeview.defineColumn("motiveunload", typeof(string));
            tinventorytreeview.defineColumn("idaccmotiveload", typeof(string));
            tinventorytreeview.defineColumn("codemotiveload", typeof(string));
            tinventorytreeview.defineColumn("motiveload", typeof(string));
            tinventorytreeview.defineColumn("cu", typeof(string), false);
            tinventorytreeview.defineColumn("ct", typeof(DateTime), false);
            tinventorytreeview.defineColumn("lu", typeof(string), false);
            tinventorytreeview.defineColumn("lt", typeof(DateTime), false);
            Tables.Add(tinventorytreeview);

            //////////////////// INVENTORYAMORTIZATION /////////////////////////////////
            var tinventoryamortization = new MetaTable("inventoryamortization");
            tinventoryamortization.defineColumn("idinventoryamortization", typeof(int), false);
            tinventoryamortization.defineColumn("codeinventoryamortization", typeof(string), false);
            tinventoryamortization.defineColumn("description", typeof(string), false);
            tinventoryamortization.defineColumn("flag", typeof(byte), false);
            tinventoryamortization.defineColumn("cu", typeof(string), false);
            tinventoryamortization.defineColumn("ct", typeof(DateTime), false);
            tinventoryamortization.defineColumn("lu", typeof(string), false);
            tinventoryamortization.defineColumn("lt", typeof(DateTime), false);
            tinventoryamortization.defineColumn("active", typeof(string));
            Tables.Add(tinventoryamortization);
            tinventoryamortization.defineKey("idinventoryamortization");

            //////////////////// INVENTORYSORTINGAMORTIZATIONYEAR /////////////////////////////////
            var tinventorysortingamortizationyear = new MetaTable("inventorysortingamortizationyear");
            tinventorysortingamortizationyear.defineColumn("idinv", typeof(int), false);
            tinventorysortingamortizationyear.defineColumn("idinventoryamortization", typeof(int), false);
            tinventorysortingamortizationyear.defineColumn("ayear", typeof(int), false);
            tinventorysortingamortizationyear.defineColumn("!description", typeof(string));
            tinventorysortingamortizationyear.defineColumn("amortizationquota", typeof(double));
            tinventorysortingamortizationyear.defineColumn("cu", typeof(string), false);
            tinventorysortingamortizationyear.defineColumn("ct", typeof(DateTime), false);
            tinventorysortingamortizationyear.defineColumn("lu", typeof(string), false);
            tinventorysortingamortizationyear.defineColumn("lt", typeof(DateTime), false);
            tinventorysortingamortizationyear.defineColumn("idaccmotive", typeof(string));
            tinventorysortingamortizationyear.defineColumn("idaccmotiveunload", typeof(string));
            tinventorysortingamortizationyear.defineColumn("!active", typeof(string));
            tinventorysortingamortizationyear.defineColumn("!codemotive", typeof(string));
            tinventorysortingamortizationyear.defineColumn("!codemotive_unload", typeof(string));
            tinventorysortingamortizationyear.defineColumn("!accmotive", typeof(string));
            tinventorysortingamortizationyear.defineColumn("!accmotive_unload", typeof(string));
            Tables.Add(tinventorysortingamortizationyear);
            tinventorysortingamortizationyear.defineKey("idinv", "idinventoryamortization", "ayear");

            //////////////////// ACCMOTIVEAPPLIED_LOAD /////////////////////////////////
            var taccmotiveapplied_load = new MetaTable("accmotiveapplied_load");
            taccmotiveapplied_load.defineColumn("idaccmotive", typeof(string), false);
            taccmotiveapplied_load.defineColumn("paridaccmotive", typeof(string));
            taccmotiveapplied_load.defineColumn("codemotive", typeof(string), false);
            taccmotiveapplied_load.defineColumn("motive", typeof(string), false);
            taccmotiveapplied_load.defineColumn("cu", typeof(string), false);
            taccmotiveapplied_load.defineColumn("ct", typeof(DateTime), false);
            taccmotiveapplied_load.defineColumn("lu", typeof(string), false);
            taccmotiveapplied_load.defineColumn("lt", typeof(DateTime), false);
            taccmotiveapplied_load.defineColumn("active", typeof(string));
            taccmotiveapplied_load.defineColumn("idepoperation", typeof(string));
            taccmotiveapplied_load.defineColumn("epoperation", typeof(string));
            taccmotiveapplied_load.defineColumn("in_use", typeof(string));
            Tables.Add(taccmotiveapplied_load);
            taccmotiveapplied_load.defineKey("idaccmotive");

            //////////////////// ACCMOTIVEAPPLIED_UNLOAD /////////////////////////////////
            var taccmotiveapplied_unload = new MetaTable("accmotiveapplied_unload");
            taccmotiveapplied_unload.defineColumn("idaccmotive", typeof(string), false);
            taccmotiveapplied_unload.defineColumn("paridaccmotive", typeof(string));
            taccmotiveapplied_unload.defineColumn("codemotive", typeof(string), false);
            taccmotiveapplied_unload.defineColumn("motive", typeof(string), false);
            taccmotiveapplied_unload.defineColumn("cu", typeof(string), false);
            taccmotiveapplied_unload.defineColumn("ct", typeof(DateTime), false);
            taccmotiveapplied_unload.defineColumn("lu", typeof(string), false);
            taccmotiveapplied_unload.defineColumn("lt", typeof(DateTime), false);
            taccmotiveapplied_unload.defineColumn("active", typeof(string));
            taccmotiveapplied_unload.defineColumn("idepoperation", typeof(string));
            taccmotiveapplied_unload.defineColumn("epoperation", typeof(string));
            taccmotiveapplied_unload.defineColumn("in_use", typeof(string));
            Tables.Add(taccmotiveapplied_unload);
            taccmotiveapplied_unload.defineKey("idaccmotive");

            //////////////////// INVENTORYTREEMULTIFIELDKIND /////////////////////////////////
            var tinventorytreemultifieldkind = new MetaTable("inventorytreemultifieldkind");
            tinventorytreemultifieldkind.defineColumn("idinv", typeof(int), false);
            tinventorytreemultifieldkind.defineColumn("idmultifieldkind", typeof(int), false);
            tinventorytreemultifieldkind.defineColumn("lt", typeof(DateTime));
            tinventorytreemultifieldkind.defineColumn("lu", typeof(string));
            Tables.Add(tinventorytreemultifieldkind);
            tinventorytreemultifieldkind.defineKey("idinv", "idmultifieldkind");

            //////////////////// MULTIFIELDKIND /////////////////////////////////
            var tmultifieldkind = new MetaTable("multifieldkind");
            tmultifieldkind.defineColumn("idmultifieldkind", typeof(int), false);
            tmultifieldkind.defineColumn("fieldname", typeof(string), false);
            tmultifieldkind.defineColumn("systype", typeof(string), false);
            tmultifieldkind.defineColumn("allownull", typeof(string), false);
            tmultifieldkind.defineColumn("lu", typeof(string), false);
            tmultifieldkind.defineColumn("lt", typeof(DateTime), false);
            tmultifieldkind.defineColumn("tag", typeof(string));
            tmultifieldkind.defineColumn("len", typeof(int));
            tmultifieldkind.defineColumn("fieldcode", typeof(string), false);
            Tables.Add(tmultifieldkind);
            tmultifieldkind.defineKey("idmultifieldkind");

            //////////////////// SORTINGVIEW /////////////////////////////////
            var tsortingview = new MetaTable("sortingview");
            tsortingview.defineColumn("codesorkind", typeof(string), false);
            tsortingview.defineColumn("idsorkind", typeof(int), false);
            tsortingview.defineColumn("sortingkind", typeof(string), false);
            tsortingview.defineColumn("idsor", typeof(int), false);
            tsortingview.defineColumn("sortcode", typeof(string), false);
            tsortingview.defineColumn("nlevel", typeof(byte), false);
            tsortingview.defineColumn("leveldescr", typeof(string), false);
            tsortingview.defineColumn("paridsor", typeof(int));
            tsortingview.defineColumn("description", typeof(string), false);
            tsortingview.defineColumn("ayear", typeof(short), false);
            tsortingview.defineColumn("incomeprevision", typeof(decimal));
            tsortingview.defineColumn("expenseprevision", typeof(decimal));
            tsortingview.defineColumn("start", typeof(short));
            tsortingview.defineColumn("stop", typeof(short));
            tsortingview.defineColumn("cu", typeof(string), false);
            tsortingview.defineColumn("ct", typeof(DateTime), false);
            tsortingview.defineColumn("lu", typeof(string), false);
            tsortingview.defineColumn("lt", typeof(DateTime), false);
            tsortingview.defineColumn("defaultn1", typeof(decimal));
            tsortingview.defineColumn("defaultn2", typeof(decimal));
            tsortingview.defineColumn("defaultn3", typeof(decimal));
            tsortingview.defineColumn("defaultn4", typeof(decimal));
            tsortingview.defineColumn("defaultn5", typeof(decimal));
            tsortingview.defineColumn("defaults1", typeof(string));
            tsortingview.defineColumn("defaults2", typeof(string));
            tsortingview.defineColumn("defaults3", typeof(string));
            tsortingview.defineColumn("defaults4", typeof(string));
            tsortingview.defineColumn("defaults5", typeof(string));
            tsortingview.defineColumn("flagnodate", typeof(string));
            tsortingview.defineColumn("movkind", typeof(string));
            Tables.Add(tsortingview);

            //////////////////// ACCMOTIVE_AMORTIZATION /////////////////////////////////
            var taccmotive_amortization = new MetaTable("accmotive_amortization");
            taccmotive_amortization.defineColumn("idaccmotive", typeof(string), false);
            taccmotive_amortization.defineColumn("codemotive", typeof(string), false);
            taccmotive_amortization.defineColumn("title", typeof(string), false);
            Tables.Add(taccmotive_amortization);
            taccmotive_amortization.defineKey("idaccmotive");

            //////////////////// ACCMOTIVE_AMORTIZATION_UNLOAD /////////////////////////////////
            var taccmotive_amortization_unload = new MetaTable("accmotive_amortization_unload");
            taccmotive_amortization_unload.defineColumn("idaccmotive", typeof(string), false);
            taccmotive_amortization_unload.defineColumn("codemotive", typeof(string), false);
            taccmotive_amortization_unload.defineColumn("title", typeof(string), false);
            Tables.Add(taccmotive_amortization_unload);
            taccmotive_amortization_unload.defineKey("idaccmotive");

            //////////////////// ACCMOTIVEAPPLIED_DISCOUNT /////////////////////////////////
            var taccmotiveapplied_discount = new MetaTable("accmotiveapplied_discount");
            taccmotiveapplied_discount.defineColumn("idaccmotive", typeof(string), false);
            taccmotiveapplied_discount.defineColumn("paridaccmotive", typeof(string));
            taccmotiveapplied_discount.defineColumn("codemotive", typeof(string), false);
            taccmotiveapplied_discount.defineColumn("motive", typeof(string), false);
            taccmotiveapplied_discount.defineColumn("cu", typeof(string), false);
            taccmotiveapplied_discount.defineColumn("ct", typeof(DateTime), false);
            taccmotiveapplied_discount.defineColumn("lu", typeof(string), false);
            taccmotiveapplied_discount.defineColumn("lt", typeof(DateTime), false);
            taccmotiveapplied_discount.defineColumn("active", typeof(string));
            taccmotiveapplied_discount.defineColumn("idepoperation", typeof(string));
            taccmotiveapplied_discount.defineColumn("epoperation", typeof(string));
            taccmotiveapplied_discount.defineColumn("in_use", typeof(string));
            Tables.Add(taccmotiveapplied_discount);
            taccmotiveapplied_discount.defineKey("idaccmotive");

            //////////////////// ACCMOTIVEAPPLIED_TRANSFER /////////////////////////////////
            var taccmotiveapplied_transfer = new MetaTable("accmotiveapplied_transfer");
            taccmotiveapplied_transfer.defineColumn("idaccmotive", typeof(string), false);
            taccmotiveapplied_transfer.defineColumn("paridaccmotive", typeof(string));
            taccmotiveapplied_transfer.defineColumn("codemotive", typeof(string), false);
            taccmotiveapplied_transfer.defineColumn("motive", typeof(string), false);
            taccmotiveapplied_transfer.defineColumn("cu", typeof(string), false);
            taccmotiveapplied_transfer.defineColumn("ct", typeof(DateTime), false);
            taccmotiveapplied_transfer.defineColumn("lu", typeof(string), false);
            taccmotiveapplied_transfer.defineColumn("lt", typeof(DateTime), false);
            taccmotiveapplied_transfer.defineColumn("active", typeof(string));
            taccmotiveapplied_transfer.defineColumn("idepoperation", typeof(string));
            taccmotiveapplied_transfer.defineColumn("epoperation", typeof(string));
            taccmotiveapplied_transfer.defineColumn("in_use", typeof(string));
            Tables.Add(taccmotiveapplied_transfer);
            taccmotiveapplied_transfer.defineKey("idaccmotive");

            #endregion


            #region DataRelation creation
            this.defineRelation("multifieldkind_inventorytreemultifieldkind", "multifieldkind", "inventorytreemultifieldkind", "idmultifieldkind");
            this.defineRelation("inventorytree_inventorytreemultifieldkind", "inventorytree", "inventorytreemultifieldkind", "idinv");
            this.defineRelation("inventoryamortizationinventorysortingamortizationyear", "inventoryamortization", "inventorysortingamortizationyear", "idinventoryamortization");
            this.defineRelation("inventorytreeinventorysortingamortizationyear", "inventorytree", "inventorysortingamortizationyear", "idinv");
            this.defineRelation("accmotive_amortization_inventorysortingamortizationyear", "accmotive_amortization", "inventorysortingamortizationyear", "idaccmotive");
            var cPar   = new [] { accmotive_amortization_unload.Columns["idaccmotive"] };
            var cChild = new [] { inventorysortingamortizationyear.Columns["idaccmotiveunload"] };
            Relations.Add(new DataRelation("accmotive_amortization_unload_inventorysortingamortizationyear", cPar, cChild, false));

            this.defineRelation("FK_sortingview_inventorytreesorting", "sortingview", "inventorytreesorting", "idsor");
            this.defineRelation("inventorytreeinventorytreesorting", "inventorytree", "inventorytreesorting", "idinv");
            this.defineRelation("inventorysortinglevelinventorytree", "inventorysortinglevel", "inventorytree", "nlevel");
            cPar   = new [] { accmotiveapplied_load.Columns["idaccmotive"] };
            cChild = new [] { inventorytree.Columns["idaccmotiveload"] };
            Relations.Add(new DataRelation("accmotiveapplied_loadinventorytree", cPar, cChild, false));

            cPar   = new [] { accmotiveapplied_unload.Columns["idaccmotive"] };
            cChild = new [] { inventorytree.Columns["idaccmotiveunload"] };
            Relations.Add(new DataRelation("accmotiveapplied_unloadinventorytree", cPar, cChild, false));

            cPar   = new [] { inventorytree.Columns["idinv"] };
            cChild = new [] { inventorytree.Columns["paridinv"] };
            Relations.Add(new DataRelation("inventorytreeinventorytree", cPar, cChild, false));

            cPar   = new [] { accmotiveapplied_discount.Columns["idaccmotive"] };
            cChild = new [] { inventorytree.Columns["idaccmotivediscount"] };
            Relations.Add(new DataRelation("accmotiveapplied_discount_inventorytree", cPar, cChild, false));

            cPar   = new [] { accmotiveapplied_transfer.Columns["idaccmotive"] };
            cChild = new [] { inventorytree.Columns["idaccmotivetransfer"] };
            Relations.Add(new DataRelation("accmotiveapplied_transfer_inventorytree", cPar, cChild, false));

            #endregion
        }
Example #13
0
        private async Task UploadMediaChanges(Dictionary <long, StorageFolder> deckMediaFolders, string remoteMediaFolderPath, MetaTable remoteMeta)
        {
            if (!mainPage.Collection.Media.IsDatabaseModified())
            {
                return;
            }

            var mediasModified = mainPage.Collection.Media.Database.QueryColumn <MediaTable>
                                     ("Select * from media where mtime > ?", remoteMeta.LastUnixTimeSync);
            long total = mediasModified.Count;

            await UpdateMediaFilesInRemoteSever(deckMediaFolders, remoteMediaFolderPath, mediasModified, total, 0);

            await DeleteUnusedFolderInServer(deckMediaFolders, remoteMediaFolderPath);
            await UpdateSeverMediaDatabase();
        }
Example #14
0
        private async Task DownLoadAndUploadMediaChanges(DB remoteMediaDB, Dictionary <long, StorageFolder> deckMediaFolders, string remoteMediaFolderPath, MetaTable remoteMeta, long localLastMediaSync)
        {
            var remoteMediasModified = remoteMediaDB.QueryColumn <MediaTable>
                                           ("Select * from media where mtime > ?", localLastMediaSync);

            var localMediasModified = mainPage.Collection.Media.Database.QueryColumn <MediaTable>
                                          ("Select * from media where mtime > ?", localLastMediaSync);

            ResolveConflictIfHas(remoteMediasModified, localMediasModified);

            long total = remoteMediasModified.Count + localMediasModified.Count;
            var  outOfSyncRemoteFiles = await UpdateMediaFilesInLocal(deckMediaFolders, remoteMediaFolderPath, remoteMediasModified, 0, total);

            await DeleteUnusedMediaDeckFolder(deckMediaFolders);

            var outOfSyncLocalFiles = await UpdateMediaFilesInRemoteSever(deckMediaFolders, remoteMediaFolderPath,
                                                                          localMediasModified, total, remoteMediasModified.Count);

            UpdateDownloadedRemoteMediaDB(remoteMediaDB, localMediasModified, outOfSyncLocalFiles, outOfSyncRemoteFiles);

            await UpdateLocalMediaDatabase();

            if (localMediasModified.Count > 0 || outOfSyncRemoteFiles.Count > 0)
            {
                await UpdateSeverMediaDatabase();
            }
        }
Example #15
0
        /// <summary>
        /// Finds a collection of files for the given directory
        /// </summary>
        /// <param name="directoryPath"></param>
        /// <returns></returns>
        public static IList <FileInformation> FindFiles(string directoryPath)
        {
            List <FileInformation> result            = new List <FileInformation>();
            List <string>          dupTags           = new List <string>();
            HashSet <string>       tags              = Helper.GetTagsFromPath(directoryPath);
            List <DriveInfo>       deprecateNextList = new List <DriveInfo>();

            foreach (KeyValuePair <string, DatabaseOperations> entry in volMan.MountedBagVolumes)
            {
                try {
                    if (directoryPath == "\\")
                    {
                        // Display all tags marked rootVisible from the DB
                        foreach (MetaTable tag in entry.Value.GetRootTables())
                        {
                            if (!dupTags.Contains(tag.tableName))
                            {
                                dupTags.Add(tag.tableName);
                                FileInformation finfo = new FileInformation();
                                finfo.FileName       = Helper.StringToProper(tag.friendlyName);
                                finfo.Attributes     = System.IO.FileAttributes.Directory;
                                finfo.LastAccessTime = DateTime.Now;
                                finfo.LastWriteTime  = DateTime.Now;
                                finfo.CreationTime   = DateTime.Now;
                                result.Add(finfo);
                            }
                        }
                    }
                    else
                    {
                        DatabaseOperations op    = entry.Value;
                        MetaTable          table = op.GetTableByFriendlyName(tags.First <string>());

                        if (tags.Count == 1)
                        {
                            // TODO: this is just a test
                            foreach (ItemMeta item in op.GetItems(table.tableName))
                            {
                                FileInformation finfo = new FileInformation();
                                finfo.FileName       = item.name + "." + item.ext;
                                finfo.Attributes     = (FileAttributes)Enum.Parse(typeof(FileAttributes), item.attr);
                                finfo.LastAccessTime = Convert.ToDateTime(item.lat);
                                finfo.LastWriteTime  = Convert.ToDateTime(item.lwt);
                                finfo.CreationTime   = Convert.ToDateTime(item.ct);
                                result.Add(finfo);
                            }

                            List <MetaTable> tables = op.GetExtendingTables(table.tableName);
                            tables.Add(table);

                            // Create a set of folders to further sort the items
                            foreach (MetaTable extTable in tables)
                            {
                                foreach (MetaAlias alias in op.GetAliases(extTable.tableName))
                                {
                                    // Add a folder for this alias
                                    FileInformation finfo = new FileInformation();
                                    finfo.FileName       = "By " + alias.alias;
                                    finfo.Attributes     = System.IO.FileAttributes.Directory;
                                    finfo.LastAccessTime = DateTime.Now;
                                    finfo.LastWriteTime  = DateTime.Now;
                                    finfo.CreationTime   = DateTime.Now;
                                    result.Add(finfo);
                                }
                            }
                        }



                        /*
                         * // Create a set of 'inner tags' by removing the tags already in the path
                         * List<string> innerTags = entry.Value.GetInnerTags(tags.ToList()).Except(tags).ToList();
                         * // Add the set of innerTags
                         * foreach (string tag in innerTags) {
                         *      FileInformation finfo = new FileInformation();
                         *      finfo.FileName = Helper.StringToProper(tag);
                         *      finfo.Attributes = System.IO.FileAttributes.Directory;
                         *      finfo.LastAccessTime = DateTime.Now;
                         *      finfo.LastWriteTime = DateTime.Now;
                         *      finfo.CreationTime = DateTime.Now;
                         *      result.Add(finfo);
                         * }
                         * items.AddRange(entry.Value.GetItemsByCompositeTag(tags.ToList<string>()));*/
                    }
                } catch (SQLiteException ex) {
                    // Display any exceptions, but continue working. We will remove this drive later.
                    MjDebug.Log(ex.StackTrace + "\n" + ex.Message, LogSeverity.MEDIUM);
                    deprecateNextList.Add(new DriveInfo(entry.Key));
                }
            }

            // Unmount any entry that caused an exception
            foreach (DriveInfo dinfo in deprecateNextList)
            {
                volMan.UnmountBagVolume(dinfo.ToString());
            }

            return(result);
        }
Example #16
0
        private void initClass()
        {
            DataSetName = "dsmeta";
            Prefix      = "";
            Namespace   = "http://tempuri.org/dsmeta.xsd";

            #region create DataTables
            //////////////////// ASSETLOAD /////////////////////////////////
            var tassetload = new assetloadTable();
            tassetload.addBaseColumns("idassetload", "idassetloadkind", "yassetload", "nassetload", "idreg", "idmot", "doc", "docdate", "description", "enactment", "enactmentdate", "adate", "printdate", "ratificationdate", "txt", "rtf", "cu", "ct", "lu", "lt", "transmitted");
            Tables.Add(tassetload);
            tassetload.defineKey("idassetload");

            //////////////////// ASSETLOADKIND /////////////////////////////////
            var tassetloadkind = new assetloadkindTable();
            tassetloadkind.addBaseColumns("idassetloadkind", "description", "idinventory", "startnumber", "cu", "ct", "lu", "lt", "flag", "active", "idsor01", "idsor02", "idsor03", "idsor04", "idsor05");
            Tables.Add(tassetloadkind);
            tassetloadkind.defineKey("idassetloadkind");

            //////////////////// REGISTRY /////////////////////////////////
            var tregistry = new registryTable();
            tregistry.addBaseColumns("idreg", "title", "cf", "p_iva", "residence", "annotation", "birthdate", "gender", "surname", "forename", "foreigncf", "active", "cu", "ct", "lu", "lt", "badgecode", "idcategory", "idcentralizedcategory", "idmaritalstatus", "idtitle", "idregistryclass", "maritalsurname", "idcity", "idnation", "location", "extmatricula");
            Tables.Add(tregistry);
            tregistry.defineKey("idreg");

            //////////////////// ASSETLOADMOTIVE /////////////////////////////////
            var tassetloadmotive = new MetaTable("assetloadmotive");
            tassetloadmotive.defineColumn("idmot", typeof(int), false);
            tassetloadmotive.defineColumn("description", typeof(string), false);
            tassetloadmotive.defineColumn("cu", typeof(string), false);
            tassetloadmotive.defineColumn("ct", typeof(DateTime), false);
            tassetloadmotive.defineColumn("lu", typeof(string), false);
            tassetloadmotive.defineColumn("lt", typeof(DateTime), false);
            tassetloadmotive.defineColumn("idaccmotive", typeof(string));
            tassetloadmotive.defineColumn("active", typeof(string));
            Tables.Add(tassetloadmotive);
            tassetloadmotive.defineKey("idmot");

            //////////////////// EXPENSEPHASE /////////////////////////////////
            var texpensephase = new MetaTable("expensephase");
            texpensephase.defineColumn("nphase", typeof(byte), false);
            texpensephase.defineColumn("description", typeof(string), false);
            texpensephase.defineColumn("cu", typeof(string), false);
            texpensephase.defineColumn("ct", typeof(DateTime), false);
            texpensephase.defineColumn("lu", typeof(string), false);
            texpensephase.defineColumn("lt", typeof(DateTime), false);
            Tables.Add(texpensephase);
            texpensephase.defineKey("nphase");

            //////////////////// ASSETACQUIREVIEW /////////////////////////////////
            var tassetacquireview = new MetaTable("assetacquireview");
            tassetacquireview.defineColumn("nassetacquire", typeof(int), false);
            tassetacquireview.defineColumn("yman", typeof(short));
            tassetacquireview.defineColumn("nman", typeof(int));
            tassetacquireview.defineColumn("rownum", typeof(int));
            tassetacquireview.defineColumn("idreg", typeof(int));
            tassetacquireview.defineColumn("registry", typeof(string));
            tassetacquireview.defineColumn("idmot", typeof(int), false);
            tassetacquireview.defineColumn("assetloadmotive", typeof(string));
            tassetacquireview.defineColumn("idinv", typeof(int), false);
            tassetacquireview.defineColumn("codeinv", typeof(string));
            tassetacquireview.defineColumn("inventorytree", typeof(string));
            tassetacquireview.defineColumn("description", typeof(string), false);
            tassetacquireview.defineColumn("idinventory", typeof(int), false);
            tassetacquireview.defineColumn("codeinventory", typeof(string));
            tassetacquireview.defineColumn("inventory", typeof(string));
            tassetacquireview.defineColumn("idassetloadkind", typeof(int));
            tassetacquireview.defineColumn("assetloadkind", typeof(string));
            tassetacquireview.defineColumn("yassetload", typeof(short));
            tassetacquireview.defineColumn("nassetload", typeof(int));
            tassetacquireview.defineColumn("number", typeof(int), false);
            tassetacquireview.defineColumn("taxable", typeof(decimal));
            tassetacquireview.defineColumn("taxrate", typeof(double));
            tassetacquireview.defineColumn("discount", typeof(double));
            tassetacquireview.defineColumn("total", typeof(decimal));
            tassetacquireview.defineColumn("abatable", typeof(decimal));
            tassetacquireview.defineColumn("startnumber", typeof(int));
            tassetacquireview.defineColumn("adate", typeof(DateTime), false);
            tassetacquireview.defineColumn("flag", typeof(byte), false);
            tassetacquireview.defineColumn("flagload", typeof(string), false);
            tassetacquireview.defineColumn("loadkind", typeof(string), false);
            tassetacquireview.defineColumn("ispieceacquire", typeof(string), false);
            tassetacquireview.defineColumn("cu", typeof(string), false);
            tassetacquireview.defineColumn("ct", typeof(DateTime), false);
            tassetacquireview.defineColumn("lu", typeof(string), false);
            tassetacquireview.defineColumn("lt", typeof(DateTime), false);
            tassetacquireview.defineColumn("transmitted", typeof(string));
            tassetacquireview.defineColumn("cost", typeof(decimal));
            tassetacquireview.defineColumn("idupb", typeof(string));
            tassetacquireview.defineColumn("idsor1", typeof(int));
            tassetacquireview.defineColumn("idsor2", typeof(int));
            tassetacquireview.defineColumn("idsor3", typeof(int));
            tassetacquireview.defineColumn("idassetload", typeof(int));
            tassetacquireview.defineColumn("!pieceorasset", typeof(string));
            tassetacquireview.defineColumn("idmankind", typeof(string));
            tassetacquireview.defineColumn("idsor01", typeof(int));
            tassetacquireview.defineColumn("idsor02", typeof(int));
            tassetacquireview.defineColumn("idsor03", typeof(int));
            tassetacquireview.defineColumn("idsor04", typeof(int));
            tassetacquireview.defineColumn("idsor05", typeof(int));
            tassetacquireview.defineColumn("intcode", typeof(string));
            tassetacquireview.defineColumn("list", typeof(string));
            tassetacquireview.defineColumn("yinv", typeof(int));
            tassetacquireview.defineColumn("ninv", typeof(int));
            tassetacquireview.defineColumn("idinvkind", typeof(int));
            tassetacquireview.defineColumn("invrownum", typeof(int));
            tassetacquireview.defineColumn("invoicekind", typeof(string));
            tassetacquireview.defineColumn("cost_discounted", typeof(decimal));
            tassetacquireview.defineColumn("historicalvalue", typeof(decimal));
            Tables.Add(tassetacquireview);
            tassetacquireview.defineKey("nassetacquire");

            //////////////////// ASSETLOADEXPENSE /////////////////////////////////
            var tassetloadexpense = new MetaTable("assetloadexpense");
            tassetloadexpense.defineColumn("idexp", typeof(int), false);
            tassetloadexpense.defineColumn("ct", typeof(DateTime));
            tassetloadexpense.defineColumn("cu", typeof(string));
            tassetloadexpense.defineColumn("lt", typeof(DateTime));
            tassetloadexpense.defineColumn("lu", typeof(string));
            tassetloadexpense.defineColumn("!ymov", typeof(short));
            tassetloadexpense.defineColumn("!nmov", typeof(int));
            tassetloadexpense.defineColumn("!expensedescription", typeof(string));
            tassetloadexpense.defineColumn("!npay", typeof(string));
            tassetloadexpense.defineColumn("!expensedoc", typeof(string));
            tassetloadexpense.defineColumn("!amount", typeof(string));
            tassetloadexpense.defineColumn("idassetload", typeof(int), false);
            Tables.Add(tassetloadexpense);
            tassetloadexpense.defineKey("idassetload", "idexp");

            //////////////////// CONFIG /////////////////////////////////
            var tconfig = new configTable();
            tconfig.addBaseColumns("ayear", "agencycode", "appname", "appropriationphasecode", "assessmentphasecode", "asset_flagnumbering", "asset_flagrestart", "assetload_flag", "boxpartitiontitle", "cashvaliditykind", "casualcontract_flagrestart", "ct", "cu", "currpartitiontitle", "deferredexpensephase", "deferredincomephase", "electronicimport", "electronictrasmission", "expense_expiringdays", "expensephase", "flagautopayment", "flagautoproceeds", "flagcredit", "flagepexp", "flagfruitful", "flagpayment", "flagproceeds", "flagrefund", "foreignhours", "idacc_accruedcost", "idacc_accruedrevenue", "idacc_customer", "idacc_deferredcost", "idacc_deferredcredit", "idacc_deferreddebit", "idacc_deferredrevenue", "idacc_ivapayment", "idacc_ivarefund", "idacc_patrimony", "idacc_pl", "idacc_supplier", "idaccmotive_admincar", "idaccmotive_foot", "idaccmotive_owncar", "idclawback", "idfinexpense", "idfinexpensesurplus", "idfinincomesurplus", "idfinivapayment", "idfinivarefund", "idivapayperiodicity", "idregauto", "idsortingkind1", "idsortingkind2", "idsortingkind3", "importappname", "income_expiringdays", "incomephase", "linktoinvoice", "lt", "lu", "minpayment", "minrefund", "motivelen", "motiveprefix", "motiveseparator", "payment_finlevel", "payment_flag", "payment_flagautoprintdate", "paymentagency", "prevpartitiontitle", "proceeds_finlevel", "proceeds_flag", "proceeds_flagautoprintdate", "profservice_flagrestart", "refundagency", "wageaddition_flagrestart");
            Tables.Add(tconfig);
            tconfig.defineKey("ayear");

            //////////////////// ASSETAMORTIZATIONUNLOADVIEW /////////////////////////////////
            var tassetamortizationunloadview = new MetaTable("assetamortizationunloadview");
            tassetamortizationunloadview.defineColumn("namortization", typeof(int), false);
            tassetamortizationunloadview.defineColumn("idasset", typeof(int), false);
            tassetamortizationunloadview.defineColumn("idpiece", typeof(int));
            tassetamortizationunloadview.defineColumn("idinventoryamortization", typeof(int), false);
            tassetamortizationunloadview.defineColumn("codeinventoryamortization", typeof(string), false);
            tassetamortizationunloadview.defineColumn("inventoryamortization", typeof(string), false);
            tassetamortizationunloadview.defineColumn("idinventory", typeof(int), false);
            tassetamortizationunloadview.defineColumn("inventory", typeof(string), false);
            tassetamortizationunloadview.defineColumn("ninventory", typeof(int));
            tassetamortizationunloadview.defineColumn("idlocation", typeof(int));
            tassetamortizationunloadview.defineColumn("locationcode", typeof(string));
            tassetamortizationunloadview.defineColumn("location", typeof(string));
            tassetamortizationunloadview.defineColumn("idcurrlocation", typeof(int));
            tassetamortizationunloadview.defineColumn("currlocationcode", typeof(string));
            tassetamortizationunloadview.defineColumn("currlocation", typeof(string));
            tassetamortizationunloadview.defineColumn("idman", typeof(int));
            tassetamortizationunloadview.defineColumn("manager", typeof(string));
            tassetamortizationunloadview.defineColumn("idcurrman", typeof(int));
            tassetamortizationunloadview.defineColumn("currmanager", typeof(string));
            tassetamortizationunloadview.defineColumn("nassetacquire", typeof(int), false);
            tassetamortizationunloadview.defineColumn("loaddescription", typeof(string), false);
            tassetamortizationunloadview.defineColumn("description", typeof(string), false);
            tassetamortizationunloadview.defineColumn("assetvalue", typeof(decimal));
            tassetamortizationunloadview.defineColumn("amortizationquota", typeof(double));
            tassetamortizationunloadview.defineColumn("amount", typeof(decimal), true, true);
            tassetamortizationunloadview.defineColumn("adate", typeof(DateTime), false);
            tassetamortizationunloadview.defineColumn("idassetunload", typeof(int));
            tassetamortizationunloadview.defineColumn("idassetunloadkind", typeof(int));
            tassetamortizationunloadview.defineColumn("assetunloadkind", typeof(string));
            tassetamortizationunloadview.defineColumn("yassetunload", typeof(short));
            tassetamortizationunloadview.defineColumn("nassetunload", typeof(int));
            tassetamortizationunloadview.defineColumn("idassetload", typeof(int));
            tassetamortizationunloadview.defineColumn("idassetloadkind", typeof(int));
            tassetamortizationunloadview.defineColumn("assetloadkind", typeof(string));
            tassetamortizationunloadview.defineColumn("yassetload", typeof(short));
            tassetamortizationunloadview.defineColumn("nassetload", typeof(int));
            tassetamortizationunloadview.defineColumn("flag", typeof(byte), false);
            tassetamortizationunloadview.defineColumn("flagunload", typeof(string), true, true);
            tassetamortizationunloadview.defineColumn("flagload", typeof(string), true, true);
            tassetamortizationunloadview.defineColumn("transmitted", typeof(string));
            tassetamortizationunloadview.defineColumn("cu", typeof(string), false);
            tassetamortizationunloadview.defineColumn("ct", typeof(DateTime), false);
            tassetamortizationunloadview.defineColumn("lu", typeof(string), false);
            tassetamortizationunloadview.defineColumn("lt", typeof(DateTime), false);
            Tables.Add(tassetamortizationunloadview);
            tassetamortizationunloadview.defineKey("namortization");

            //////////////////// HISTORYPAYMENTVIEW /////////////////////////////////
            var thistorypaymentview = new MetaTable("historypaymentview");
            thistorypaymentview.defineColumn("idexp", typeof(int), false);
            thistorypaymentview.defineColumn("ymov", typeof(short), false);
            thistorypaymentview.defineColumn("nmov", typeof(int), false);
            thistorypaymentview.defineColumn("adate", typeof(DateTime), false);
            thistorypaymentview.defineColumn("idreg", typeof(int));
            thistorypaymentview.defineColumn("idman", typeof(int));
            thistorypaymentview.defineColumn("doc", typeof(string));
            thistorypaymentview.defineColumn("docdate", typeof(DateTime));
            thistorypaymentview.defineColumn("description", typeof(string), false);
            thistorypaymentview.defineColumn("competencydate", typeof(DateTime));
            thistorypaymentview.defineColumn("amount", typeof(decimal));
            thistorypaymentview.defineColumn("curramount", typeof(decimal));
            thistorypaymentview.defineColumn("totflag", typeof(byte));
            thistorypaymentview.defineColumn("flagarrear", typeof(string));
            thistorypaymentview.defineColumn("kpay", typeof(int), false);
            thistorypaymentview.defineColumn("ypay", typeof(short), false);
            thistorypaymentview.defineColumn("npay", typeof(int), false);
            thistorypaymentview.defineColumn("idfin", typeof(int));
            thistorypaymentview.defineColumn("idupb", typeof(string));
            thistorypaymentview.defineColumn("idtreasurer", typeof(int));
            thistorypaymentview.defineColumn("codetreasurer", typeof(string), false);
            Tables.Add(thistorypaymentview);
            thistorypaymentview.defineKey("idexp");

            #endregion


            #region DataRelation creation
            this.defineRelation("assetload_assetamortizationunloadview", "assetload", "assetamortizationunloadview", "idassetload");
            this.defineRelation("assetloadassetloadexpense", "assetload", "assetloadexpense", "idassetload");
            this.defineRelation("historypaymentview_assetloadexpense", "historypaymentview", "assetloadexpense", "idexp");
            this.defineRelation("assetloadassetacquireview", "assetload", "assetacquireview", "idassetload");
            this.defineRelation("assetloadmotiveassetload", "assetloadmotive", "assetload", "idmot");
            this.defineRelation("assetloadkindassetload", "assetloadkind", "assetload", "idassetloadkind");
            this.defineRelation("registryassetload", "registry", "assetload", "idreg");
            #endregion
        }
Example #17
0
		static RouteContext MakeRouteContext (RequestContext context, DynamicDataRoute route, string action, MetaTable table)
		{
			RouteData rd = null;
			
			if (route == null) {
				rd = context.RouteData;
				route = rd.Route as DynamicDataRoute;
			}

			if (route != null) {
				if (action == null) {
					if (rd == null)
						rd = context.RouteData;
					action = route.GetActionFromRouteData (rd);
				}
			
				if (table == null) {
					if (rd == null)
						rd = context.RouteData;
				
					table = route.GetTableFromRouteData (rd);
				}
			}
			
			return new RouteContext () {
				Route = route,
				Action = action,
				Table = table,
				Context = context};
		}
Example #18
0
 protected void Page_Init(object sender, EventArgs e)
 {
     table = DynamicDataRouteHandler.GetRequestMetaTable(Context);
 }
Example #19
0
        /// <summary>
        /// Analyze key criteria in token list.
        /// A saved list reference is returned as a set of key values &
        /// blanked out in the token list.
        /// Other key references are returned as a set of indexes in a list.
        /// </summary>
        /// <param name="q"></param>
        /// <param name="Qtd"></param>
        /// <param name="tokens"></param>
        /// <param name="keyCriteriaPositions">Token indexes for key criteria column names</param>
        /// <param name="keyCriteriaSavedListKeys">Keys in any referenced saved list</param>
        /// <param name="keyCriteriaInListKeys">Keys in any literal list </param>
        /// <param name="keyCriteriaConstantPositions">Positions of key values for literal lists</param>

        public static void AnalyzeKeyCriteria(
            Query q,
            QueryTableData[] Qtd,
            List <MqlToken> tokens,
            out CompareOp keyCriteriaOp,
            out List <int> keyCriteriaPositions,
            out List <string> keyCriteriaSavedListKeys,
            out List <string> keyCriteriaInListKeys,
            out List <int> keyCriteriaConstantPositions)
        {
            string tok1, tok2, tok3, tok4, tok5;

            keyCriteriaOp                = CompareOp.Unknown;
            keyCriteriaPositions         = new List <int>();
            keyCriteriaSavedListKeys     = null;
            keyCriteriaInListKeys        = null;
            keyCriteriaConstantPositions = new List <int>();

            for (int tki = 0; tki < tokens.Count; tki++)
            {
                QueryColumn qc = tokens[tki].Qc;
                if (qc == null)
                {
                    continue;
                }
                if (!qc.IsKey)
                {
                    continue;
                }

                keyCriteriaPositions.Add(tki);                 // remember position of key col reference

                if (tokens.Count < tki + 2)
                {
                    throw new QueryException("Incomplete compound id criteria at end of statement");
                }

                bool notLogic = false;

                tok1 = GetTokenListString(tokens, tki + 1);

                if (Lex.Eq(tok1, "Not"))
                {
                    notLogic = true;
                    tki++;
                    if (tokens.Count < tki + 2)
                    {
                        throw new QueryException("Incomplete compound id criteria at end of statement");
                    }
                    tok1 = GetTokenListString(tokens, tki + 1);
                }

                tok2 = GetTokenListString(tokens, tki + 2);
                tok3 = GetTokenListString(tokens, tki + 3);
                tok4 = GetTokenListString(tokens, tki + 4);
                tok5 = GetTokenListString(tokens, tki + 5);

                // Saved List

                if (tokens.Count > tki + 3 && Lex.Eq(tok1, "In") &&
                    Lex.Eq(tok2, "List"))
                {                 // have a saved list
                    keyCriteriaOp = CompareOp.InList;

                    if (keyCriteriaSavedListKeys != null)                     // already have it?
                    {
                        throw new UserQueryException("Only one condition is allowed for the " + qc.ActiveLabel + " field");
                    }

                    if (notLogic)                     // not currently allowed for saved lists
                    {
                        throw new UserQueryException("\"Not\" logic is not allowed for " + qc.ActiveLabel + " saved lists");
                    }

                    string     listName = tokens[tki + 3].Tok.Text;
                    UserObject uo       = ResolveCidListReference(listName);
                    if (uo == null)
                    {
                        throw new UserQueryException("Key list " + listName + " not found");
                    }
                    listName = uo.InternalName;
                    CidList keyCriteriaSavedList = CidListDao.Read(listName, QueryEngine.GetRootTable(q));
                    if (keyCriteriaSavedList == null)
                    {
                        throw new UserQueryException("Key list " + listName + " not found");
                    }
                    keyCriteriaSavedListKeys = keyCriteriaSavedList.ToStringList();
                    tokens[tki].Qc           = null;
                    tokens[tki].Tok.Text     = "";
                    for (int tki2 = tki + 1; tki2 <= tki + 3; tki2++)
                    {
                        tokens[tki2].Tok.Text = "";
                    }
                    if (!MqlUtil.DisableAdjacentAndLogic(tokens, tki, tki + 3))
                    {
                        throw new UserQueryException("Only \"And\" logic is allowed with " +
                                                     qc.ActiveLabel + " saved lists");
                    }

                    int ti = q.GetQueryTableIndexByAlias(qc.QueryTable.Alias);
                    Qtd[ti].CriteriaCount--;
                    keyCriteriaPositions.RemoveAt(keyCriteriaPositions.Count - 1);
                }

                // Explicit list of allowed keys

                else if (tokens.Count > tki + 2 && Lex.Eq(tok1, "In") &&
                         Lex.Eq(tok2, "("))
                {
                    keyCriteriaOp = CompareOp.In;

                    int listKeyCount = 0;                     // count keys in this list
                    for (int tki2 = tki + 3; tki2 < tokens.Count; tki2++)
                    {
                        tok1 = tokens[tki2].Tok.Text;
                        if (tok1 == ",")
                        {
                            continue;
                        }
                        else if (tok1 == ")")
                        {
                            break;
                        }
                        keyCriteriaConstantPositions.Add(tki2);
                        if (keyCriteriaInListKeys == null)
                        {
                            keyCriteriaInListKeys = new List <string>();
                        }

                        MetaTable rootTable = QueryEngine.GetRootTable(q);
                        string    normKey   = CompoundId.Normalize(tok1, rootTable);
                        if (normKey != null && normKey != "")
                        {
                            keyCriteriaInListKeys.Add(normKey);
                            listKeyCount++;
                        }
                    }

                    if (listKeyCount == 0)
                    {
                        throw new UserQueryException("The query contains an invalid empty list of " + qc.ActiveLabel + "s");
                    }
                }

                // Between a range of key values

                else if (tokens.Count > tki + 4 && Lex.Eq(tok1, "Between") &&
                         Lex.Eq(tok3, "And"))
                {
                    keyCriteriaOp = CompareOp.Between;

                    keyCriteriaConstantPositions.Add(tki + 2);
                    keyCriteriaConstantPositions.Add(tki + 4);
                }

                // Single key value, treat like a list with a single value

                else if (Lex.Eq(tok1, "="))
                {
                    keyCriteriaOp = CompareOp.Eq;

                    keyCriteriaConstantPositions.Add(tki + 2);
                    if (keyCriteriaInListKeys == null)
                    {
                        keyCriteriaInListKeys = new List <string>();
                    }

                    MetaTable rootTable = QueryEngine.GetRootTable(q);
                    string    normKey   = CompoundId.Normalize(tok2, rootTable);
                    if (Lex.IsDefined(normKey))
                    {
                        keyCriteriaInListKeys.Add(normKey);
                    }
                }

                // Other binary operator

                else if (MqlUtil.IsBasicComparisonOperator(tok1))
                {
                    keyCriteriaOp = CompareOpString.ToCompareOp(tok1);
                    keyCriteriaConstantPositions.Add(tki + 2);
                }

                // Unary operator "is null"

                else if (Lex.Eq(tok1, "Is") && Lex.Eq(tok2, "Null"))
                {
                    keyCriteriaOp = CompareOp.IsNull;
                }

                // Unary operator "is not null"

                else if (Lex.Eq(tok1, "Is") && Lex.Eq(tok2, "Not") && Lex.Eq(tok3, "Null"))
                {
                    keyCriteriaOp = CompareOp.IsNotNull;
                }

                else
                {
                    throw new QueryException("Unrecognized compound id condition " + tok1);
                }
            }

            return;
        }
Example #20
0
 public Models.SysTableDetailView GetMetaByColumnName(string columnname)
 {
     return(MetaTable.Where(m => m.ColumnName == columnname).SingleOrDefault());
 }
Example #21
0
        /// Build an unparameterized key list SQL predicate
        /// </summary>
        /// <param name="Qt"></param>
        /// <param name="keyName">Key column name qualified by table name/alias</param>

        /// <summary>
        /// Build an unparameterized key list SQL predicate
        /// </summary>
        /// <param name="eqp"></param>
        /// <param name="baseSql"></param>
        /// <param name="keyName">Key column name qualified by table name/alias</param>
        /// <param name="keyList"></param>
        /// <param name="firstKeyIdx"></param>
        /// <param name="keyCount"></param>
        /// <param name="keyCriteria">Full criteria including col name operator and list</param>
        /// <param name="keyListString">Just the list of keys</param>

        public void BuildUnparameterizedKeyListPredicate(
            ExecuteQueryParms eqp,
            ref string baseSql,
            string keyName,
            List <string> keyList,
            int firstKeyIdx,
            int keyCount,
            out string keyCriteria,
            out string keyListString)
        {
            StringBuilder sb;
            int           i1;

            QueryTable qt         = eqp.QueryTable;
            MetaTable  mt         = qt.MetaTable;
            bool       integerKey = mt.IsIntegerKey();

            List <StringBuilder> sublists = new List <StringBuilder>();

            sb = new StringBuilder();
            sublists.Add(sb);

            int sublistKeyCount = 0;             // current keys in predicate

            keyCriteria = keyListString = null;

            for (i1 = 0; i1 < keyCount; i1++)
            {
                if (sublistKeyCount >= DbCommandMx.MaxOracleInListItemCount)
                {
                    sb = new StringBuilder();
                    sublists.Add(sb);
                    sublistKeyCount = 0;
                }

                if (sb.Length > 0)
                {
                    sb.Append(",");
                }
                string key = CompoundId.NormalizeForDatabase((string)keyList[firstKeyIdx + i1], qt.MetaTable);
                if (key == null)
                {
                    key = NullValue.NullNumber.ToString();              // if fails supply a "null" numeric value
                }
                if (!integerKey || !Lex.IsInteger(key))                 // quote it if not integer column or value
                {
                    key = Lex.AddSingleQuotes(key);                     // (note: quoted integers can cause mismatches for some database systems, e.g. Denodo)
                }
                sb.Append(key);
                sublistKeyCount++;
            }

            sb = new StringBuilder();
            if (sublists.Count >= 2)
            {
                sb.Append("(");                                  // wrap in parens if multiple sublists
            }
            for (int sli = 0; sli < sublists.Count; sli++)
            {
                if (sli > 0)
                {
                    sb.Append(" or ");
                }
                sb.Append(keyName + " in (" + sublists[sli] + ")");
            }
            if (sublists.Count >= 2)
            {
                sb.Append(")");
            }
            keyCriteria = sb.ToString();

            keyListString = sublists[0].ToString();             // return just the first sublist (adjust later for larger lists)
            return;
        }
Example #22
0
 internal SqlTable Table(MetaTable table, MetaType rowType, Expression sourceExpression) => new SqlTable(table, rowType, TypeProvider.GetApplicationType(0), sourceExpression);
Example #23
0
        /// <summary>
        /// Transform basic query to select all data for a compound number
        /// </summary>
        /// <param name="keyMt">Key metatable. If null then try to determine from key value</param>
        /// <param name="cn"></param>
        /// <returns></returns>

        public static Query TransformSelectAllDataQuery(
            Query originalQuery,
            QueryTable qt0,
            Query newQuery)
        {
            Query        q2 = null;
            MetaTable    mt;
            MetaColumn   mc;
            QueryTable   qt;
            QueryColumn  qc;
            MetaTreeNode mtn, tn;

            qc = qt0.GetQueryColumnByNameWithException("root_table");
            ParsedSingleCriteria psc = MqlUtil.ParseQueryColumnCriteria(qc);

            if (psc == null || Lex.IsUndefined(psc.Value))
            {
                throw new UserQueryException("Root table not defined");
            }
            string keyMtName = psc.Value;

            psc = MqlUtil.ParseSingleCriteria("cid " + originalQuery.KeyCriteria);
            if (psc == null || Lex.IsUndefined(psc.Value))
            {
                throw new UserQueryException("Compound Id not defined");
            }
            string cn = psc.Value;

            MetaTable keyMt = null;

            if (Lex.IsDefined(keyMtName))
            {
                keyMt = MetaTableCollection.Get(keyMtName);
            }

            if (keyMt != null && keyMt.Root.IsUserDatabaseStructureTable) // if root metatable is user database then normalize based on key
            {
                keyMt = keyMt.Root;                                       // be sure we have root
                cn    = CompoundId.Normalize(cn, keyMt);
            }

            else
            {
                cn    = CompoundId.Normalize(cn);
                keyMt = CompoundId.GetRootMetaTableFromCid(cn, keyMt);
                keyMt = keyMt.Root;                 // be sure we have root (may not be structure table)
            }

            if (keyMt == null)
            {
                throw new Exception("Failed to identify key MetaTable");
            }

            string allTableName = keyMt.Name + "_AllData";             // see if specific all-data tree node

            mtn = MetaTree.GetNode(allTableName);
            if (mtn == null)             // no special "_AllData" node, lookup in menu
            {
                foreach (MetaTreeNode parent in MetaTree.Nodes.Values)
                {
                    foreach (MetaTreeNode child in parent.Nodes)
                    {
                        if (Lex.Eq(child.Target, keyMt.Name))
                        {
                            mtn = parent;
                            break;
                        }
                    }
                }

                IUserObjectTree iuot = InterfaceRefs.IUserObjectTree;
                if (mtn == null && keyMt.IsUserDatabaseStructureTable && iuot != null)                 // see if user structure table & db
                {
                    int          userObjId  = UserObject.ParseObjectIdFromInternalName(keyMt.Name);
                    string       nodeItemId = "ANNOTATION_" + userObjId;
                    MetaTreeNode childMtn   = iuot.GetUserObjectNodeBytarget(nodeItemId);
                    if (childMtn != null && childMtn.Parent.Type == MetaTreeNodeType.Database)
                    {
                        mtn = childMtn.Parent;
                    }
                }
            }

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

            Query q = newQuery;

            for (int i1 = 0; i1 < mtn.Nodes.Count; i1++)
            {
                tn = (MetaTreeNode)mtn.Nodes[i1];
                if (!tn.IsDataTableType)
                {
                    continue;
                }

                mt = MetaTableCollection.Get(tn.Target);
                if (mt == null)
                {
                    continue;
                }
                if (mt.Root.Name != keyMt.Name)
                {
                    continue;                                             // must have same root
                }
                if (mt.MultiPivot && !mt.UseSummarizedData && mt.SummarizedExists)
                {
                    MetaTable mt2 = MetaTableCollection.Get(mt.Name + MetaTable.SummarySuffix);
                    if (mt2 != null)
                    {
                        mt = mt2;
                    }
                }

                //if (mt.RemapForRetrieval && mt.SummarizedExists) mt.UseSummarizedData = true; // get summarized multipivot data (not good, permanently changes the metatable)

                qt = new QueryTable(mt);
                //				if (Lex.Eq(mt.Name, "all_star_pivoted") || Lex.Eq(mt.Name, "all_annotation_pivoted")) mt = mt // debug;

                if (qt.SelectedCount > 0)                 // be sure something is selected
                {
                    q.AddQueryTable(qt);
                }
            }

            // See if a model query exists & use it or append to what we have already

            string fileName = ServicesDirs.ModelQueriesDir + @"\" + allTableName + ".qry";

            if (!ServerFile.GetLastWriteTime(fileName).Equals(DateTime.MinValue))             // model query file exist?
            {
                try
                {
                    string query2String = FileUtil.ReadFile(fileName);
                    q2 = Query.Deserialize(query2String);
                    q.MergeSubqueries(q2);                     // just use subquery
                }
                catch (Exception ex) { ex = ex; }
            }

            q.SetupQueryPagesAndViews(ResultsViewType.HtmlTable);             // be sure we have a default page & HTML view

            // Set key criteria

            q.KeyCriteria = " = " + cn;

            // Review tables (debug)

            //int tCnt = q.Tables.Count;
            //string tls = q.TableListString;
            //q.Tables.RemoveRange(23, 1);
            //q.Tables.RemoveRange(27, q.Tables.Count - 27);
            //q.Tables.RemoveRange(1, 25);

            // Get list of any inaccessible tables & remove from query

            q.InaccessableData = CheckDataSourceAccessibility(q);

            if (q.InaccessableData != null)
            {
                foreach (string schema in q.InaccessableData.Keys)
                {
                    foreach (string tName in q.InaccessableData[schema])
                    {
                        qt = q.GetQueryTableByName(tName);
                        if (qt != null && !qt.MetaTable.IsRootTable && q.Tables.Contains(qt))
                        {
                            q.RemoveQueryTable(qt);
                        }
                    }
                }

                //ShowUnavailableDataMessage(q);
                q.InaccessableData = null;
            }

            UsageDao.LogEvent("QueryAllData", "");

            //string mql = MqlUtil.ConvertQueryToMql(q); // debug

            return(q);
        }
 private static bool ListContainsEntity(MetaTable table, IEnumerable <object> list, object entity)
 {
     return(list.Any(e => AreEntitiesEqual(table, e, entity)));
 }
Example #25
0
        private static void _loadItemsGroupdDb(AbstractDb <int> db, ServerDbs serverDb, string file)
        {
            int numberOfErrors = 3;

            TextFileHelper.LatestFile = file;

            if (String.IsNullOrEmpty(file))
            {
                DbIOErrorHandler.Handle(StackTraceException.GetStrackTraceException(), "File not found " + ServerDbs.ItemGroups + ".", ErrorLevel.NotSpecified);
                return;
            }

            var itemDb1 = db.ProjectDatabase.GetDb <int>(ServerDbs.Items);
            var itemDb2 = db.ProjectDatabase.GetDb <int>(ServerDbs.Items2);

            if (!itemDb1.IsLoaded)
            {
                itemDb1.LoadDb();
            }

            if (!itemDb2.IsLoaded)
            {
                itemDb2.LoadDb();
            }

            var itemDb = new MetaTable <int>(ServerItemAttributes.AttributeList);

            itemDb.AddTable(itemDb1.Table);
            itemDb.AddTable(itemDb2.Table);
            itemDb.MergeOnce();

            Dictionary <string, ReadableTuple <int> > bufferredTuples = new Dictionary <string, ReadableTuple <int> >();

            foreach (var tuple in itemDb.FastItems)
            {
                bufferredTuples[tuple.GetStringValue(ServerItemAttributes.AegisName.Index)] = tuple;
            }

            var table = db.Table;

            if (db.Attached[serverDb] == null)
            {
                db.Attached[serverDb] = new Tuple <ServerDbs, HashSet <int> >(serverDb, new HashSet <int>());
            }

            HashSet <int> loadedIds = ((Tuple <ServerDbs, HashSet <int> >)db.Attached[serverDb]).Item2;

            foreach (string[] elements in TextFileHelper.GetElementsByCommas(FtpHelper.ReadAllBytes(file)))
            {
                try {
                    int itemId;
                    int iItemId;

                    if (Int32.TryParse(elements[0], out iItemId))
                    {
                        itemId = iItemId;
                    }
                    else
                    {
                        var constantDb = db.ProjectDatabase.GetDb <string>(ServerDbs.Constants);

                        if (!constantDb.IsLoaded)
                        {
                            constantDb.LoadDb();
                        }

                        var tuple = constantDb.Table.TryGetTuple(elements[0]);

                        if (tuple == null)
                        {
                            if (DbPathLocator.GenericErrorHandler(ref numberOfErrors, elements[0]))
                            {
                                return;
                            }
                            continue;
                        }

                        itemId = tuple.GetValue <int>(1);
                    }

                    string orate = elements[2];

                    int nameId;
                    int rate;

                    if (Int32.TryParse(elements[1], out nameId))
                    {
                    }
                    else
                    {
                        var tuple = bufferredTuples[elements[1]];

                        if (tuple == null)
                        {
                            if (DbPathLocator.GenericErrorHandler(ref numberOfErrors, elements[0]))
                            {
                                return;
                            }
                            continue;
                        }

                        nameId = tuple.Key;
                    }

                    Int32.TryParse(orate, out rate);

                    var id = (object)itemId;
                    loadedIds.Add((int)id);

                    if (!table.ContainsKey(itemId))
                    {
                        ReadableTuple <int> tuple = new ReadableTuple <int>(itemId, db.AttributeList);
                        tuple.SetRawValue(ServerItemGroupAttributes.Table, new Dictionary <int, ReadableTuple <int> >());
                        table.Add(itemId, tuple);
                    }

                    Dictionary <int, ReadableTuple <int> > dico = (Dictionary <int, ReadableTuple <int> >)table.GetRaw(itemId, ServerItemGroupAttributes.Table);

                    ReadableTuple <int> newTuple   = new ReadableTuple <int>(nameId, ServerItemGroupSubAttributes.AttributeList);
                    List <DbAttribute>  attributes = new List <DbAttribute>(ServerItemGroupSubAttributes.AttributeList.Attributes);

                    for (int i = 2; i < elements.Length; i++)
                    {
                        newTuple.SetRawValue(attributes[i - 1], elements[i]);
                    }

                    newTuple.SetRawValue(ServerItemGroupSubAttributes.ParentGroup, itemId);

                    dico[nameId] = newTuple;
                }
                catch {
                    if (DbPathLocator.GenericErrorHandler(ref numberOfErrors, elements[0]))
                    {
                        return;
                    }
                }
            }
        }
Example #26
0
        private void initClass()
        {
            DataSetName = "dsmeta";
            Prefix      = "";
            Namespace   = "http://tempuri.org/dsmeta.xsd";

            #region create DataTables
            //////////////////// CSA_IMPORT /////////////////////////////////
            var tcsa_import = new MetaTable("csa_import");
            tcsa_import.defineColumn("idcsa_import", typeof(int), false);
            tcsa_import.defineColumn("yimport", typeof(short), false);
            tcsa_import.defineColumn("nimport", typeof(int), false);
            tcsa_import.defineColumn("description", typeof(string), false);
            tcsa_import.defineColumn("adate", typeof(DateTime), false);
            tcsa_import.defineColumn("ybill_netti", typeof(short));
            tcsa_import.defineColumn("nbill_netti", typeof(int));
            tcsa_import.defineColumn("ybill_versamenti", typeof(short));
            tcsa_import.defineColumn("nbill_versamenti", typeof(int));
            tcsa_import.defineColumn("ct", typeof(DateTime), false);
            tcsa_import.defineColumn("cu", typeof(string), false);
            tcsa_import.defineColumn("lt", typeof(DateTime), false);
            tcsa_import.defineColumn("lu", typeof(string), false);
            Tables.Add(tcsa_import);
            tcsa_import.defineKey("idcsa_import");

            //////////////////// CSA_IMPORTVER /////////////////////////////////
            var tcsa_importver = new MetaTable("csa_importver");
            tcsa_importver.defineColumn("idcsa_import", typeof(int), false);
            tcsa_importver.defineColumn("idver", typeof(int), false);
            tcsa_importver.defineColumn("ruolocsa", typeof(string), false);
            tcsa_importver.defineColumn("capitolocsa", typeof(string), false);
            tcsa_importver.defineColumn("competenza", typeof(string), false);
            tcsa_importver.defineColumn("matricola", typeof(string), false);
            tcsa_importver.defineColumn("ente", typeof(string), false);
            tcsa_importver.defineColumn("vocecsa", typeof(string), false);
            tcsa_importver.defineColumn("importo", typeof(decimal), false);
            tcsa_importver.defineColumn("flagcr", typeof(string));
            tcsa_importver.defineColumn("ayear", typeof(int));
            tcsa_importver.defineColumn("idcsa_contractkind", typeof(int));
            tcsa_importver.defineColumn("idcsa_contract", typeof(int));
            tcsa_importver.defineColumn("idcsa_agency", typeof(int));
            tcsa_importver.defineColumn("idfin_income", typeof(int));
            tcsa_importver.defineColumn("idacc_debit", typeof(string));
            tcsa_importver.defineColumn("idfin_expense", typeof(int));
            tcsa_importver.defineColumn("idacc_expense", typeof(string));
            tcsa_importver.defineColumn("idfin_incomeclawback", typeof(int));
            tcsa_importver.defineColumn("idacc_internalcredit", typeof(string));
            tcsa_importver.defineColumn("idreg_agency", typeof(int));
            tcsa_importver.defineColumn("idcsa_agencypaymethod", typeof(int));
            tcsa_importver.defineColumn("idexp_cost", typeof(int));
            tcsa_importver.defineColumn("idfin_cost", typeof(int));
            tcsa_importver.defineColumn("idacc_cost", typeof(string));
            tcsa_importver.defineColumn("flagclawback", typeof(string));
            tcsa_importver.defineColumn("flagdirectcsaclawback", typeof(string));
            tcsa_importver.defineColumn("idreg", typeof(int));
            tcsa_importver.defineColumn("idupb", typeof(string));
            tcsa_importver.defineColumn("idcsa_contracttax", typeof(int));
            tcsa_importver.defineColumn("idcsa_contractkinddata", typeof(int));
            tcsa_importver.defineColumn("idcsa_incomesetup", typeof(int));
            tcsa_importver.defineColumn("lt", typeof(DateTime), false);
            tcsa_importver.defineColumn("lu", typeof(string), false);
            tcsa_importver.defineColumn("idepexp", typeof(int));
            tcsa_importver.defineColumn("idacc_revenue", typeof(string));
            tcsa_importver.defineColumn("idacc_agency_credit", typeof(string));
            tcsa_importver.defineColumn("idsor_siope_income", typeof(int));
            tcsa_importver.defineColumn("idsor_siope_expense", typeof(int));
            tcsa_importver.defineColumn("idsor_siope_incomeclawback", typeof(int));
            tcsa_importver.defineColumn("idsor_siope_cost", typeof(int));
            Tables.Add(tcsa_importver);
            tcsa_importver.defineKey("idcsa_import", "idver");

            //////////////////// REGISTRY /////////////////////////////////
            var tregistry = new registryTable();
            tregistry.addBaseColumns("idreg", "active", "annotation", "badgecode", "birthdate", "cf", "ct", "cu", "extmatricula", "foreigncf", "forename", "gender", "idcategory", "idcentralizedcategory", "idcity", "idmaritalstatus", "idnation", "idregistryclass", "idtitle", "location", "lt", "lu", "maritalsurname", "p_iva", "rtf", "surname", "title", "txt", "residence", "idregistrykind", "authorization_free", "multi_cf", "toredirect", "idaccmotivedebit", "idaccmotivecredit");
            Tables.Add(tregistry);
            tregistry.defineKey("idreg");

            //////////////////// REGISTRY1 /////////////////////////////////
            var tregistry1 = new MetaTable("registry1");
            tregistry1.defineColumn("idreg", typeof(int), false);
            tregistry1.defineColumn("active", typeof(string), false);
            tregistry1.defineColumn("annotation", typeof(string));
            tregistry1.defineColumn("badgecode", typeof(string));
            tregistry1.defineColumn("birthdate", typeof(DateTime));
            tregistry1.defineColumn("cf", typeof(string));
            tregistry1.defineColumn("ct", typeof(DateTime), false);
            tregistry1.defineColumn("cu", typeof(string), false);
            tregistry1.defineColumn("extmatricula", typeof(string));
            tregistry1.defineColumn("foreigncf", typeof(string));
            tregistry1.defineColumn("forename", typeof(string));
            tregistry1.defineColumn("gender", typeof(string));
            tregistry1.defineColumn("idcategory", typeof(string));
            tregistry1.defineColumn("idcentralizedcategory", typeof(string));
            tregistry1.defineColumn("idcity", typeof(int));
            tregistry1.defineColumn("idmaritalstatus", typeof(string));
            tregistry1.defineColumn("idnation", typeof(int));
            tregistry1.defineColumn("idregistryclass", typeof(string));
            tregistry1.defineColumn("idtitle", typeof(string));
            tregistry1.defineColumn("location", typeof(string));
            tregistry1.defineColumn("lt", typeof(DateTime), false);
            tregistry1.defineColumn("lu", typeof(string), false);
            tregistry1.defineColumn("maritalsurname", typeof(string));
            tregistry1.defineColumn("p_iva", typeof(string));
            tregistry1.defineColumn("rtf", typeof(Byte[]));
            tregistry1.defineColumn("surname", typeof(string));
            tregistry1.defineColumn("title", typeof(string), false);
            tregistry1.defineColumn("txt", typeof(string));
            tregistry1.defineColumn("residence", typeof(int), false);
            tregistry1.defineColumn("idregistrykind", typeof(int));
            tregistry1.defineColumn("authorization_free", typeof(string));
            tregistry1.defineColumn("multi_cf", typeof(string));
            tregistry1.defineColumn("toredirect", typeof(int));
            tregistry1.defineColumn("idaccmotivedebit", typeof(string));
            tregistry1.defineColumn("idaccmotivecredit", typeof(string));
            Tables.Add(tregistry1);
            tregistry1.defineKey("idreg");

            //////////////////// EXPENSEVIEW /////////////////////////////////
            var texpenseview = new MetaTable("expenseview");
            texpenseview.defineColumn("idexp", typeof(int), false);
            texpenseview.defineColumn("!livprecedente", typeof(string));
            texpenseview.defineColumn("nphase", typeof(byte));
            texpenseview.defineColumn("phase", typeof(string), false);
            texpenseview.defineColumn("ymov", typeof(short), false);
            texpenseview.defineColumn("nmov", typeof(int), false);
            texpenseview.defineColumn("parentidexp", typeof(int));
            texpenseview.defineColumn("parentymov", typeof(short));
            texpenseview.defineColumn("parentnmov", typeof(int));
            texpenseview.defineColumn("idformerexpense", typeof(int));
            texpenseview.defineColumn("ayear", typeof(short), false);
            texpenseview.defineColumn("idfin", typeof(int));
            texpenseview.defineColumn("codefin", typeof(string));
            texpenseview.defineColumn("finance", typeof(string));
            texpenseview.defineColumn("idupb", typeof(string));
            texpenseview.defineColumn("codeupb", typeof(string));
            texpenseview.defineColumn("upb", typeof(string));
            texpenseview.defineColumn("idreg", typeof(int));
            texpenseview.defineColumn("registry", typeof(string));
            texpenseview.defineColumn("idman", typeof(int));
            texpenseview.defineColumn("manager", typeof(string));
            texpenseview.defineColumn("ypay", typeof(short), true, true);
            texpenseview.defineColumn("npay", typeof(int));
            texpenseview.defineColumn("paymentadate", typeof(DateTime));
            texpenseview.defineColumn("doc", typeof(string));
            texpenseview.defineColumn("docdate", typeof(DateTime));
            texpenseview.defineColumn("description", typeof(string), false);
            texpenseview.defineColumn("amount", typeof(decimal));
            texpenseview.defineColumn("ayearstartamount", typeof(decimal));
            texpenseview.defineColumn("curramount", typeof(decimal));
            texpenseview.defineColumn("available", typeof(decimal));
            texpenseview.defineColumn("idregistrypaymethod", typeof(int));
            texpenseview.defineColumn("idpaymethod", typeof(int));
            texpenseview.defineColumn("iban", typeof(string));
            texpenseview.defineColumn("cin", typeof(string));
            texpenseview.defineColumn("idbank", typeof(string));
            texpenseview.defineColumn("idcab", typeof(string));
            texpenseview.defineColumn("cc", typeof(string));
            texpenseview.defineColumn("iddeputy", typeof(int));
            texpenseview.defineColumn("deputy", typeof(string));
            texpenseview.defineColumn("refexternaldoc", typeof(string));
            texpenseview.defineColumn("paymentdescr", typeof(string));
            texpenseview.defineColumn("idser", typeof(int));
            texpenseview.defineColumn("service", typeof(string));
            texpenseview.defineColumn("servicestart", typeof(DateTime));
            texpenseview.defineColumn("servicestop", typeof(DateTime));
            texpenseview.defineColumn("ivaamount", typeof(decimal));
            texpenseview.defineColumn("flag", typeof(byte));
            texpenseview.defineColumn("totflag", typeof(byte));
            texpenseview.defineColumn("flagarrear", typeof(string), true, true);
            texpenseview.defineColumn("autokind", typeof(byte));
            texpenseview.defineColumn("idpayment", typeof(int));
            texpenseview.defineColumn("expiration", typeof(DateTime));
            texpenseview.defineColumn("adate", typeof(DateTime), false);
            texpenseview.defineColumn("autocode", typeof(int));
            texpenseview.defineColumn("idclawback", typeof(int));
            texpenseview.defineColumn("clawback", typeof(string));
            texpenseview.defineColumn("nbill", typeof(int));
            texpenseview.defineColumn("idpay", typeof(int));
            texpenseview.defineColumn("txt", typeof(string));
            texpenseview.defineColumn("cu", typeof(string), false);
            texpenseview.defineColumn("ct", typeof(DateTime), false);
            texpenseview.defineColumn("lu", typeof(string), false);
            texpenseview.defineColumn("lt", typeof(DateTime), false);
            texpenseview.defineColumn("biccode", typeof(string));
            texpenseview.defineColumn("paymethod_flag", typeof(int));
            texpenseview.defineColumn("paymethod_allowdeputy", typeof(string));
            texpenseview.defineColumn("extracode", typeof(string));
            texpenseview.defineColumn("idchargehandling", typeof(int));
            Tables.Add(texpenseview);

            //////////////////// INCOMEVIEW /////////////////////////////////
            var tincomeview = new MetaTable("incomeview");
            tincomeview.defineColumn("idinc", typeof(int), false);
            tincomeview.defineColumn("!livprecedente", typeof(string));
            tincomeview.defineColumn("nphase", typeof(byte));
            tincomeview.defineColumn("phase", typeof(string), false);
            tincomeview.defineColumn("ymov", typeof(short), false);
            tincomeview.defineColumn("nmov", typeof(int), false);
            tincomeview.defineColumn("parentymov", typeof(short));
            tincomeview.defineColumn("parentnmov", typeof(int));
            tincomeview.defineColumn("parentidinc", typeof(int));
            tincomeview.defineColumn("ayear", typeof(short), false);
            tincomeview.defineColumn("idfin", typeof(int));
            tincomeview.defineColumn("codefin", typeof(string));
            tincomeview.defineColumn("finance", typeof(string));
            tincomeview.defineColumn("idupb", typeof(string));
            tincomeview.defineColumn("codeupb", typeof(string));
            tincomeview.defineColumn("upb", typeof(string));
            tincomeview.defineColumn("idreg", typeof(int));
            tincomeview.defineColumn("registry", typeof(string));
            tincomeview.defineColumn("idman", typeof(int));
            tincomeview.defineColumn("manager", typeof(string));
            tincomeview.defineColumn("ypro", typeof(short));
            tincomeview.defineColumn("npro", typeof(int));
            tincomeview.defineColumn("doc", typeof(string));
            tincomeview.defineColumn("docdate", typeof(DateTime));
            tincomeview.defineColumn("description", typeof(string), false);
            tincomeview.defineColumn("amount", typeof(decimal));
            tincomeview.defineColumn("ayearstartamount", typeof(decimal));
            tincomeview.defineColumn("curramount", typeof(decimal));
            tincomeview.defineColumn("available", typeof(decimal));
            tincomeview.defineColumn("unpartitioned", typeof(decimal));
            tincomeview.defineColumn("flag", typeof(byte));
            tincomeview.defineColumn("totflag", typeof(byte), false);
            tincomeview.defineColumn("flagarrear", typeof(string));
            tincomeview.defineColumn("autokind", typeof(byte));
            tincomeview.defineColumn("autocode", typeof(int));
            tincomeview.defineColumn("idpayment", typeof(int));
            tincomeview.defineColumn("expiration", typeof(DateTime));
            tincomeview.defineColumn("adate", typeof(DateTime), false);
            tincomeview.defineColumn("nbill", typeof(int));
            tincomeview.defineColumn("idpro", typeof(int));
            tincomeview.defineColumn("cu", typeof(string), false);
            tincomeview.defineColumn("ct", typeof(DateTime), false);
            tincomeview.defineColumn("lu", typeof(string), false);
            tincomeview.defineColumn("lt", typeof(DateTime), false);
            Tables.Add(tincomeview);

            //////////////////// CSA_IMPORTVER_PARTITION /////////////////////////////////
            var tcsa_importver_partition = new MetaTable("csa_importver_partition");
            tcsa_importver_partition.defineColumn("idcsa_import", typeof(int), false);
            tcsa_importver_partition.defineColumn("idver", typeof(int), false);
            tcsa_importver_partition.defineColumn("ndetail", typeof(int), false);
            tcsa_importver_partition.defineColumn("idexp", typeof(int));
            tcsa_importver_partition.defineColumn("ct", typeof(DateTime));
            tcsa_importver_partition.defineColumn("cu", typeof(string));
            tcsa_importver_partition.defineColumn("lt", typeof(DateTime));
            tcsa_importver_partition.defineColumn("lu", typeof(string));
            tcsa_importver_partition.defineColumn("amount", typeof(decimal));
            tcsa_importver_partition.defineColumn("idupb", typeof(string));
            tcsa_importver_partition.defineColumn("idacc", typeof(string));
            tcsa_importver_partition.defineColumn("idfin", typeof(int));
            tcsa_importver_partition.defineColumn("idepexp", typeof(int));
            tcsa_importver_partition.defineColumn("idsor_siope", typeof(int));
            Tables.Add(tcsa_importver_partition);
            tcsa_importver_partition.defineKey("idcsa_import", "idver", "ndetail");

            //////////////////// CSA_IMPORTVER_PARTITIONVIEW /////////////////////////////////
            var tcsa_importver_partitionview = new MetaTable("csa_importver_partitionview");
            tcsa_importver_partitionview.defineColumn("ayear", typeof(short));
            tcsa_importver_partitionview.defineColumn("competency", typeof(int));
            tcsa_importver_partitionview.defineColumn("idcsa_import", typeof(int), false);
            tcsa_importver_partitionview.defineColumn("yimport", typeof(short), false);
            tcsa_importver_partitionview.defineColumn("nimport", typeof(int), false);
            tcsa_importver_partitionview.defineColumn("idver", typeof(int), false);
            tcsa_importver_partitionview.defineColumn("ndetail", typeof(int), false);
            tcsa_importver_partitionview.defineColumn("amount", typeof(decimal));
            tcsa_importver_partitionview.defineColumn("idcsa_contract", typeof(int));
            tcsa_importver_partitionview.defineColumn("ycontract", typeof(short));
            tcsa_importver_partitionview.defineColumn("ncontract", typeof(int));
            tcsa_importver_partitionview.defineColumn("idcsa_contractkind", typeof(int));
            tcsa_importver_partitionview.defineColumn("csa_contractkindcode", typeof(string));
            tcsa_importver_partitionview.defineColumn("csa_contractkind", typeof(string));
            tcsa_importver_partitionview.defineColumn("ruolocsa", typeof(string), false);
            tcsa_importver_partitionview.defineColumn("capitolocsa", typeof(string), false);
            tcsa_importver_partitionview.defineColumn("competenza", typeof(string), false);
            tcsa_importver_partitionview.defineColumn("matricola", typeof(string), false);
            tcsa_importver_partitionview.defineColumn("ente", typeof(string), false);
            tcsa_importver_partitionview.defineColumn("vocecsa", typeof(string), false);
            tcsa_importver_partitionview.defineColumn("vocecsaunified", typeof(string));
            tcsa_importver_partitionview.defineColumn("idreg", typeof(int));
            tcsa_importver_partitionview.defineColumn("registry", typeof(string));
            tcsa_importver_partitionview.defineColumn("idcsa_agency", typeof(int));
            tcsa_importver_partitionview.defineColumn("agency", typeof(string));
            tcsa_importver_partitionview.defineColumn("idreg_agency", typeof(int));
            tcsa_importver_partitionview.defineColumn("registry_agency", typeof(string));
            tcsa_importver_partitionview.defineColumn("idcsa_agencypaymethod", typeof(int));
            tcsa_importver_partitionview.defineColumn("idregistrypaymethod", typeof(int));
            tcsa_importver_partitionview.defineColumn("idcsa_contracttax", typeof(int));
            tcsa_importver_partitionview.defineColumn("idcsa_contractkinddata", typeof(int));
            tcsa_importver_partitionview.defineColumn("idcsa_incomesetup", typeof(int));
            tcsa_importver_partitionview.defineColumn("idacc_debit", typeof(string));
            tcsa_importver_partitionview.defineColumn("codeacc_debit", typeof(string));
            tcsa_importver_partitionview.defineColumn("account_debit", typeof(string));
            tcsa_importver_partitionview.defineColumn("idacc_expense", typeof(string));
            tcsa_importver_partitionview.defineColumn("codeacc_expense", typeof(string));
            tcsa_importver_partitionview.defineColumn("account_expense", typeof(string));
            tcsa_importver_partitionview.defineColumn("idacc_internalcredit", typeof(string));
            tcsa_importver_partitionview.defineColumn("codeacc_internalcredit", typeof(string));
            tcsa_importver_partitionview.defineColumn("account_internalcredit", typeof(string));
            tcsa_importver_partitionview.defineColumn("idacc_revenue", typeof(string));
            tcsa_importver_partitionview.defineColumn("codeacc_revenue", typeof(string));
            tcsa_importver_partitionview.defineColumn("account_revenue", typeof(string));
            tcsa_importver_partitionview.defineColumn("idacc_agency_credit", typeof(string));
            tcsa_importver_partitionview.defineColumn("codeacc_agency_credit", typeof(string));
            tcsa_importver_partitionview.defineColumn("account_agency_credit", typeof(string));
            tcsa_importver_partitionview.defineColumn("idfin_income", typeof(int));
            tcsa_importver_partitionview.defineColumn("codefin_income", typeof(string));
            tcsa_importver_partitionview.defineColumn("fin_income", typeof(string));
            tcsa_importver_partitionview.defineColumn("idfin_expense", typeof(int));
            tcsa_importver_partitionview.defineColumn("codefin_expense", typeof(string));
            tcsa_importver_partitionview.defineColumn("fin_expense", typeof(string));
            tcsa_importver_partitionview.defineColumn("idfin_incomeclawback", typeof(int));
            tcsa_importver_partitionview.defineColumn("codefin_incomeclawback", typeof(string));
            tcsa_importver_partitionview.defineColumn("fin_incomeclawback", typeof(string));
            tcsa_importver_partitionview.defineColumn("idsor_siope_income", typeof(int));
            tcsa_importver_partitionview.defineColumn("sortcode_income", typeof(string));
            tcsa_importver_partitionview.defineColumn("sorting_income", typeof(string));
            tcsa_importver_partitionview.defineColumn("idsor_siope_expense", typeof(int));
            tcsa_importver_partitionview.defineColumn("sortcode_expense", typeof(string));
            tcsa_importver_partitionview.defineColumn("sorting_expense", typeof(string));
            tcsa_importver_partitionview.defineColumn("idsor_siope_incomeclawback", typeof(int));
            tcsa_importver_partitionview.defineColumn("sortcode_incomeclawback", typeof(string));
            tcsa_importver_partitionview.defineColumn("sorting_incomeclawback", typeof(string));
            tcsa_importver_partitionview.defineColumn("idsor_siope_cost", typeof(int));
            tcsa_importver_partitionview.defineColumn("sortcode_cost", typeof(string));
            tcsa_importver_partitionview.defineColumn("sorting_cost", typeof(string));
            tcsa_importver_partitionview.defineColumn("idexp", typeof(int));
            tcsa_importver_partitionview.defineColumn("ymov", typeof(short));
            tcsa_importver_partitionview.defineColumn("nmov", typeof(int));
            tcsa_importver_partitionview.defineColumn("paridexp", typeof(int));
            tcsa_importver_partitionview.defineColumn("nphaseexpense", typeof(byte));
            tcsa_importver_partitionview.defineColumn("lu", typeof(string));
            tcsa_importver_partitionview.defineColumn("lt", typeof(DateTime));
            tcsa_importver_partitionview.defineColumn("cu", typeof(string));
            tcsa_importver_partitionview.defineColumn("ct", typeof(DateTime));
            tcsa_importver_partitionview.defineColumn("idepexp", typeof(int));
            tcsa_importver_partitionview.defineColumn("yepexp", typeof(short));
            tcsa_importver_partitionview.defineColumn("nepexp", typeof(int));
            tcsa_importver_partitionview.defineColumn("idrelated", typeof(string));
            tcsa_importver_partitionview.defineColumn("paridepexp", typeof(int));
            tcsa_importver_partitionview.defineColumn("nphaseepexp", typeof(short));
            tcsa_importver_partitionview.defineColumn("flagcr", typeof(string));
            tcsa_importver_partitionview.defineColumn("flagclawback", typeof(string));
            tcsa_importver_partitionview.defineColumn("flagdirectcsaclawback", typeof(string));
            tcsa_importver_partitionview.defineColumn("idunderwriting", typeof(int));
            tcsa_importver_partitionview.defineColumn("underwriting", typeof(string));
            tcsa_importver_partitionview.defineColumn("idupb", typeof(string));
            tcsa_importver_partitionview.defineColumn("codeupb", typeof(string));
            tcsa_importver_partitionview.defineColumn("upb", typeof(string));
            tcsa_importver_partitionview.defineColumn("idacc_cost", typeof(string));
            tcsa_importver_partitionview.defineColumn("codeacc_cost", typeof(string));
            tcsa_importver_partitionview.defineColumn("account_cost", typeof(string));
            tcsa_importver_partitionview.defineColumn("idfin", typeof(int));
            tcsa_importver_partitionview.defineColumn("codefin", typeof(string));
            tcsa_importver_partitionview.defineColumn("fin", typeof(string));
            tcsa_importver_partitionview.defineColumn("idsorkind", typeof(string));
            tcsa_importver_partitionview.defineColumn("codesorkind", typeof(string));
            tcsa_importver_partitionview.defineColumn("sortingkind", typeof(string));
            tcsa_importver_partitionview.defineColumn("idsor_siope", typeof(string));
            tcsa_importver_partitionview.defineColumn("sortcode_siope", typeof(string));
            tcsa_importver_partitionview.defineColumn("sorting_siope", typeof(string));
            Tables.Add(tcsa_importver_partitionview);
            tcsa_importver_partitionview.defineKey("idcsa_import", "ndetail", "idver");

            //////////////////// BILL_NETTI /////////////////////////////////
            var tbill_netti = new MetaTable("bill_netti");
            tbill_netti.defineColumn("ybill", typeof(short), false);
            tbill_netti.defineColumn("nbill", typeof(int), false);
            tbill_netti.defineColumn("billkind", typeof(string), false);
            tbill_netti.defineColumn("registry", typeof(string));
            tbill_netti.defineColumn("covered", typeof(decimal));
            tbill_netti.defineColumn("total", typeof(decimal));
            tbill_netti.defineColumn("adate", typeof(DateTime));
            tbill_netti.defineColumn("active", typeof(string));
            tbill_netti.defineColumn("motive", typeof(string));
            tbill_netti.defineColumn("ct", typeof(DateTime), false);
            tbill_netti.defineColumn("cu", typeof(string), false);
            tbill_netti.defineColumn("lt", typeof(DateTime), false);
            tbill_netti.defineColumn("lu", typeof(string), false);
            tbill_netti.defineColumn("idtreasurer", typeof(int));
            tbill_netti.defineColumn("regularizationnote", typeof(string));
            tbill_netti.defineColumn("reduction", typeof(decimal));
            tbill_netti.defineColumn("banknum", typeof(int));
            tbill_netti.defineColumn("idbank", typeof(string));
            Tables.Add(tbill_netti);
            tbill_netti.defineKey("ybill", "nbill", "billkind");

            //////////////////// BILL_VERSAMENTI /////////////////////////////////
            var tbill_versamenti = new MetaTable("bill_versamenti");
            tbill_versamenti.defineColumn("ybill", typeof(short), false);
            tbill_versamenti.defineColumn("nbill", typeof(int), false);
            tbill_versamenti.defineColumn("billkind", typeof(string), false);
            tbill_versamenti.defineColumn("registry", typeof(string));
            tbill_versamenti.defineColumn("covered", typeof(decimal));
            tbill_versamenti.defineColumn("total", typeof(decimal));
            tbill_versamenti.defineColumn("adate", typeof(DateTime));
            tbill_versamenti.defineColumn("active", typeof(string));
            tbill_versamenti.defineColumn("motive", typeof(string));
            tbill_versamenti.defineColumn("ct", typeof(DateTime), false);
            tbill_versamenti.defineColumn("cu", typeof(string), false);
            tbill_versamenti.defineColumn("lt", typeof(DateTime), false);
            tbill_versamenti.defineColumn("lu", typeof(string), false);
            tbill_versamenti.defineColumn("idtreasurer", typeof(int));
            tbill_versamenti.defineColumn("regularizationnote", typeof(string));
            tbill_versamenti.defineColumn("reduction", typeof(decimal));
            tbill_versamenti.defineColumn("banknum", typeof(int));
            tbill_versamenti.defineColumn("idbank", typeof(string));
            Tables.Add(tbill_versamenti);
            tbill_versamenti.defineKey("ybill", "nbill", "billkind");

            //////////////////// CSA_BILL /////////////////////////////////
            var tcsa_bill = new MetaTable("csa_bill");
            tcsa_bill.defineColumn("idcsa_import", typeof(int), false);
            tcsa_bill.defineColumn("idcsa_bill", typeof(int), false);
            tcsa_bill.defineColumn("idreg", typeof(int), false);
            tcsa_bill.defineColumn("nbill", typeof(int), false);
            tcsa_bill.defineColumn("amount", typeof(decimal), false);
            tcsa_bill.defineColumn("lt", typeof(DateTime));
            tcsa_bill.defineColumn("lu", typeof(string));
            tcsa_bill.defineColumn("ct", typeof(DateTime));
            tcsa_bill.defineColumn("cu", typeof(string));
            tcsa_bill.defineColumn("!registry", typeof(string));
            tcsa_bill.defineColumn("!motive", typeof(string));
            tcsa_bill.defineColumn("!datasospeso", typeof(string));
            Tables.Add(tcsa_bill);
            tcsa_bill.defineKey("idcsa_import", "idcsa_bill");

            //////////////////// REGISTRY_SOSPESI /////////////////////////////////
            var tregistry_sospesi = new MetaTable("registry_sospesi");
            tregistry_sospesi.defineColumn("idreg", typeof(int), false);
            tregistry_sospesi.defineColumn("active", typeof(string), false);
            tregistry_sospesi.defineColumn("annotation", typeof(string));
            tregistry_sospesi.defineColumn("badgecode", typeof(string));
            tregistry_sospesi.defineColumn("birthdate", typeof(DateTime));
            tregistry_sospesi.defineColumn("cf", typeof(string));
            tregistry_sospesi.defineColumn("ct", typeof(DateTime), false);
            tregistry_sospesi.defineColumn("cu", typeof(string), false);
            tregistry_sospesi.defineColumn("extmatricula", typeof(string));
            tregistry_sospesi.defineColumn("foreigncf", typeof(string));
            tregistry_sospesi.defineColumn("forename", typeof(string));
            tregistry_sospesi.defineColumn("gender", typeof(string));
            tregistry_sospesi.defineColumn("idcategory", typeof(string));
            tregistry_sospesi.defineColumn("idcentralizedcategory", typeof(string));
            tregistry_sospesi.defineColumn("idcity", typeof(int));
            tregistry_sospesi.defineColumn("idmaritalstatus", typeof(string));
            tregistry_sospesi.defineColumn("idnation", typeof(int));
            tregistry_sospesi.defineColumn("idregistryclass", typeof(string));
            tregistry_sospesi.defineColumn("idtitle", typeof(string));
            tregistry_sospesi.defineColumn("location", typeof(string));
            tregistry_sospesi.defineColumn("lt", typeof(DateTime), false);
            tregistry_sospesi.defineColumn("lu", typeof(string), false);
            tregistry_sospesi.defineColumn("maritalsurname", typeof(string));
            tregistry_sospesi.defineColumn("p_iva", typeof(string));
            tregistry_sospesi.defineColumn("rtf", typeof(Byte[]));
            tregistry_sospesi.defineColumn("surname", typeof(string));
            tregistry_sospesi.defineColumn("title", typeof(string), false);
            tregistry_sospesi.defineColumn("txt", typeof(string));
            tregistry_sospesi.defineColumn("residence", typeof(int), false);
            tregistry_sospesi.defineColumn("idregistrykind", typeof(int));
            tregistry_sospesi.defineColumn("authorization_free", typeof(string));
            tregistry_sospesi.defineColumn("multi_cf", typeof(string));
            tregistry_sospesi.defineColumn("toredirect", typeof(int));
            tregistry_sospesi.defineColumn("idaccmotivedebit", typeof(string));
            tregistry_sospesi.defineColumn("idaccmotivecredit", typeof(string));
            tregistry_sospesi.defineColumn("ccp", typeof(string));
            tregistry_sospesi.defineColumn("flagbankitaliaproceeds", typeof(string));
            tregistry_sospesi.defineColumn("idexternal", typeof(int));
            tregistry_sospesi.defineColumn("ipa_fe", typeof(string));
            tregistry_sospesi.defineColumn("flag_pa", typeof(string));
            tregistry_sospesi.defineColumn("sdi_norifamm", typeof(string));
            tregistry_sospesi.defineColumn("sdi_defrifamm", typeof(string));
            Tables.Add(tregistry_sospesi);
            tregistry_sospesi.defineKey("idreg");

            //////////////////// BILL_RIPARTIZIONE /////////////////////////////////
            var tbill_ripartizione = new MetaTable("bill_ripartizione");
            tbill_ripartizione.defineColumn("ybill", typeof(short), false);
            tbill_ripartizione.defineColumn("nbill", typeof(int), false);
            tbill_ripartizione.defineColumn("billkind", typeof(string), false);
            tbill_ripartizione.defineColumn("registry", typeof(string));
            tbill_ripartizione.defineColumn("covered", typeof(decimal));
            tbill_ripartizione.defineColumn("total", typeof(decimal));
            tbill_ripartizione.defineColumn("adate", typeof(DateTime));
            tbill_ripartizione.defineColumn("active", typeof(string));
            tbill_ripartizione.defineColumn("motive", typeof(string));
            tbill_ripartizione.defineColumn("ct", typeof(DateTime), false);
            tbill_ripartizione.defineColumn("cu", typeof(string), false);
            tbill_ripartizione.defineColumn("lt", typeof(DateTime), false);
            tbill_ripartizione.defineColumn("lu", typeof(string), false);
            tbill_ripartizione.defineColumn("idtreasurer", typeof(int));
            tbill_ripartizione.defineColumn("regularizationnote", typeof(string));
            tbill_ripartizione.defineColumn("reduction", typeof(decimal));
            tbill_ripartizione.defineColumn("banknum", typeof(int));
            tbill_ripartizione.defineColumn("idbank", typeof(string));
            Tables.Add(tbill_ripartizione);
            tbill_ripartizione.defineKey("ybill", "nbill", "billkind");

            //////////////////// BILLVIEW /////////////////////////////////
            var tbillview = new MetaTable("billview");
            tbillview.defineColumn("ybill", typeof(short), false);
            tbillview.defineColumn("nbill", typeof(int), false);
            tbillview.defineColumn("billkind", typeof(string), false);
            tbillview.defineColumn("active", typeof(string));
            tbillview.defineColumn("adate", typeof(DateTime));
            tbillview.defineColumn("registry", typeof(string));
            tbillview.defineColumn("motive", typeof(string));
            tbillview.defineColumn("total", typeof(decimal));
            tbillview.defineColumn("covered", typeof(decimal));
            tbillview.defineColumn("cu", typeof(string), false);
            tbillview.defineColumn("ct", typeof(DateTime), false);
            tbillview.defineColumn("lu", typeof(string), false);
            tbillview.defineColumn("lt", typeof(DateTime), false);
            tbillview.defineColumn("idtreasurer", typeof(int));
            tbillview.defineColumn("treasurer", typeof(string));
            tbillview.defineColumn("regularizationnote", typeof(string));
            tbillview.defineColumn("idsor01", typeof(int));
            tbillview.defineColumn("idsor02", typeof(int));
            tbillview.defineColumn("idsor03", typeof(int));
            tbillview.defineColumn("idsor04", typeof(int));
            tbillview.defineColumn("idsor05", typeof(int));
            Tables.Add(tbillview);
            tbillview.defineKey("ybill", "nbill", "billkind");

            //////////////////// CSA_AGENCYVIEW /////////////////////////////////
            var tcsa_agencyview = new MetaTable("csa_agencyview");
            tcsa_agencyview.defineColumn("idcsa_agency", typeof(int), false);
            tcsa_agencyview.defineColumn("ente", typeof(string), false);
            tcsa_agencyview.defineColumn("description", typeof(string), false);
            tcsa_agencyview.defineColumn("idreg", typeof(int), false);
            tcsa_agencyview.defineColumn("registry", typeof(string));
            tcsa_agencyview.defineColumn("isinternal", typeof(string), false);
            tcsa_agencyview.defineColumn("flag", typeof(int));
            tcsa_agencyview.defineColumn("annualpayment", typeof(string), true, true);
            tcsa_agencyview.defineColumn("nobill", typeof(string), true, true);
            tcsa_agencyview.defineColumn("cu", typeof(string), false);
            tcsa_agencyview.defineColumn("ct", typeof(DateTime), false);
            tcsa_agencyview.defineColumn("lu", typeof(string), false);
            tcsa_agencyview.defineColumn("lt", typeof(DateTime), false);
            Tables.Add(tcsa_agencyview);
            tcsa_agencyview.defineKey("idcsa_agency");

            #endregion


            #region DataRelation creation
            this.defineRelation("csa_import_csa_importver", "csa_import", "csa_importver", "idcsa_import");
            this.defineRelation("csa_import_csa_importver_partition", "csa_import", "csa_importver_partition", "idcsa_import");
            var cPar   = new [] { bill_netti.Columns["ybill"], bill_netti.Columns["nbill"] };
            var cChild = new [] { csa_import.Columns["ybill_netti"], csa_import.Columns["nbill_netti"] };
            Relations.Add(new DataRelation("bill_netti_csa_import", cPar, cChild, false));

            cPar   = new [] { bill_versamenti.Columns["ybill"], bill_versamenti.Columns["nbill"] };
            cChild = new [] { csa_import.Columns["ybill_versamenti"], csa_import.Columns["nbill_versamenti"] };
            Relations.Add(new DataRelation("bill_versamenti_csa_import", cPar, cChild, false));

            this.defineRelation("csa_import_csa_bill", "csa_import", "csa_bill", "idcsa_import");
            this.defineRelation("registry_sospesi_csa_bill", "registry_sospesi", "csa_bill", "idreg");
            this.defineRelation("bill_csa_bill", "bill_ripartizione", "csa_bill", "nbill");
            #endregion
        }
 public static ActionResult RedirectToScaffold(this Controller controller, MetaTable table, string action, object values)
 {
     return(RedirectToScaffold(controller, table.Name, action, new RouteValueDictionary(values)));
 }
Example #28
0
 protected void Page_Init(object sender, EventArgs e)
 {
     table = DynamicDataRouteHandler.GetRequestMetaTable(Context);
     GridView1.SetMetaTable(table, table.GetColumnValuesFromRoute(Context));
     GridDataSource.EntityTypeFilter = table.EntityType.Name;
 }
 public static ActionResult RedirectToScaffold(this Controller controller, MetaTable table, string action)
 {
     return(RedirectToScaffold(controller, table.Name, action, (RouteValueDictionary)null));
 }
Example #30
0
		public static void SetRequestMetaTable (HttpContext httpContext, MetaTable table)
		{
			// And tradiationally... some .NET emulation code
			if (httpContext == null)
				throw new NullReferenceException ();

			GetOrCreateRouteContext (httpContext).Table = table;
		}
Example #31
0
        private static void _expandList(StringBuilder builder, ReadableTuple <int> tuple, string name, string level, string amount, DbAttribute attribute, string indent1, string indent2, string def, MetaTable <int> itemDb)
        {
            string value = tuple.GetValue <string>(attribute);

            if (value == def || value == "")
            {
                return;
            }

            string[] data = value.Split(':');
            int      k    = 1;

            if (data.Length == 1)
            {
                builder.Append(indent1);
                builder.Append(name);
                builder.Append(": ");
                builder.AppendLine(data[0]);
                return;
            }

            builder.Append(indent1);
            builder.Append(name);
            builder.AppendLine(":");

            if (attribute == ServerSkillAttributes.RequireItemCost)
            {
                for (int i = 0; i < data.Length; i += 2)
                {
                    builder.Append(level);
                    builder.Append(": ");
                    builder.AppendLine(DbIOUtils.Id2Name(itemDb, ServerItemAttributes.AegisName, data[i]));

                    if (i + 1 < data.Length)
                    {
                        builder.Append(indent2);
                        builder.Append(amount);
                        builder.Append(": ");
                        builder.AppendLine(data[i + 1]);
                    }
                    else
                    {
                        builder.Append(indent2);
                        builder.Append(amount);
                        builder.AppendLine(": 0");
                    }
                }

                return;
            }

            foreach (var field in data)
            {
                if (field == "")
                {
                    k++;
                    continue;
                }

                builder.Append(level);
                builder.Append(": ");
                builder.AppendLine(k.ToString(CultureInfo.InvariantCulture));
                k++;

                builder.Append(indent2);
                builder.Append(amount);
                builder.Append(": ");
                builder.AppendLine(field);
            }
        }
Example #32
0
		protected virtual string GetScaffoldPageVirtualPath (MetaTable table, string viewName)
		{
			// No such checks are made in .NET, we won't follow the pattern...
			MetaModel model = Model;
			if (table == null || model == null)
				throw new NullReferenceException (); // yuck

			// Believe it or not, this is what .NET does - pass a null/empty viewName
			// and you get /.aspx at the end...
			return model.DynamicDataFolderVirtualPath + "PageTemplates/" + viewName + ".aspx";
		}
 public MetaTableSchema(MetaTable tableInfo, IList<TableFieldSchema> fields)
 {
     this.TableInfo = tableInfo;
     this.Fields = fields;
 }
Example #34
0
        public static void WriteEntryYaml(StringBuilder builder, ReadableTuple <int> tuple, MetaTable <int> itemDb)
        {
            if (tuple != null)
            {
                int    value;
                bool   valueB;
                string valueS;

                builder.AppendLine("  - Id: " + tuple.GetKey <int>().ToString(CultureInfo.InvariantCulture));

                if ((valueS = tuple.GetValue <string>(ServerSkillAttributes.Name)) != "")
                {
                    builder.AppendLine("    Name: " + DbIOUtils.QuoteCheck(valueS));
                }

                if ((valueS = tuple.GetValue <string>(ServerSkillAttributes.Desc)) != "")
                {
                    builder.AppendLine("    Description: " + DbIOUtils.QuoteCheck(valueS));
                }

                builder.AppendLine("    MaxLevel: " + tuple.GetValue <int>(ServerSkillAttributes.MaxLevel));

                if ((value = tuple.GetValue <int>(ServerSkillAttributes.AttackType)) != 0)
                {
                    builder.AppendLine("    Type: " + Constants.ToString <AttackTypeType>(value));
                }

                if ((value = tuple.GetValue <int>(ServerSkillAttributes.SkillTargetType)) != 0)
                {
                    builder.AppendLine("    TargetType: " + Constants.ToString <SkillTargetType>(value));
                }

                DbIOUtils.ExpandFlag <SkillDamageType>(builder, tuple, "DamageFlags", ServerSkillAttributes.DamageFlags, YamlParser.Indent4, YamlParser.Indent6);
                DbIOUtils.ExpandFlag <SkillType2TypeNew>(builder, tuple, "Flags", ServerSkillAttributes.Inf2New, YamlParser.Indent4, YamlParser.Indent6);

                _expandList(builder, tuple, "Range", "      - Level", "Size", ServerSkillAttributes.Range, YamlParser.Indent4, YamlParser.Indent8, "0", itemDb);

                if ((value = tuple.GetValue <int>(ServerSkillAttributes.HitMode)) != 0)
                {
                    builder.AppendLine("    Hit: " + Constants.ToString <HitType>(value));
                }

                _expandList(builder, tuple, "HitCount", "      - Level", "Count", ServerSkillAttributes.HitCount, YamlParser.Indent4, YamlParser.Indent8, "0", itemDb);
                _expandList(builder, tuple, "Element", "      - Level", "Element", ServerSkillAttributes.SkillElement, YamlParser.Indent4, YamlParser.Indent8, "Neutral", itemDb);
                _expandList(builder, tuple, "SplashArea", "      - Level", "Area", ServerSkillAttributes.SplashArea, YamlParser.Indent4, YamlParser.Indent8, "0", itemDb);
                _expandList(builder, tuple, "ActiveInstance", "      - Level", "Max", ServerSkillAttributes.ActiveInstance, YamlParser.Indent4, YamlParser.Indent8, "0", itemDb);
                _expandList(builder, tuple, "Knockback", "      - Level", "Amount", ServerSkillAttributes.Knockback, YamlParser.Indent4, YamlParser.Indent8, "0", itemDb);

                if (tuple.GetValue <int>(ServerSkillAttributes.CopyFlags) > 0 || tuple.GetValue <int>(ServerSkillAttributes.CopyFlagsRemovedRequirement) > 0)
                {
                    builder.AppendLine("    CopyFlags:");

                    DbIOUtils.ExpandFlag <SkillCopyType>(builder, tuple, "Skill", ServerSkillAttributes.CopyFlags, YamlParser.Indent6, YamlParser.Indent8);
                    DbIOUtils.ExpandFlag <SkillCopyRemoveRequirementType>(builder, tuple, "RemoveRequirement", ServerSkillAttributes.CopyFlagsRemovedRequirement, YamlParser.Indent6, YamlParser.Indent8);
                }

                if (tuple.GetValue <int>(ServerSkillAttributes.NoNearNPCRange) > 0 || tuple.GetValue <int>(ServerSkillAttributes.NoNearNPCType) > 0)
                {
                    builder.AppendLine("    NoNearNPC:");

                    if ((value = tuple.GetValue <int>(ServerSkillAttributes.NoNearNPCRange)) != 0)
                    {
                        builder.AppendLine("      AdditionalRange: " + value);
                    }

                    DbIOUtils.ExpandFlag <NoNearNpcType>(builder, tuple, "Type", ServerSkillAttributes.NoNearNPCType, YamlParser.Indent6, YamlParser.Indent8);
                }

                if ((valueB = tuple.GetValue <bool>(ServerSkillAttributes.CastInterrupt)) != false)
                {
                    builder.AppendLine("    CastCancel: " + (valueB ? "true" : "false"));
                }

                if ((value = tuple.GetValue <int>(ServerSkillAttributes.CastDefenseReduction)) != 0)
                {
                    builder.AppendLine("    CastDefenseReduction: " + value);
                }

                _expandList(builder, tuple, "CastTime", "      - Level", "Time", ServerSkillAttributes.CastingTime, YamlParser.Indent4, YamlParser.Indent8, "0", itemDb);
                _expandList(builder, tuple, "AfterCastActDelay", "      - Level", "Time", ServerSkillAttributes.AfterCastActDelay, YamlParser.Indent4, YamlParser.Indent8, "0", itemDb);
                _expandList(builder, tuple, "AfterCastWalkDelay", "      - Level", "Time", ServerSkillAttributes.AfterCastWalkDelay, YamlParser.Indent4, YamlParser.Indent8, "0", itemDb);
                _expandList(builder, tuple, "Duration1", "      - Level", "Time", ServerSkillAttributes.Duration1, YamlParser.Indent4, YamlParser.Indent8, "0", itemDb);
                _expandList(builder, tuple, "Duration2", "      - Level", "Time", ServerSkillAttributes.Duration2, YamlParser.Indent4, YamlParser.Indent8, "0", itemDb);
                _expandList(builder, tuple, "Cooldown", "      - Level", "Time", ServerSkillAttributes.Cooldown, YamlParser.Indent4, YamlParser.Indent8, "0", itemDb);
                _expandList(builder, tuple, "FixedCastTime", "      - Level", "Time", ServerSkillAttributes.FixedCastTime, YamlParser.Indent4, YamlParser.Indent8, "0", itemDb);
                DbIOUtils.ExpandFlag <CastingFlags>(builder, tuple, "CastTimeFlags", ServerSkillAttributes.CastTimeFlags, YamlParser.Indent4, YamlParser.Indent6);
                DbIOUtils.ExpandFlag <CastingFlags>(builder, tuple, "CastDelayFlags", ServerSkillAttributes.CastDelayFlags, YamlParser.Indent4, YamlParser.Indent6);

                StringBuilder require = new StringBuilder();
                _expandList(require, tuple, "HpCost", "        - Level", "Amount", ServerSkillAttributes.RequireHpCost, YamlParser.Indent6, YamlParser.Indent10, "0", itemDb);
                _expandList(require, tuple, "SpCost", "        - Level", "Amount", ServerSkillAttributes.RequireSpCost, YamlParser.Indent6, YamlParser.Indent10, "0", itemDb);
                _expandList(require, tuple, "HpRateCost", "        - Level", "Amount", ServerSkillAttributes.RequireHpRateCost, YamlParser.Indent6, YamlParser.Indent10, "0", itemDb);
                _expandList(require, tuple, "SpRateCost", "        - Level", "Amount", ServerSkillAttributes.RequireSpRateCost, YamlParser.Indent6, YamlParser.Indent10, "0", itemDb);
                _expandList(require, tuple, "MaxHpTrigger", "        - Level", "Amount", ServerSkillAttributes.RequireMaxHpTrigger, YamlParser.Indent6, YamlParser.Indent10, "0", itemDb);
                _expandList(require, tuple, "ZenyCost", "        - Level", "Amount", ServerSkillAttributes.RequireZenyCost, YamlParser.Indent6, YamlParser.Indent10, "0", itemDb);

                value = tuple.GetValue <int>(ServerSkillAttributes.RequireWeapons);

                if (value != 0xFFFFFF)
                {
                    DbIOUtils.ExpandFlag <WeaponType>(require, tuple, "Weapon", ServerSkillAttributes.RequireWeapons, YamlParser.Indent6, YamlParser.Indent8);
                }

                DbIOUtils.ExpandFlag <AmmoType>(require, tuple, "Ammo", ServerSkillAttributes.RequireAmmoTypes, YamlParser.Indent6, YamlParser.Indent8);
                _expandList(require, tuple, "AmmoAmount", "        - Level", "Amount", ServerSkillAttributes.RequireAmmoAmount, YamlParser.Indent6, YamlParser.Indent10, "0", itemDb);

                if ((value = tuple.GetValue <int>(ServerSkillAttributes.RequireState)) > 0)
                {
                    valueS = "";

                    switch ((RequiredStateTypeNew)value)
                    {
                    case RequiredStateTypeNew.Hidden:
                        valueS = "Hidden";
                        break;

                    case RequiredStateTypeNew.Riding:
                        valueS = "Riding";
                        break;

                    case RequiredStateTypeNew.Falcon:
                        valueS = "Falcon";
                        break;

                    case RequiredStateTypeNew.Cart:
                        valueS = "Cart";
                        break;

                    case RequiredStateTypeNew.Shield:
                        valueS = "Shield";
                        break;

                    case RequiredStateTypeNew.RecoverWeightRate:
                        valueS = "Recover_Weight_Rate";
                        break;

                    case RequiredStateTypeNew.MoveEnable:
                        valueS = "Move_Enable";
                        break;

                    case RequiredStateTypeNew.Water:
                        valueS = "Water";
                        break;

                    case RequiredStateTypeNew.RidingDragon:
                        valueS = "Ridingdragon";
                        break;

                    case RequiredStateTypeNew.Warg:
                        valueS = "Wug";
                        break;

                    case RequiredStateTypeNew.Ridingwarg:
                        valueS = "Ridingwug";
                        break;

                    case RequiredStateTypeNew.Mado:
                        valueS = "Mado";
                        break;

                    case RequiredStateTypeNew.Elementalspirit:
                        valueS = "Elementalspirit";
                        break;

                    case RequiredStateTypeNew.Elementalspirit2:
                        valueS = "Elementalspirit2";
                        break;

                    case RequiredStateTypeNew.RidingPeco:
                        valueS = "Peco";
                        break;

                    case RequiredStateTypeNew.SunStance:
                        valueS = "Sunstance";
                        break;

                    case RequiredStateTypeNew.MoonStance:
                        valueS = "Moonstance";
                        break;

                    case RequiredStateTypeNew.StarsStance:
                        valueS = "Starstance";
                        break;

                    case RequiredStateTypeNew.UniverseStance:
                        valueS = "Universestance";
                        break;

                    default:
                        valueS = "";
                        break;
                    }

                    require.Append("      State: ");
                    require.AppendLine(valueS);
                }

                if ((valueS = tuple.GetValue <string>(ServerSkillAttributes.RequireStatuses)) != "" && valueS != "0")
                {
                    var data = valueS.Split(':');

                    if (data.Length > 0)
                    {
                        require.AppendLine("      Status:");

                        foreach (var da in data)
                        {
                            require.Append("        ");
                            require.Append(da);
                            require.AppendLine(": true");
                        }
                    }
                }

                //_DbIOUtils.ExpandFlag<AmmoType>(require, tuple, "Status", ServerSkillAttributes.RequireStatuses, YamlParser2.Indent6, YamlParser2.Indent8);
                _expandList(require, tuple, "SpiritSphereCost", "        - Level", "Amount", ServerSkillAttributes.RequireSpiritSphereCost, YamlParser.Indent6, YamlParser.Indent10, "0", itemDb);
                _expandList(require, tuple, "ItemCost", "        - Item", "Amount", ServerSkillAttributes.RequireItemCost, YamlParser.Indent6, YamlParser.Indent10, "0", itemDb);

                if ((valueS = tuple.GetValue <string>(ServerSkillAttributes.RequiredEquipment)) != "" && valueS != "0")
                {
                    var data = valueS.Split(':');

                    require.AppendLine("      Equipment:");

                    foreach (var item in data)
                    {
                        require.Append("        ");
                        require.Append(DbIOUtils.Id2Name(itemDb, ServerItemAttributes.AegisName, item));
                        require.AppendLine(": true");
                    }
                }
                //_expandList(require, tuple, "Equipment", "", "", ServerSkillAttributes.RequiredEquipment, YamlParser2.Indent6, YamlParser2.Indent8, "", itemDb);

                string requireData = require.ToString();

                if (requireData != "")
                {
                    builder.AppendLine("    Requires:");
                    builder.Append(requireData);
                }

                StringBuilder unit = new StringBuilder();

                if ((valueS = tuple.GetValue <string>(ServerSkillAttributes.UnitId)) != "" && valueS != "0")
                {
                    unit.Append("      Id: ");
                    unit.AppendLine(valueS);
                }

                if ((valueS = tuple.GetValue <string>(ServerSkillAttributes.UnitAlternateId)) != "" && valueS != "0")
                {
                    unit.Append("      AlternateId: ");
                    unit.AppendLine(valueS);
                }

                _expandList(unit, tuple, "Layout", "        - Level", "Size", ServerSkillAttributes.UnitLayout, YamlParser.Indent6, YamlParser.Indent10, "0", itemDb);
                _expandList(unit, tuple, "Range", "        - Level", "Size", ServerSkillAttributes.UnitRange, YamlParser.Indent6, YamlParser.Indent10, "0", itemDb);

                if ((value = tuple.GetValue <int>(ServerSkillAttributes.UnitInterval)) != 0)
                {
                    unit.Append("      Interval: ");
                    unit.AppendLine(value.ToString(CultureInfo.InvariantCulture));
                }

                if ((value = tuple.GetValue <int>(ServerSkillAttributes.UnitTarget)) != 0x3F0000)
                {
                    unit.Append("      Target: ");

                    var flag = FlagsManager.GetFlag <UnitTargetType>();
                    valueS = flag.Value2Name[value];
                    unit.AppendLine(valueS);
                }

                DbIOUtils.ExpandFlag <UnitFlagType>(unit, tuple, "Flag", ServerSkillAttributes.UnitFlag, YamlParser.Indent6, YamlParser.Indent8);

                string unitData = unit.ToString();

                if (unitData != "")
                {
                    builder.AppendLine("    Unit:");
                    builder.Append(unit);
                }
            }
        }
Example #35
0
 public Dictionary <string, Models.SysTableDetailView> GetMetaTable()
 {
     return(MetaTable.OrderBy(m => m.GridViewOrder).ToDictionary(m => m.ColumnName));
 }
Example #36
0
 public static string GetTableSchema(string datasetId, string tableId)
 {
     var context = Account.GetContext();
     var meta = new MetaTable(context.ProjectId, datasetId, tableId);
     return meta.GetTableSchema(context.BigQueryService).BuildCSharpClass();
 }
Example #37
0
        protected void CheckBoxList1_DataBound(object sender, EventArgs e)
        {
            MetaTable childTable = ChildrenColumn.ChildTable;

            // Comments assume employee/territory for illustration, but the code is generic

            IList         entityList    = null;
            ObjectContext objectContext = null;

            if (Mode == DataBoundControlMode.Edit)
            {
                object entity;
                ICustomTypeDescriptor rowDescriptor = Row as ICustomTypeDescriptor;
                if (rowDescriptor != null)
                {
                    // Get the real entity from the wrapper
                    entity = rowDescriptor.GetPropertyOwner(null);
                }
                else
                {
                    entity = Row;
                }

                // Get the collection of territories for this employee and make sure it's loaded
                RelatedEnd entityCollection = Column.EntityTypeProperty.GetValue(entity, null) as RelatedEnd;
                if (entityCollection == null)
                {
                    throw new InvalidOperationException(String.Format("The ManyToMany template does not support the collection type of the '{0}' column on the '{1}' table.", Column.Name, Table.Name));
                }
                if (!entityCollection.IsLoaded)
                {
                    entityCollection.Load();
                }

                // Get an IList from it (i.e. the list of territories for the current employee)
                entityList = ((IListSource)entityCollection).GetList();

                // Get the current ObjectContext
                ObjectQuery objectQuery = (ObjectQuery)entityCollection.GetType().GetMethod(
                    "CreateSourceQuery").Invoke(entityCollection, null);
                objectContext = objectQuery.Context;
            }

            // Go through all the territories (not just those for this employee)
            foreach (object childEntity in childTable.GetQuery(objectContext))
            {
                MetaTable actualTable = MetaTable.GetTable(childEntity.GetType());
                // Create a checkbox for it
                ListItem listItem = new ListItem(
                    actualTable.GetDisplayString(childEntity),
                    actualTable.GetPrimaryKeyString(childEntity));

                // Make it selected if the current employee has that territory
                if (Mode == DataBoundControlMode.Edit)
                {
                    listItem.Selected = entityList.Contains(childEntity);
                }

                CheckBoxList1.Items.Add(listItem);
            }
        }
Example #38
0
        /// <summary>
        /// Get a metatable from MySql catalog
        /// </summary>
        /// <param name="tableName">schema.table</param>
        /// <returns></returns>

        public static MetaTable GetMetaTableFromDatabaseDictionary(
            DbConnectionMx conn,
            string schema,
            string tableName)
        {
            int t0 = TimeOfDay.Milliseconds();

            MetaTable mt = new MetaTable();

            mt.MetaBrokerType = MetaBrokerType.Generic;
            mt.Name           = tableName;
            mt.Label          = MetaTable.IdToLabel(tableName);
            mt.TableMap       = schema + "." + tableName;

            List <DbColumnMetadata> cmdList = GetTableMetadataFromMySqlDictionary(conn, schema, tableName);

            for (int ci = 0; ci < cmdList.Count; ci++)
            {
                DbColumnMetadata cmd = cmdList[ci];

                MetaColumn mc = new MetaColumn();
                mc.Name      = cmd.Name;
                mc.ColumnMap = mc.Name;
                mc.Label     = MetaTable.IdToLabel(cmd.Name);

                if (Lex.Contains(cmd.Type, "CHAR") ||
                    Lex.Contains(cmd.Type, "TEXT"))
                {
                    mc.DataType = MetaColumnType.String;
                }

                else if (Lex.Contains(cmd.Type, "INT") ||
                         Lex.Contains(cmd.Type, "ENUM"))
                {
                    mc.DataType = MetaColumnType.Integer;
                }

                else if (cmd.Type == "FLOAT" ||
                         cmd.Type == "REAL" ||
                         cmd.Type == "DOUBLE" ||
                         cmd.Type == "DECIMAL" ||
                         cmd.Type == "NUMERIC")
                {
                    mc.DataType = MetaColumnType.Number;
                    mc.Format   = ColumnFormatEnum.Decimal;
                    mc.Decimals = cmd.Scale;
                }

                else if (cmd.Type == "DATE" ||
                         cmd.Type == "DATETIME" ||
                         cmd.Type == "TIMESTAMP")
                {
                    mc.DataType = MetaColumnType.Date;
                }

                else
                {
                    continue;                  // unrecognized
                }
                mc.InitialSelection = ColumnSelectionEnum.Selected;
                mc.Width            = 12;
                mc.MetaTable        = mt;
                mc.Description      = cmd.Comment;

                mt.AddMetaColumn(mc);
            }

            t0 = TimeOfDay.Milliseconds() - t0;
            return(mt);
        }
        void helperButton_Click(object sender, EventArgs e)
        {
            try
            {
                Cursor.Current = Cursors.WaitCursor;
                if (sender is ToolStripItem)
                {
                    Keys key = (Keys)((ToolStripItem)sender).Tag;

                    if (SelectedEntity is MetaSource)
                    {
                        if (key == Keys.F7)
                        {
                            MetaSource source = ((MetaSource)SelectedEntity);
                            source.Connection.CheckConnection();
                            source.Information = source.Connection.Information;
                            source.Error       = source.Connection.Error;
                            source.InitEditor();
                        }
                        if (key == Keys.F8 || key == Keys.F12)
                        {
                            MetaTable table = ((MetaSource)SelectedEntity).MetaData.MasterTable;
                            if (table != null)
                            {
                                TreeViewHelper.SelectNode(MainTreeView, MainTreeView.SelectedNode.Nodes, table);
                                EditProperty(table.IsSQL ? "SQL Statement" : "Default Load Script");
                            }
                        }
                    }
                    else if (SelectedEntity is MetaConnection)
                    {
                        if (key == Keys.F7)
                        {
                            ((MetaConnection)SelectedEntity).CheckConnection();
                        }
                    }
                    else if (SelectedEntity is MetaTable)
                    {
                        if (key == Keys.F7)
                        {
                            ((MetaTable)SelectedEntity).CheckTable(null);
                        }
                        if (key == Keys.F8)
                        {
                            if (((MetaTable)SelectedEntity).IsSQL)
                            {
                                EditProperty("SQL Statement");
                            }
                            else
                            {
                                EditProperty("Definition Script");
                            }
                        }
                        if (key == Keys.F9 && ((MetaTable)SelectedEntity).DynamicColumns)
                        {
                            ((MetaTable)SelectedEntity).Refresh();
                            if (EntityHandler != null)
                            {
                                EntityHandler.SetModified();
                                EntityHandler.InitEntity(SelectedEntity);
                            }
                        }
                        if (key == Keys.F12)
                        {
                            EditProperty("Default Load Script");
                        }
                    }
                    else if (SelectedEntity is MetaColumn)
                    {
                        if (key == Keys.F7)
                        {
                            EditProperty("Check column SQL syntax");
                        }
                        if (key == Keys.F8)
                        {
                            EditProperty("Show column values");
                        }
                    }
                    else if (SelectedEntity is MetaEnum)
                    {
                        if (key == Keys.F8)
                        {
                            EditProperty("Select SQL Statement");
                        }
                        if (key == Keys.F9)
                        {
                            if (EntityHandler != null)
                            {
                                EntityHandler.SetModified();
                            }
                            ((MetaEnum)SelectedEntity).RefreshEnum();
                        }
                    }
                    else if (SelectedEntity is MetaJoin)
                    {
                        if (key == Keys.F7)
                        {
                            ((MetaJoin)SelectedEntity).CheckJoin();
                        }
                        if (key == Keys.F8)
                        {
                            EditProperty("SQL Clause");
                        }
                    }
                    else if (SelectedEntity is TasksFolder)
                    {
                        if (key == Keys.F7)
                        {
                            EditProperty("Common Scripts");
                        }
                        if (key == Keys.F8)
                        {
                            EditProperty("Tasks Script");
                        }
                    }
                    else if (SelectedEntity is ReportTask)
                    {
                        if (key == Keys.F7)
                        {
                            EditProperty("Script");
                        }
                        if (key == Keys.F8)
                        {
                            EditProperty("SQL Statement");
                        }
                    }
                    else if (SelectedEntity is ReportModel)
                    {
                        if (key == Keys.F7 || key == Keys.F8)
                        {
                            var frm = new SQLEditorForm();
                            frm.Instance     = SelectedEntity;
                            frm.PropertyName = "";

                            ReportModel model = SelectedEntity as ReportModel;
                            model.Report.CheckingExecution = true;
                            try
                            {
                                model.BuildSQL();
                                frm.SqlToCheck = model.Sql;
                                model.Report.CheckingExecution = false;
                                model.BuildSQL();
                            }
                            finally
                            {
                                model.Report.CheckingExecution = false;
                            }
                            if (!string.IsNullOrEmpty(model.ExecutionError))
                            {
                                throw new Exception("Error building the SQL Statement...\r\nPlease fix these errors first.\r\n" + model.ExecutionError);
                            }
                            frm.sqlTextBox.Text = model.Sql;
                            frm.SetReadOnly();
                            if (key == Keys.F8)
                            {
                                frm.checkSQL();
                            }
                            frm.ShowDialog();
                        }
                    }
                    else if (SelectedEntity is ReportView)
                    {
                        if (key == Keys.F7)
                        {
                            EditProperty("General Parameters");
                        }
                        else if (key == Keys.F8)
                        {
                            EditProperty("CSS");
                        }
                        else if (key == Keys.F9)
                        {
                            EditProperty("Data Table Configuration");
                        }
                        else if (key == Keys.F12)
                        {
                            EditProperty("NVD3 Chart Configuration");
                        }
                    }
                    else if (SelectedEntity is ReportSchedule)
                    {
                        if (key == Keys.F8)
                        {
                            EditProperty("Edit schedule properties");
                        }
                        if (key == Keys.F9)
                        {
                            EditProperty("Run Task Scheduler MMC");
                        }
                    }
                }
            }
            finally
            {
                Cursor.Current = Cursors.Default;
            }
        }
Example #40
0
        /// <summary>
        ///     Creates a new Prexonite virtual machine.
        /// </summary>
        public Engine()
        {
            //Thread local storage for stack
            _stackSlot = Thread.AllocateDataSlot();

            //Metatable
            _meta = MetaTable.Create();

            //PTypes
            _pTypeMap = new Dictionary<Type, PType>();
            _ptypemapiterator = new PTypeMapIterator(this);
            //int
            PTypeMap[typeof (int)] = PType.Int;
            PTypeMap[typeof (long)] = PType.Int;
            PTypeMap[typeof (short)] = PType.Int;
            PTypeMap[typeof (byte)] = PType.Int;

#if UseNonCTSIntegers
            PTypeMap[typeof(uint)]      = IntPType.Instance;
            PTypeMap[typeof(ulong)]     = IntPType.Instance;
            PTypeMap[typeof(ushort)]    = IntPType.Instance;
            PTypeMap[typeof(sbyte)]     = IntPType.Instance;
#endif

            //char
            PTypeMap[typeof (char)] = PType.Char;

            //bool
            PTypeMap[typeof (bool)] = PType.Bool;

            //real
            PTypeMap[typeof (float)] = PType.Real;
            PTypeMap[typeof (double)] = PType.Real;

            //string
            PTypeMap[typeof (string)] = PType.String;

            PTypeMap[typeof (List<PValue>)] = PType.List;
            PTypeMap[typeof (PValue[])] = PType.List;
            PTypeMap[typeof (PValueHashtable)] = PType.Hash;

            //Registry
            _pTypeRegistry = new SymbolTable<Type>();
            _pTypeRegistryIterator = new PTypeRegistryIterator(this);
            PTypeRegistry[IntPType.Literal] = typeof (IntPType);
            PTypeRegistry[BoolPType.Literal] = typeof (BoolPType);
            PTypeRegistry[RealPType.Literal] = typeof (RealPType);
            PTypeRegistry[CharPType.Literal] = typeof (CharPType);
            PTypeRegistry[StringPType.Literal] = typeof (StringPType);
            PTypeRegistry[NullPType.Literal] = typeof (NullPType);
            PTypeRegistry[ObjectPType.Literal] = typeof (ObjectPType);
            PTypeRegistry[ListPType.Literal] = typeof (ListPType);
            PTypeRegistry[StructurePType.Literal] = typeof (StructurePType);
            PTypeRegistry[HashPType.Literal] = typeof (HashPType);
            PTypeRegistry[StructurePType.Literal] = typeof (StructurePType);

            //Assembly registry
            _registeredAssemblies = new List<Assembly>();
            foreach (
                var assName in Assembly.GetExecutingAssembly().GetReferencedAssemblies())
                _registeredAssemblies.Add(Assembly.Load(assName.FullName));

            //Commands
            _commandTable = new CommandTable();
            PCommand cmd;

            Commands.AddEngineCommand(PrintAlias, ConsolePrint.Instance);

            Commands.AddEngineCommand(PrintLineAlias, ConsolePrintLine.Instance);

            Commands.AddEngineCommand(MetaAlias, Prexonite.Commands.Core.Meta.Instance);

            Commands.AddEngineCommand(BoxedAlias, Boxed.Instance);

            // The concatenate command has been renamed to `string_concat` for Prexonite 2
            Commands.AddEngineCommand(ConcatenateAlias, Concat.Instance);
            Commands.AddEngineCommand(OldConcatenateAlias, Concat.Instance);

            Commands.AddEngineCommand(MapAlias, cmd = Map.Instance);
            Commands.AddEngineCommand(SelectAlias, cmd);

            Commands.AddEngineCommand(FoldLAlias, FoldL.Instance);

            Commands.AddEngineCommand(FoldRAlias, FoldR.Instance);

            Commands.AddEngineCommand(DisposeAlias, Dispose.Instance);

            // There is a macro that uses the same alias (CallAlias)
            //  it has the same purpose. For backwards compatibility,
            //  the command table will retain the old binding.
            Commands.AddEngineCommand(CallAlias, Call.Instance);
            Commands.AddEngineCommand(Call.Alias, Call.Instance);

            Commands.AddEngineCommand(ThunkAlias, ThunkCommand.Instance);
            Commands.AddEngineCommand(AsThunkAlias, AsThunkCommand.Instance);
            Commands.AddEngineCommand(ForceAlias, ForceCommand.Instance);
            Commands.AddEngineCommand(ToSeqAlias, ToSeqCommand.Instance);

            // There is a macro that uses the same alias (Call_MemberAlias)
            //  it has the same purpose. For backwards compatibility,
            //  the command table will retain the old binding.
            Commands.AddEngineCommand(Call_MemberAlias, Call_Member.Instance);
            Commands.AddEngineCommand(Call_Member.Alias, Call_Member.Instance);

            Commands.AddEngineCommand(CallerAlias, Caller.Instance);

            Commands.AddEngineCommand(PairAlias, Pair.Instance);

            Commands.AddEngineCommand(UnbindAlias, Unbind.Instance);

            Commands.AddEngineCommand(SortAlias, Sort.Instance);
            Commands.AddEngineCommand(SortAlternativeAlias, Sort.Instance);

            Commands.AddEngineCommand(LoadAssemblyAlias, LoadAssembly.Instance);

            Commands.AddEngineCommand(DebugAlias, new Debug());

            Commands.AddEngineCommand(SetCenterAlias, SetCenterCommand.Instance);

            Commands.AddEngineCommand(SetLeftAlias, SetLeftCommand.Instance);

            Commands.AddEngineCommand(SetRightAlias, SetRightCommand.Instance);

            Commands.AddEngineCommand(AllAlias, All.Instance);

            Commands.AddEngineCommand(WhereAlias, Where.Instance);

            Commands.AddEngineCommand(SkipAlias, Skip.Instance);

            Commands.AddEngineCommand(LimitAlias, cmd = Limit.Instance);
            Commands.AddEngineCommand(TakeAlias, cmd);

            Commands.AddEngineCommand(AbsAlias, Abs.Instance);

            Commands.AddEngineCommand(CeilingAlias, Ceiling.Instance);

            Commands.AddEngineCommand(ExpAlias, Exp.Instance);

            Commands.AddEngineCommand(FloorAlias, Floor.Instance);

            Commands.AddEngineCommand(LogAlias, Log.Instance);

            Commands.AddEngineCommand(MaxAlias, Max.Instance);

            Commands.AddEngineCommand(MinAlias, Min.Instance);

            Commands.AddEngineCommand(PiAlias, Pi.Instance);

            Commands.AddEngineCommand(RoundAlias, Round.Instance);

            Commands.AddEngineCommand(SinAlias, Sin.Instance);
            Commands.AddEngineCommand(CosAlias, Cos.Instance);

            Commands.AddEngineCommand(SqrtAlias, Sqrt.Instance);

            Commands.AddEngineCommand(TanAlias, Tan.Instance);

            Commands.AddEngineCommand(CharAlias, Char.Instance);

            Commands.AddEngineCommand(CountAlias, Count.Instance);

            Commands.AddEngineCommand(DistinctAlias, cmd = new Distinct());
            Commands.AddEngineCommand(UnionAlias, cmd);
            Commands.AddEngineCommand(UniqueAlias, cmd);

            Commands.AddEngineCommand(FrequencyAlias, new Frequency());

            Commands.AddEngineCommand(GroupByAlias, new GroupBy());

            Commands.AddEngineCommand(IntersectAlias, new Intersect());

            // There is a macro that uses the same alias (Call_TailAlias)
            //  it has the same purpose. For backwards compatibility,
            //  the command table will retain the old binding.
            Commands.AddEngineCommand(Call_TailAlias, Call_Tail.Instance);
            Commands.AddEngineCommand(Call_Tail.Alias, Call_Tail.Instance);

            Commands.AddEngineCommand(ListAlias, List.Instance);

            Commands.AddEngineCommand(EachAlias, Each.Instance);

            Commands.AddEngineCommand(ExistsAlias, new Exists());

            Commands.AddEngineCommand(ForAllAlias, new ForAll());

            Commands.AddEngineCommand(CompileToCilAlias, CompileToCil.Instance);

            Commands.AddEngineCommand(TakeWhileAlias, TakeWhile.Instance);

            Commands.AddEngineCommand(ExceptAlias, Except.Instance);

            Commands.AddEngineCommand(RangeAlias, Range.Instance);

            Commands.AddEngineCommand(ReverseAlias, Reverse.Instance);

            Commands.AddEngineCommand(HeadTailAlias, HeadTail.Instance);

            Commands.AddEngineCommand(AppendAlias, Append.Instance);

            Commands.AddEngineCommand(SumAlias, Sum.Instance);

            Commands.AddEngineCommand(Contains.Alias, Contains.Instance);

            Commands.AddEngineCommand(ChanAlias, Chan.Instance);

            Commands.AddEngineCommand(SelectAlias, Select.Instance);

            Commands.AddEngineCommand(Call_AsyncAlias, CallAsync.Instance);
            Commands.AddEngineCommand(CallAsync.Alias, CallAsync.Instance);

            Commands.AddEngineCommand(AsyncSeqAlias, AsyncSeq.Instance);

            Commands.AddEngineCommand(CallSubPerformAlias, CallSubPerform.Instance);

            Commands.AddEngineCommand(PartialCallAlias, new PartialCallCommand());

            Commands.AddEngineCommand(PartialMemberCallAlias, PartialMemberCallCommand.Instance);

            Commands.AddEngineCommand(PartialConstructionAlias, PartialConstructionCommand.Instance);

            Commands.AddEngineCommand(PartialTypeCheckAlias, PartialTypeCheckCommand.Instance);
            Commands.AddEngineCommand(PartialTypeCastAlias, PartialTypecastCommand.Instance);
            Commands.AddEngineCommand(PartialStaticCallAlias, PartialStaticCallCommand.Instance);
            Commands.AddEngineCommand(FunctionalPartialCallCommand.Alias,
                FunctionalPartialCallCommand.Instance);
            Commands.AddEngineCommand(FlippedFunctionalPartialCallCommand.Alias,
                FlippedFunctionalPartialCallCommand.Instance);
            Commands.AddEngineCommand(PartialCallStarImplCommand.Alias,
                PartialCallStarImplCommand.Instance);

            Commands.AddEngineCommand(ThenAlias, ThenCommand.Instance);

            Commands.AddEngineCommand(Id.Alias, Id.Instance);
            Commands.AddEngineCommand(Const.Alias, Const.Instance);

            OperatorCommands.AddToEngine(this);

            Commands.AddEngineCommand(CreateEnumerator.Alias, CreateEnumerator.Instance);

            Commands.AddEngineCommand(CreateModuleName.Alias, CreateModuleName.Instance);

            Commands.AddEngineCommand(GetUnscopedAstFactory.Alias, GetUnscopedAstFactory.Instance);

            Commands.AddEngineCommand(CreateSourcePosition.Alias, CreateSourcePosition.Instance);

            Commands.AddEngineCommand(SeqConcat.Alias, SeqConcat.Instance);
        }
Example #41
0
        public void CreateTable(MetaTable metaTable)
        {
            string createTableCommand = MySqlBuilder.GetCreateTableCommand(metaTable);

            Execute(Connection, Transaction, createTableCommand);
        }