Beispiel #1
0
        private void OrderViewAndColumns(Dictionary <string, object> transformResult)
        {
            ArrayList tables = (ArrayList)transformResult["tables"];
            Dictionary <string, object> tableColumns = (Dictionary <string, object>)transformResult["columns"];

            ConfigAccess ca = new ConfigAccess();

            Durados.View viewView  = map.GetConfigDatabase().Views["View"];
            Durados.View fieldView = map.GetConfigDatabase().Views["Field"];

            for (int i = 0; i < tables.Count; i++)
            {
                string       viewJsonName = tables[i].ToString();
                Durados.View view         = Map.Database.GetViewByJsonName(viewJsonName);
                string       viewName     = view.Name;

                string vpk = ca.GetViewPK(viewJsonName, Map.GetConfigDatabase().ConnectionString);
                viewView.Edit(new Dictionary <string, object>()
                {
                    { "Order", 10000 + i * 10 }
                }, vpk, view_BeforeEdit, view_BeforeEditInDatabase, view_AfterEditBeforeCommit, view_AfterEditAfterCommit);

                ArrayList columns = (ArrayList)tableColumns[viewJsonName];

                for (int j = 0; j < columns.Count; j++)
                {
                    string columnName = columns[j].ToString();
                    Field  field      = view.GetFieldByColumnNames(columnName);
                    if (field != null)
                    {
                        string fieldName = field.Name;

                        string fpk = ca.GetFieldPK(viewName, fieldName, Map.GetConfigDatabase().ConnectionString);
                        fieldView.Edit(new Dictionary <string, object>()
                        {
                            { "Order", 500 + j * 10 }
                        }, fpk, view_BeforeEdit, view_BeforeEditInDatabase, view_AfterEditBeforeCommit, view_AfterEditAfterCommit);
                    }
                }
            }

            RefreshConfigCache();
        }
Beispiel #2
0
        protected override void HandleDataBeforeCache(string pk, System.Data.DataRow row)
        {
            IDictionary <string, object> values = Request.GetRouteData().Values;
            string viewName  = values["viewName"].ToString();
            string fieldName = values["fieldName"].ToString();

            Durados.DataAccess.ConfigAccess configAccess = new ConfigAccess();

            Database configDatabase = map.GetConfigDatabase();

            string fieldPk = configAccess.GetFieldPK(viewName, fieldName, configDatabase.ConnectionString);

            View fieldView = (View)configDatabase.Views["Field"];

            fieldView.Edit(new Dictionary <string, object>()
            {
                { "FtpUpload_Parent", pk }
            }, fieldPk, null, null, null, null);
        }