Exemplo n.º 1
0
            public static double GetLambdaValue(Node item)
            {
                DbConnection.Initialise(StringConnection);
                Int64  ID  = item.ID_Type;
                string col = "ID_Type";

                {
                    if (ID == 0)
                    {
                        if (item.ID_Scroll == 0)
                        {
                            ID  = item.ID_Class;
                            col = "ID_Class";
                        }
                        else
                        {
                            ID  = item.ID_Scroll;
                            col = "ID_Scroll";
                        }
                    }
                }

                using (var value = TableAdapter <Lambda> .Open())
                    return(value.Select().Where(Where.Equal(col, Convert.ToInt64(ID))).ToList()[0].Value * Math.Pow(10, -6));
            }
Exemplo n.º 2
0
        private void AlterTable(TableAdapter tableLog)
        {
            var script = new ScriptWizard.SqlServerScriptWizard();
            var query  = script.GetAlterTableCommand(tableLog);

            Connection.Instance.SqlServerExecute(query);
        }
Exemplo n.º 3
0
 public static T Read(params object[] args)
 {
     using (TableAdapter <T> adapter = TableAdapter <T> .Open())
     {
         return(adapter.Read(args));
     }
 }
Exemplo n.º 4
0
 public virtual void Save()
 {
     using (TableAdapter <T> adapter = TableAdapter <T> .Open(new object[0]))
     {
         adapter.CreateUpdate(new object[] { this });
     }
 }
Exemplo n.º 5
0
 private void CopyFields(TableAdapter tableLog)
 {
     foreach (var collumn in tableLog.Collumns)
     {
         _tableLog.Collumns.Add(CloneTableField(collumn));
     }
 }
Exemplo n.º 6
0
 public static void Delete(params object[] args)
 {
     using (TableAdapter <T> adapter = TableAdapter <T> .Open())
     {
         adapter.Delete(args);
     }
 }
Exemplo n.º 7
0
        private void Init()
        {
            RectOffset margin  = new RectOffset(4, 4, 4, 4);
            RectOffset padding = new RectOffset(3, 3, 3, 3);

            mCustomFieldTextStyle           = new GUIStyle(EditorStyles.textField);
            mCustomFieldTextStyle.margin    = margin;
            mCustomFieldTextStyle.padding   = padding;
            mCustomFieldTextStyle.alignment = TextAnchor.MiddleRight;

            mPlaceHolderTextStyle           = new GUIStyle(EditorStyles.textField);
            mPlaceHolderTextStyle.alignment = TextAnchor.MiddleLeft;
            mPlaceHolderTextStyle.fontStyle = FontStyle.Italic;

            mCollectionDataTextStyle           = new GUIStyle(EditorStyles.textField);
            mCollectionDataTextStyle.alignment = TextAnchor.MiddleLeft;

            mCollectionNameButtonStyle           = new GUIStyle(EditorStyles.miniButtonMid);
            mCollectionNameButtonStyle.fontSize  = 11;
            mCollectionNameButtonStyle.alignment = TextAnchor.MiddleLeft;

            mAssetManager      = ScriptableObject.CreateInstance("AssetManager") as AssetManager;
            mSelectedTypeIndex = -1;
            mAdapter           = new TableAdapter(mAssetManager, this, 2);
            RefreshVersions();
        }
Exemplo n.º 8
0
 public static void Do(Action <TableAdapter <T> > action)
 {
     using (TableAdapter <T> adapter = TableAdapter <T> .Open(new object[0]))
     {
         action(adapter);
     }
 }
Exemplo n.º 9
0
        private async void GetTables()
        {
            tableList = await tableService.RefreshDataAsync();

            adapter = new TableAdapter(this, tableList);
            listViewTableView.Adapter = adapter;
        }
Exemplo n.º 10
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            SetContentView(Resource.Layout.Sources);

            // Adding Toolbar to Main screen
            Toolbar toolbar = FindViewById <Toolbar>(Resource.Id.toolbar);

            toolbar.Title = "Srautai";
            SetSupportActionBar(toolbar);
            TabLayout tabs = FindViewById <TabLayout>(Resource.Id.tabs);

            TableAdapter adapter = new TableAdapter(SupportFragmentManager);


            ViewPager viewPager = FindViewById <ViewPager>(Resource.Id.viewpager);

            adapter.AddFragment(new SubscribedSourcesFragment(), "Subscribed");
            adapter.AddFragment(new AllSourcesFragment(), "All");
            adapter.AddFragment(new CreatedSourcesFragment(), "Created");
            viewPager.Adapter = adapter;

            tabs.SetupWithViewPager(viewPager);

            FloatingActionButton fab = FindViewById <FloatingActionButton>(Resource.Id.fab);

            fab.Click += Fab_Click;
        }
Exemplo n.º 11
0
 private static void CheckIfOnlyOneKey(TableAdapter tableAdapter)
 {
     if (!tableAdapter.KeyFields.Any())
     {
         throw new Exception(
                   "Para habilitar o autoLog deve haver ao menos uma chave: Tabela [{0}.{1}]"
                   .Fmt(tableAdapter.DBName, tableAdapter.TableName));
     }
 }
Exemplo n.º 12
0
        public static string GetDefDesign(Node item)
        {
            DbConnection.Initialise(StringConnection);

            using (var rows = TableAdapter <Class> .Open())
            {
                return(rows.Select().First(tbl => (tbl.ID == item.ID_Class)).DefDesign);
            }
        }
Exemplo n.º 13
0
 public IList <ProductCategory> SelectList()
 {
     using (DbConnection conn = new DbConnection())
     {
         using (TableAdapter <ProductCategory> adapter = TableAdapter <ProductCategory> .Open())
         {
             return(adapter.Select().ToList());
         }
     }
 }
Exemplo n.º 14
0
        public static T Read(params object[] args)
        {
            T t;

            using (TableAdapter <T> adapter = TableAdapter <T> .Open(new object[0]))
            {
                t = adapter.Read(args);
            }
            return(t);
        }
Exemplo n.º 15
0
        private TableAdapter GetTableLogUsingThis(IEnumerable <TableAdapterField> fields)
        {
            var tableLog = new TableAdapter();

            tableLog.CopyBy(_tableLog);
            tableLog.Collumns.Clear();
            tableLog.Collumns.AddRange(fields);

            return(tableLog);
        }
Exemplo n.º 16
0
 public IList <ExtractValueName> SelectList()
 {
     using (DbConnection conn = new DbConnection())
     {
         using (TableAdapter <ExtractValueName> adapter = TableAdapter <ExtractValueName> .Open())
         {
             return(adapter.Select().ToList());
         }
     }
 }
Exemplo n.º 17
0
 public IList <SensorType> SelectList()
 {
     using (DbConnection conn = new DbConnection())
     {
         using (TableAdapter <SensorType> adapter = TableAdapter <SensorType> .Open())
         {
             return(adapter.Select().ToList());
         }
     }
 }
Exemplo n.º 18
0
 public IList <DataFilter> SelectList()
 {
     using (DbConnection conn = new DbConnection())
     {
         using (TableAdapter <DataFilter> adapter = TableAdapter <DataFilter> .Open())
         {
             return(adapter.Select().ToList());
         }
     }
 }
Exemplo n.º 19
0
 public System.Collections.Generic.IList <TableFieldInfo> SelectList()
 {
     using (DbConnection conn = new DbConnection())
     {
         using (TableAdapter <TableFieldInfo> adapter = TableAdapter <TableFieldInfo> .Open())
         {
             return(adapter.Select().ToList());
         }
     }
 }
Exemplo n.º 20
0
 public IList <FormulaInfo> SelectList()
 {
     using (DbConnection conn = new DbConnection())
     {
         using (TableAdapter <FormulaInfo> adapter = TableAdapter <FormulaInfo> .Open())
         {
             return(adapter.Select().ToList());
         }
     }
 }
Exemplo n.º 21
0
 static User()
 {
     _adapter = new Mong.DatabaseSetTableAdapters.�ϥΪ�TableAdapter();
     _userTypeMapping = new Dictionary<int, UserType>();
     _userTypeMapping.Add(User.Administrator, UserType.Administrator);
     _userTypeMapping.Add(User.Manager, UserType.Manager);
     _userTypeMapping.Add(User.Ganger, UserType.Ganger);
     _userTypeMapping.Add(User.QA, UserType.QA);
     _userTypeMapping.Add(User.Guest, UserType.Guest);
 }
Exemplo n.º 22
0
 public IList <ExtractionConfig> SelectConfigs()
 {
     using (DbConnection conn = new DbConnection())
     {
         using (TableAdapter <ExtractionConfig> adapter = TableAdapter <ExtractionConfig> .Open())
         {
             return(adapter.Select().ToList());
         }
     }
 }
Exemplo n.º 23
0
 public IList <PacketsToSend> SelectAllCacheDataPackets()
 {
     using (DbConnection conn = new DbConnection())
     {
         using (TableAdapter <PacketsToSend> adapter = TableAdapter <PacketsToSend> .Open())
         {
             return(adapter.Select().ToList());
         }
     }
 }
        /// <summary>
        /// Pega o comando de alteração da tabela
        /// </summary>
        /// <param name="pTable">Um Table Adapter</param>
        /// <returns>Um string com o comando de alteração</returns>
        public string GetAlterTableCommand(TableAdapter pTable)
        {
            var stringBulder = new StringBuilder();

            stringBulder.AppendLine(" ALTER TABLE ");
            stringBulder.Append(GetTableName(pTable.DBName, pTable.TableName, string.Empty, false));

            stringBulder.Append(GetAddColumns(pTable.Collumns));

            return(stringBulder.ToString());
        }
Exemplo n.º 25
0
        public static TReturn Get <TReturn>(Func <TableAdapter <T>, TReturn> action)
            where TReturn : class
        {
            TReturn tReturn;

            using (TableAdapter <T> adapter = TableAdapter <T> .Open(new object[0]))
            {
                tReturn = action(adapter);
            }
            return(tReturn);
        }
Exemplo n.º 26
0
        private async void GetTables()
        {
            tableList = await tableService.RefreshDataAsync();

            tableList = (from Table t in tableList
                         where t.StaffId == null
                         select t).ToList();

            adapter = new TableAdapter(this, tableList);
            listviewStartTable.Adapter = adapter;
        }
Exemplo n.º 27
0
        public ChangeLogForm(TableAdapter pTableAdapter)
        {
            if (!pTableAdapter.AutoLog)
            {
                throw new Exception(string.Format("Entidade {0} não controla log", pTableAdapter.TableName));
            }
            _tableAdapter = new TableAdapterLog(pTableAdapter);

            InitializeComponent();
            InitilizeForm();
            SetEvents();
        }
Exemplo n.º 28
0
 public virtual int Save()
 {
     using (TableAdapter <T> adapter = TableAdapter <T> .Open())
     {
         Int64 i = adapter.CreateUpdate(this);
         if (i > 0)
         {
             return((int)i);
         }
         return(0);
     }
 }
Exemplo n.º 29
0
        /// <summary>
        /// Instanciar o TableLog
        /// </summary>
        /// <param name="tableAdapter">Tabela Base de Criação de Log</param>
        public TableAdapterLog(TableAdapter tableAdapter)
        {
            CheckIfOnlyOneKey(tableAdapter);

            CopyFields(tableAdapter);
            AddLogFields();

            _tableLogBase                    = tableAdapter;
            _tableLogBase.OnAfterAdd        += tableAdpterBaser_OnAfterAdd;
            _tableLogBase.OnAfterUpdate     += tableAdpterBase_OnAfterUpdate;
            _tableLogBase.OnAfterCreate     += tableAdpterBase_OnAfterCreate;
            _tableLogBase.OnAfterAlterTable += tableAdpterBase_OnAfterAlterTable;
        }
Exemplo n.º 30
0
        private void Dado_uma_tabela_com_mais_de_uma_chave_e_log_ativado()
        {
            _tableWith2Keys = new TableAdapter(new DbTesteNampula().DataBaseName, "Fke2Keys");
            _tableWith2Keys.Collumns.Add(new TableAdapterField("Key1", "Key1", DbType.Int32, 11, null, true, false));
            _tableWith2Keys.Collumns.Add(new TableAdapterField("Key2", "Key2", DbType.Int32, 11, null, true, false));
            _tableWith2Keys.Collumns.Add(new TableAdapterField("Record", "Record", 120));

            _tableWith2Keys.KeyFields.Add(_tableWith2Keys.Collumns[0]);
            _tableWith2Keys.KeyFields.Add(_tableWith2Keys.Collumns[1]);

            _tableWith2Keys.SetAutoLog();

            _tableWith2Keys.Create();
        }
Exemplo n.º 31
0
            public static string GetName(Int64 ID)
            {
                DbConnection.Initialise(StringConnection);

                /* List<Scroll> row;
                 * using (var name = TableAdapter<Scroll>.Open())
                 *   row = name.Select().Where(tbl => tbl.ID == Convert.ToInt64(ID)).ToList();
                 * if (row == null)
                 *   return null;
                 * else
                 *   return row[0].Name;*/
                using (var name = TableAdapter <Scroll> .Open())
                    return(name.Select().FirstOrDefault(tbl => tbl.ID == Convert.ToInt64(ID)).Name);
            }
Exemplo n.º 32
0
        private void Init()
        {
            RectOffset margin = new RectOffset(4, 4, 4, 4);
            RectOffset padding = new RectOffset(3, 3, 3, 3);
            mCustomFieldTextStyle = new GUIStyle(EditorStyles.textField);
            mCustomFieldTextStyle.margin = margin;
            mCustomFieldTextStyle.padding = padding;
            mCustomFieldTextStyle.alignment = TextAnchor.MiddleRight;

            mPlaceHolderTextStyle = new GUIStyle(EditorStyles.textField);
            mPlaceHolderTextStyle.alignment = TextAnchor.MiddleLeft;
            mPlaceHolderTextStyle.fontStyle = FontStyle.Italic;

            mCollectionDataTextStyle = new GUIStyle(EditorStyles.textField);
            mCollectionDataTextStyle.alignment = TextAnchor.MiddleLeft;

            mCollectionNameButtonStyle = new GUIStyle(EditorStyles.miniButtonMid);
            mCollectionNameButtonStyle.fontSize = 11;
            mCollectionNameButtonStyle.alignment = TextAnchor.MiddleLeft;

            mAssetManager = ScriptableObject.CreateInstance("AssetManager") as AssetManager;
            mSelectedTypeIndex = -1;
            mAdapter = new TableAdapter(mAssetManager, this, 2);
            RefreshVersions();
        }
Exemplo n.º 33
0
 public TableView(TableAdapter adapter)
 {
     mAdapter = adapter;
 }
Exemplo n.º 34
0
 public void SetAdapter(TableAdapter adapter)
 {
     mAdapter = adapter;
 }
Exemplo n.º 35
0
        private void OnGUI()
        {
            mRect = new Rect(MARGIN, MARGIN, CELL_WIDTH, CELL_HEIGHT);
            VersionsGUI();
            if (!mTypesLoaded && !mAssetsLoaded)
            {
                mRect.width = CELL_WIDTH * 3;
                EditorGUI.LabelField(mRect, isEditCollectionName ? "Collection saving..." : "Loading collections and assets...");
            } else if (!mTypesLoaded && mAssetsLoaded)
            {
                mRect.width = CELL_WIDTH * 3;
                EditorGUI.LabelField(mRect, isEditCollectionName ? "Collection saving..." : "Assets loaded. Waiting for collections...");
            } else if (mTypesLoaded)
            {
                if (isEditCollectionName)
                {
                    EditCollectionUI();
                } else
                {
                    CollectionsGUI();
                }

                if (!mAssetsLoaded)
                {
                    EditorGUI.LabelField(mRect, isEditCollectionName ? "Collection saving..." : "Loading assets...");
                } else
                {
                    if (mAssetManager.CurrentAssetType != null)
                    {
                        mRect.width = Screen.width;
                        EditorGUI.LabelField(mRect, "Assets for Collection " + mAssetManager.CurrentAssetType, mSelectionLabelStyle);
                        mRect.x = MARGIN;
                        mRect.y += mRect.height * 1.5f;
                        mRect.width = CELL_WIDTH;

                        Vector2 maxTableSize = new Vector2(Screen.width - mRect.x - MARGIN, Screen.height - mRect.y - MARGIN - CELL_HEIGHT * 5);

                        if (mAdapter == null)
                        {
                            mAdapter = new TableAdapter(mAssetManager, this, 2);
                        }
                        if (mAssetsTable == null)
                        {
                            mAssetsTable = new TableView(mAdapter);
                        } else
                        {
                            mAssetsTable.SetAdapter(mAdapter);
                        }
                        mAssetsTable.UpdateLocation(new Vector2(mRect.x, mRect.y), CELL_WIDTH, CELL_HEIGHT);

                        mAssetsTable.OnGUI();
                        mAssetsTable.MaxSize = maxTableSize;
                        mRect.y = mAssetsTable.PositionRect.y + mAssetsTable.PositionRect.height;
                        ManagerCommandsGUI();
                        mRect.y += (mAssetManager.NumEntries + 1) * CELL_HEIGHT;
                    }
                }
                Repaint();
            }
            mRect.y += mRect.height;

            if (mWindowResizeSwitch)
            {
                ResizeAndFitRectOnScreen(mRect);
                mWindowResizeSwitch = false;
            }

            if (Event.current.type == EventType.Repaint && forceFocusControl != null)
            {
                GUI.FocusControl(forceFocusControl);
                forceFocusControl = null;
            }
        }