예제 #1
0
 private static string CreateBackupTable(IDataBase db, Table table)
 {
     var script = Base.JoinScriptFragments(table.Script(new ScriptingOptions {DriPrimaryKey = false, Statistics = false}));
     var scriptForBackupTable = TransformCreationScriptForBackup(script, table.Name);
     db.ExecuteNonQuery(scriptForBackupTable);
     return Analyst.GetBackupTableName(table.Name);
 }
        private static DbState AndTheDbHasAtLeast2NonEmptyTablesWithDifferentNumberOfRowsAndFirstTableShouldntHaveTheHighestRowCount(IDataBase db)
        {
            var state = new DbState(db);
            int? firstNonEmptyNumberOfRows = null;

            foreach (var rowCount in state.Values)
            {
                if (rowCount == 0)
                {
                    continue;
                }
                if (firstNonEmptyNumberOfRows == null)
                {
                    firstNonEmptyNumberOfRows = rowCount;
                }
                else
                {
                    if (firstNonEmptyNumberOfRows.Value < rowCount)
                    {
                        return state;
                    }
                }
            }
            Assert.Fail("Test setup is wrong: should have at least 2 tables with different rowcount and bigger than zero, and the first table shouldn't be the one with the highest rowcount...");
            return null;
        }
예제 #3
0
        public SettingsForm()
        {
            InitializeComponent();

            _path = "base.txt";
            _loader = new DB_File(_path);
        }
예제 #4
0
        public void Execute(IDataBase db)
        {
            var group = db.GetElements<Group>()[0];

            db.FillElement(group);

            var peoples = group.Peoples;

            var test = db.GetElements<Test>()[0];

            db.FillElement(test);

            var passedTest1 = new PassedTest();
            var passedTest2 = new PassedTest();

            passedTest1.SetPeople(peoples[0]);
            passedTest2.SetPeople(peoples[1]);
            passedTest1.SetTest(test);
            passedTest2.SetTest(test);

            passedTest1.Replies[test.Questions[0]] = "Я не знаю ответа.";
            passedTest1.Replies[test.Questions[1]] = "И тут я тоже не знаю ответа, увы.";

            passedTest2.Replies[test.Questions[0]] = "Бла-бла-бла";
            passedTest2.Replies[test.Questions[1]] = "Этой строки быть не должно";
            passedTest2.Replies[test.Questions[1]] = "Проверка на изменение ответа";

            db.ExecuteCommand(Parameters.Insert, passedTest1);
            db.ExecuteCommand(Parameters.Insert, passedTest2);
        }
        public void Execute(IDataBase db)
        {
            var positions = new[]
            {
                "Плотник",
                "Программист"
            };

            foreach (var position in positions)
            {
                db.InsertPosition(position);
            }

            var peoples = new[]
            {
                new People("Иванов Иван", positions[0]),
                new People("Петров Петр", positions[0]),
                new People("Князь Владимир", positions[1]),
                new People("Клинт Бартон", positions[1]),
            };

            var groups = new[]
            {
                new Group("Карлики"),
                new Group("Забегаловка")
            };

            groups[0].SetPeoples(new[] { peoples[0], peoples[2] });
            groups[1].SetPeoples(new[] { peoples[1], peoples[3] });

            foreach (var group in groups)
            {
                db.ExecuteCommand(Parameters.Insert, group);
            }
        }
예제 #6
0
        public GoodsFiller(int link_id, IDataBase cdb, IXMLReader xreader, decimal userSale)
        {
            this.XGoods = new dev_xml_goods();

            this.cdb = cdb;
            this.cdb.SetStoredProcedure("WebSite.GetGoodsXML");
            this.cdb.AddParameter(new SqlParameter("@Link_id", link_id));
            this.cdb.AddParameter(new SqlParameter("@UserSale", userSale));

            this.xreader = xreader;
            this.xreader.LoadXML(this.cdb.GetScalarValue());

            XGoods.Brand_id = this.xreader.GetAttribute<int>("brand_id", 0);
            XGoods.Link_id = this.xreader.GetAttribute<int>("link_id", 0);
            XGoods.Group_id = this.xreader.GetAttribute<int>("group_id", 0);
            XGoods.Root = this.xreader.GetAttribute<int>("root", 0);
            XGoods.Sound = this.xreader.GetAttribute<int>("sound", 0);
            XGoods.Info = this.xreader.GetAttribute<int>("info", 0);
            XGoods.Consists_id = this.xreader.GetAttribute<int>("consists_id", 0);
            XGoods.Country_id = this.xreader.GetAttribute<int>("country_id", 0);
            XGoods.Gtype_id = this.xreader.GetAttribute<int>("gtype_id", 0);
            XGoods.Seria_id = this.xreader.GetAttribute<int>("seria_id", 0);
            XGoods.Weight = this.xreader.GetAttribute<decimal>("weight", 0);
            XGoods.Sale = this.xreader.GetAttribute<byte>("sale", 0);
            XGoods.Seria_name = this.xreader.GetAttribute<string>("seria_name", "");
            XGoods.Consists_name = this.xreader.GetAttribute<string>("consists_name", "");
            XGoods.Gtype_name = this.xreader.GetAttribute<string>("gtype_name", "");
            XGoods.Country_name = this.xreader.GetAttribute<string>("country_name", "");
            XGoods.UT_video = this.xreader.GetAttribute<string>("ut_video", "");
            XGoods.Name = this.xreader.GetAttribute<string>("name", "");
            XGoods.Brand_name = this.xreader.GetAttribute<string>("brand_name", "");
            XGoods.HasImg = this.xreader.GetAttribute<string>("has_img", "0").Equals("1") ? true : false;
            XGoods.Descr = this.xreader.GetValue<string>("//link/descr", "").Replace(@"\n", "<br/>");
            XGoods.Descr_Seo = this.xreader.GetValue<string>("//link/descr_seo", "");

            //filling goods properies
            XmlNodeList goodsList = this.xreader.GetXmlNodes("//link//goods//good");
            foreach (XmlNode child in goodsList)
            {
                SGoodsFiller sgFiller = new SGoodsFiller(child, this.xreader);
                XGoods.Items.Add(sgFiller.XSGoods);
            }

            //filling goods mechs
            XmlNodeList mechList = this.xreader.GetXmlNodes("//link//mechs//mech");
            foreach (XmlNode child in mechList)
            {
                GoodsMechsFiller smFiller = new GoodsMechsFiller(child, this.xreader);
                XGoods.Mechs.Add(smFiller.Mech);
            }

            //filling goods sames
            XmlNodeList sameList = this.xreader.GetXmlNodes("//link//sames//same");
            foreach (XmlNode child in sameList)
            {
                GoodsSamesFiller gsameFiller = new GoodsSamesFiller(child, this.xreader);
                XGoods.Sames.Add(gsameFiller.Same);
            }
        }
예제 #7
0
 public void BisectDatabase(IDataBase db, Func<IDataBase, bool> testOperation)
 {
     Table tableToBisect;
     while ((tableToBisect = _analyst.ChooseTableToBisect(db)) != null)
     {
         _bisector.BisectTableOnce(db, tableToBisect, testOperation);
     }
 }
 private void InsertSomeDataInBisectedTable(IDataBase db)
 {
     const string insertSql = @"
         SET IDENTITY_INSERT {0} ON
         INSERT INTO baz(ID,baf) VALUES (1,'lele')
         SET IDENTITY_INSERT {0} OFF";
     db.ExecuteNonQuery(String.Format(insertSql, AndTheTableIChooseIs(db).Name));
 }
 public MinesweeperEngine(IDataBase db, ICommandManager commandManager, IInputReader reader, IOutputWriter writer)
 {
     this.db = db;
     this.commandManager = commandManager;
     this.commandManager.Engine = this;
     this.reader = reader;
     this.writer = writer;
 }
예제 #10
0
파일: BaseDAL.cs 프로젝트: AntonWong/cms
 static DALBase()
 {
     DataBaseAccess _db = CmsDataBase.Main;
     DbFact = _db.DataBaseAdapter;
     _table_prefix = CmsDataBase.TablePrefix;
     //SQLPack对象
     SP = SqlPack.Factory(_db.DbType);
 }
예제 #11
0
        public AccountingModel()
        {
            _db = new DataBase.Repository.DataBase();
            _goodsRepository = new GoodsRepository(_db);
            _roleRepository = new RoleRepository(_db);
            _orderRepository = new OrderRepository(_db);
            _userRepository = new UserRepository(_db);

        }
예제 #12
0
        public MainForm(People people, IDataBase db)
        {
            _passedTest = new PassedTest();
            _passedTest.SetPeople(people);

            _db = db;

            InitializeComponent();
        }
예제 #13
0
파일: BaseDAL.cs 프로젝트: coodream/cms
 private static void CheckAndInit()
 {
     if (!inited)
     {
         DataBaseAccess _db = CmsDataBase.Instance;
         DbFact = _db.DataBaseAdapter;
         //SQLPack对象
         inited = true;
     }
 }
예제 #14
0
        private void submit_Click(object sender, EventArgs e)
        {
            if (_method.Equals("DB_File"))
                _loader = new DB_File(_path);
            else if (_method.Equals("DB_Connected"))
                _loader = new DB_Connected();
            else if (_method.Equals("DB_Disconnected"))
                _loader = new DB_Disconnected();

            Method(_loader);
        }
예제 #15
0
        public void Execute(IDataBase db)
        {
            var generalComponents = new[]
            {
                new Component("Знания"),
                new Component("Умения"),
                new Component("Владения практическими навыками"),
                new Component("Ответственность"),
                new Component("Инициатива и творческий подход"),
            };

            var _3level = new[]
            {
                new Component("Стратегия взаимодействия и общения в процессе обучения"),
                new Component("Владение информационной этикой"),
                new Component("Дистанционная коммуникация"),
                new Component("Работа с аппаратным обеспечением"),
                new Component("Работа с программным обеспечением"),
                new Component("Работа с современными технологиями обработки информации и нормативными документами"),
                new Component("Потребность в работе с информацией"),
                new Component("Понимание значимости принимаемых решений"),
                new Component("Интерес к знаниям, стремление добиться успеха в проф. Деятельности"),
                new Component("Осознание ответственности за действия"),
                new Component("Контроль произведенных действий, выработка рекомендаций для будущих действий"),
                new Component("Анализ, планирование и предвидение ситуации")
            };

            foreach (var component3Level in _3level)
            {
                component3Level.Components.AddRange(generalComponents);
            }

            var _2level = new[]
            {
                new Component("Рефлексивно-коммуникативный компонент"),
                new Component("Профессионально-деятельностный компонент"),
                new Component("Ценностно-мотивационный компонент"),
                new Component("Ответственно-аналитический компонент")
            };

            _2level[0].Components.AddRange(new[] { _3level[0], _3level[1], _3level[2] });
            _2level[1].Components.AddRange(new[] { _3level[3], _3level[4], _3level[5] });
            _2level[2].Components.AddRange(new[] { _3level[6], _3level[7], _3level[8] });
            _2level[3].Components.AddRange(new[] { _3level[9], _3level[10], _3level[11] });

            var component = new Component("Компоненты, составляющие компонентов и показатели учения и др. характеристики информационной компетентности специалистов здравоохранения");

            component.Components.AddRange(_2level);

            db.ExecuteCommand(Parameters.Insert, component);
        }
예제 #16
0
 /// <summary>
 /// 数据库实例
 /// </summary>
 /// <returns>数据库对象</returns>
 public static IDataBase GetInstance()
 {
     lock (locker)
     {
         if (_DbHelper != null)
         {
             return _DbHelper;
         }
         else
         {
             return _DbHelper = new DataBase("DbConn");
         }
     }
 }
예제 #17
0
        public void Execute(IDataBase db)
        {
            var cerifiedTest = new CertifiedTest();
            var passedTest = db.GetElements<PassedTest>()[0];
            var olapRound = db.GetOlapRounds()[0];

            db.FillElement(passedTest);
            cerifiedTest.SetPassedTest(passedTest);

            cerifiedTest.Assessments[cerifiedTest.PassedTest.Test.Questions[0]] = 70;
            cerifiedTest.Assessments[cerifiedTest.PassedTest.Test.Questions[1]] = 43;

            db.ExecuteCommand(Parameters.Insert, cerifiedTest);
            db.InsertLinkOlapRoundPassedTest(olapRound, passedTest);
        }
예제 #18
0
        static void MoveData(IDataBase db, Table source, Table destination)
        {
            if (!AreTablesEquivalent(source, destination))
            {
                throw new InvalidOperationException("Both tables need to have same set of columns to move data between them");
            }
            string commaSeparatedColumns = String.Join(",", (from Column column in source.Columns select column.Name).ToArray());

            const string copyToTableSql = @"
                SET IDENTITY_INSERT {0} ON
                INSERT INTO {0}({1}) SELECT {1} FROM {2}
                SET IDENTITY_INSERT {0} OFF";
            db.ExecuteNonQuery(String.Format(copyToTableSql, destination, commaSeparatedColumns, source.Name));
            DeleteContentsOfTable(db, source);
        }
예제 #19
0
        public NewTest(IDataBase db)
        {
            InitializeComponent();

            _db = db;

            _2Level = new List<string>();
            _3Level = new Dictionary<string, List<string>>();
            _generalComponents = new List<string>();

            _questions = new List<Question>();
            _selectedComponent = null;

            _assessments = new Dictionary<string, TemplateAssessments>();
        }
예제 #20
0
        public static List<ClassDefinition> ReadSchema(IDataBase driver)
        {
            List<ClassDefinition> tables = new List<ClassDefinition>();
            using (IDbConnection connection = driver.getConnection())
            {
                if (connection.State == ConnectionState.Broken ||
                    connection.State == ConnectionState.Closed)
                    connection.Open();
                DataTable tableList = driver.getSchema("Tables", new string[] { });
                tableList.DefaultView.RowFilter = "(table_schema <> 'information_schema') AND (table_schema <> 'pg_catalog')";
                foreach (DataRow row in tableList.DefaultView.ToTable().Rows)
                    tables.Add(new ClassDefinition(row["TABLE_NAME"].ToString()));
            }

            return tables;
        }
예제 #21
0
        private void Authorization_Load(object sender, EventArgs e)
        {
            try
            {
                _db = new DataBaseMicrosoft(SolutionConfiguration.DatabaseType, SolutionConfiguration.DatabaseArguments);

                UpdateElements();
            }
            catch (Exception ex)
            {
                var exceptionMessage = ex.InnerException?.Message ?? ex.Message;

                MessageBox.Show(exceptionMessage, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);

                Application.Exit();
            }
        }
예제 #22
0
        public static List<BankEntryDTO> Validate(List<BankEntryDTO> bankEntries, IDataBase db)
        {
            IList<BankEntry> allEntriesInTimeInterval = db.getEntries();

            //a preferable solution would be
            //SortEntriesByDate()
            //GetEntriesInDateInterval()

            //Naive looping
            foreach (BankEntryDTO bankEntryDTO in bankEntries)
            {
                markAsFine(bankEntryDTO);
                markDuplicate(bankEntryDTO, allEntriesInTimeInterval);
            }

            return bankEntries;
        }
예제 #23
0
        public static void BisectTableOnce(IDataBase db, Table table, Func<IDataBase,bool> verification)
        {
            string backupTableName = CreateBackupTable(db, table);

            db.Tables.Refresh();
            Table backupTable = db.Tables[backupTableName];

            MoveData(db, table, backupTable);

            if (!verification.Invoke(db))
            {
                DeleteContentsOfTable(db, table);
                MoveData(db, backupTable, table);

            } else {
                DeleteContentsOfTable(db, table);
            }
        }
예제 #24
0
        public MainModel(IDataBase method)
        {
            _list = new QuestionList();
            _DBMethod = method;
            _level = 1;

            try
            {
                _random = new Question();

                Load();

            }
            catch (ArgumentNullException ex)
            {
               // QUESTION.Text = ex.ParamName;
            }
            catch (IndexOutOfRangeException ex)
            {
               // QUESTION.Text = ex.ToString();
            }
        }
예제 #25
0
        public Table ChooseTableToBisect(IDataBase db)
        {
            var state = new DbState(db);

            var candidateTables = new HashSet<string>(state.Keys);

            foreach (Table table in db.Tables)
            {
                foreach (ForeignKey fk in table.ForeignKeys)
                {
                    candidateTables.Remove(fk.ReferencedTable);
                }

                if (IsBackUpTable(table.Name) || state.Keys.Contains(GetBackupTableName(table.Name)))
                {
                    candidateTables.Remove(table.Name);
                }
            }

            KeyValuePair<string, int>? highest = null;
            foreach (var table in candidateTables)
            {
                var rowCount = state[table];
                if (state[table] > 0)
                {
                    if (highest == null ||
                        highest.Value.Value < rowCount)
                    {
                        highest = new KeyValuePair<string, int>(table, rowCount);
                    }
                }
            }
            if (highest == null)
                return null;

            return db.Tables[highest.Value.Key];
        }
예제 #26
0
 public ItemController(IDataBase db)
 {
     _db = db;
 }
 public AppointmentMapperSqlite(IDataBase db) : base(db)
 {
 }
예제 #28
0
 public MarketRepository(IDataBase dbService)
 {
     _dbService = dbService;
 }
예제 #29
0
        public override void AddNew()
        {
            string sql = "insert into PS_SLUICE(ID,US_OBJECT_ID,DS_OBJECT_ID,SYSTEM_TYPE,INVERT_LEVEL,Width,OPEN_LIMIT,SLUICE_TYPE,"
                         + "STATE,PRESSURE,ROAD_NAME,ACQUISITION_DATE,Remark,US_SURVEY_ID,DS_SURVEY_ID,"
                         + "ACQUISITION_UNIT,PROCESS_DATE,PROCESS_UNIT,SHAPE_Length)"
                         + "  values(@ID,@US_OBJECT_ID,@DS_OBJECT_ID,@SYSTEM_TYPE,@INVERT_LEVEL,@Width,@OPEN_LIMIT,@SLUICE_TYPE,"
                         + "@STATE,@PRESSURE,@ROAD_NAME,@ACQUISITION_DATE,@Remark,@US_SURVEY_ID,@DS_SURVEY_ID,"
                         + "@ACQUISITION_UNIT,@PROCESS_DATE,@PROCESS_UNIT,@SHAPE_Length)";

            SQLiteParameter[] Parameters = new SQLiteParameter[]
            {
                new SQLiteParameter()
                {
                    ParameterName = "@ID", Value = this.ID
                },
                new SQLiteParameter()
                {
                    ParameterName = "@US_OBJECT_ID", Value = this.US_OBJECT_ID
                },
                new SQLiteParameter()
                {
                    ParameterName = "@DS_OBJECT_ID", Value = this.DS_OBJECT_ID
                },
                new SQLiteParameter()
                {
                    ParameterName = "@SYSTEM_TYPE", Value = this.SYSTEM_TYPE
                },
                new SQLiteParameter()
                {
                    ParameterName = "@INVERT_LEVEL", Value = string.IsNullOrEmpty(this.INVERT_LEVEL)?DBNull.Value:(object)double.Parse(this.INVERT_LEVEL)
                },
                new SQLiteParameter()
                {
                    ParameterName = "@Width", Value = string.IsNullOrEmpty(this.Width)?DBNull.Value:(object)double.Parse(this.Width)
                },
                new SQLiteParameter()
                {
                    ParameterName = "@OPEN_LIMIT", Value = string.IsNullOrEmpty(this.OPEN_LIMIT)?DBNull.Value:(object)double.Parse(this.OPEN_LIMIT)
                },
                new SQLiteParameter()
                {
                    ParameterName = "@SLUICE_TYPE", Value = this.SLUICE_TYPE
                },
                new SQLiteParameter()
                {
                    ParameterName = "@STATE", Value = this.STATE
                },
                new SQLiteParameter()
                {
                    ParameterName = "@ROAD_NAME", Value = this.ROAD_NAME
                },
                new SQLiteParameter()
                {
                    ParameterName = "@ACQUISITION_DATE", Value = this.ACQUISITION_DATE
                },
                new SQLiteParameter()
                {
                    ParameterName = "@Remark", Value = this.Remark
                },
                new SQLiteParameter()
                {
                    ParameterName = "@US_SURVEY_ID", Value = this.US_SURVEY_ID
                },
                new SQLiteParameter()
                {
                    ParameterName = "@DS_SURVEY_ID", Value = this.DS_SURVEY_ID
                },
                new SQLiteParameter()
                {
                    ParameterName = "@ACQUISITION_UNIT", Value = this.ACQUISITION_UNIT
                },
                new SQLiteParameter()
                {
                    ParameterName = "@PROCESS_DATE", Value = this.PROCESS_Date
                },
                new SQLiteParameter()
                {
                    ParameterName = "@PROCESS_UNIT", Value = this.PROCESS_Unit
                },
                new SQLiteParameter()
                {
                    ParameterName = "@SHAPE_Length", Value = string.IsNullOrEmpty(this.Lenght)?DBNull.Value:(object)double.Parse(this.Lenght)
                }
            };
            IDataBase pDataBase = SysDBUnitiy.OleDataBase;

            pDataBase.OpenConnection();
            try
            {
                pDataBase.ExecuteNonQuery(sql, Parameters);
                this.CurClassName = "PS_SLUICE";
                //sql = "select max(objectid) from PS_SLUICE";
                //this.ObjectID = int.Parse(pDataBase.ExecuteScalar(sql).ToString());
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                pDataBase.CloseConnection();
            }
        }
예제 #30
0
 public VoteController(IDataBase database)
 {
     Data = database;
 }
 protected override void OnUnsubscribe(IDataBase dataBase)
 {
     dataBase.Dispatcher.Invoke(() => dataBase.TableContext.Tables.TablesStateChanged -= Tables_TablesStateChanged);
 }
예제 #32
0
 public DashboardController(IDataBase db)
 {
     _db = db;
 }
예제 #33
0
        public override void AddNew()
        {
            SQLiteParameter[] Parameters = new SQLiteParameter[]
            {
                new SQLiteParameter()
                {
                    ParameterName = "@ID", Value = this.ID
                },
                new SQLiteParameter()
                {
                    ParameterName = "@SYSTEM_TYPE", Value = this.SYSTEM_TYPE
                },
                new SQLiteParameter()
                {
                    ParameterName = "@ROAD_NAME", Value = this.ROAD_NAME
                },
                new SQLiteParameter()
                {
                    ParameterName = "@ACQUISITION_DATE", Value = this.ACQUISITION_DATE
                },
                new SQLiteParameter()
                {
                    ParameterName = "@ACQUISITION_UNIT", Value = this.ACQUISITION_UNIT
                },
                new SQLiteParameter()
                {
                    ParameterName = "@PROCESS_UNIT", Value = this.PROCESS_Unit
                },
                new SQLiteParameter()
                {
                    ParameterName = "@PROCESS_DATE", Value = this.PROCESS_Date
                },
                new SQLiteParameter()
                {
                    ParameterName = "@STATE", Value = this.STATE
                },
                new SQLiteParameter()
                {
                    ParameterName = "@Remark", Value = this.Remark
                },

                new SQLiteParameter()
                {
                    ParameterName = "@GROUND_LEVEL", Value = string.IsNullOrEmpty(this.GROUND_LEVEL)?DBNull.Value:(object)this.GROUND_LEVEL
                },
                new SQLiteParameter()
                {
                    ParameterName = "@CO_X", Value = this.X
                },
                new SQLiteParameter()
                {
                    ParameterName = "@CO_Y", Value = this.Y
                },
                new SQLiteParameter()
                {
                    ParameterName = "@SURVEY_ID", Value = this.SURVEY_ID
                },
                new SQLiteParameter()
                {
                    ParameterName = "@INVERT_LEVEL", Value = string.IsNullOrEmpty(this.INVERT_LEVEL)?DBNull.Value: (object)this.INVERT_LEVEL
                },
                new SQLiteParameter()
                {
                    ParameterName = "@MANHOLE_TYPE", Value = this.MANHOLE_TYPE
                },
                new SQLiteParameter()
                {
                    ParameterName = "@SEDIMENT_DEPTH", Value = string.IsNullOrEmpty(this.SEDIMENT_DEPTH)?DBNull.Value:(object)this.SEDIMENT_DEPTH
                },
                new SQLiteParameter()
                {
                    ParameterName = "@FLOW_STATE", Value = this.FLOW_STATE
                },
                new SQLiteParameter()
                {
                    ParameterName = "@BOTTOM_TYPE", Value = this.BOTTOM_TYPE
                },
                new SQLiteParameter()
                {
                    ParameterName = "@MANHOLE_MATERIAL", Value = this.MANHOLE_MATERIAL
                },
                new SQLiteParameter()
                {
                    ParameterName = "@MANHOLE_SHAPE", Value = this.MANHOLE_SHAPE
                },
                new SQLiteParameter()
                {
                    ParameterName = "@COVER_MATERIAL", Value = this.COVER_MATERIAL
                },
                new SQLiteParameter()
                {
                    ParameterName = "@COVER_STATE", Value = this.COVER_STATE
                },
                new SQLiteParameter()
                {
                    ParameterName = "@WATER_QUALITY", Value = this.WATER_QUALITY
                },
                new SQLiteParameter()
                {
                    ParameterName = "@WATER_LEVEL", Value = string.IsNullOrEmpty(this.WATER_LEVEL)?DBNull.Value:(object)this.WATER_LEVEL
                }

                // new SQLiteParameter(){ ParameterName="@ObjectID" ,Value=this.ObjectID,OleDbType= OleDbType.Integer}
            };
            string sql = "insert into PS_MANHOLE(ID,SYSTEM_TYPE,ROAD_NAME,ACQUISITION_DATE,ACQUISITION_UNIT"
                         + ",PROCESS_UNIT,PROCESS_DATE,STATE,Remark,GROUND_LEVEL,CO_X,CO_Y,SURVEY_ID,INVERT_LEVEL,"
                         + " MANHOLE_TYPE,SEDIMENT_DEPTH,FLOW_STATE,BOTTOM_TYPE,MANHOLE_MATERIAL,MANHOLE_SHAPE,COVER_MATERIAL,"
                         + "COVER_STATE,WATER_QUALITY,WATER_LEVEL"
                         + ") values( "
                         + " @ID,@SYSTEM_TYPE,@ROAD_NAME,@ACQUISITION_DATE,@ACQUISITION_UNIT,@PROCESS_UNIT,@PROCESS_DATE,@STATE,"
                         + " @Remark,@GROUND_LEVEL,@CO_X,@CO_Y,@SURVEY_ID,@INVERT_LEVEL,@MANHOLE_TYPE,@SEDIMENT_DEPTH,@FLOW_STATE,"
                         + "@BOTTOM_TYPE,@MANHOLE_MATERIAL,@MANHOLE_SHAPE,@COVER_MATERIAL,@COVER_STATE,@WATER_QUALITY,@WATER_LEVEL)";
            IDataBase pDataBase = SysDBUnitiy.OleDataBase;

            pDataBase.OpenConnection();
            try
            {
                pDataBase.ExecuteNonQuery(sql, Parameters);
                sql = string.Format("insert into pointstable(ID,CO_X,CO_Y,ClassName,SURVEY_ID) values('{0}',{1},{2},'{3}','{4}')",
                                    ID, this.X, this.Y, this.ClassName, this.SURVEY_ID);
                pDataBase.ExecuteNonQuery(sql);
                //this.CurClassName = "PS_MANHOLE";
                //sql = "select max(objectid) from PS_MANHOLE";
                //this.ObjectID = int.Parse(pDataBase.ExecuteScalar(sql).ToString());
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                pDataBase.CloseConnection();
            }
        }
 public TableRootTreeViewItemViewModel(Authentication authentication, IDataBase dataBase, object selector)
     : base(authentication, dataBase.TableContext.Root, selector)
 {
     this.dataBaseName = dataBase.Name;
 }
예제 #35
0
 public ProductsService(IDataBase database, IRepository <ProductOptions> productOptionsrepository, FilterService filterService)
 {
     this.database = database;
     this.productOptionsrepository = productOptionsrepository;
     this.filterService            = filterService;
 }
예제 #36
0
        public GameLoop(IWriteToClient writeToClient, ICache cache, ICommands commands, ICombat combat, IDataBase database, IDice dice, IUpdateClientUI client, ITime time, ICore core, ISpellList spelllist, IWeather weather)
        {
            _writeToClient = writeToClient;
            _cache         = cache;
            _commands      = commands;
            _combat        = combat;
            _db            = database;
            _dice          = dice;
            _client        = client;
            _time          = time;
            _core          = core;
            _spellList     = spelllist;
            _weather       = weather;

            if (_hints == null)
            {
                _hints = _core.Hints();
            }
        }
예제 #37
0
 public static void InitMockDataBase()
 {
     _database = new MockDataBase();
 }
예제 #38
0
파일: BaseTest.cs 프로젝트: HenryHYH/Demo
 public BaseTest()
 {
     this.db = new DBSql();
 }
예제 #39
0
 public MobController(IDataBase db)
 {
     _db = db;
 }
예제 #40
0
 public UserRepository(IDataBase _database, ILogger <UserRepository> _logger)
 {
     database = _database;
     logger   = _logger;
 }
예제 #41
0
 public AlarmController(IDataBase scheduleDb, IDataBase alarmDb, IDataBase settingsDB)
 {
     this.scheduleDatabase     = scheduleDb;
     this.alarmHistoryDatabase = alarmDb;
     this.settingsDatabase     = settingsDB;
 }
예제 #42
0
 public Participant(IDataBase dataBase)
 {
     Data = dataBase;
 }
예제 #43
0
 void dgViewLoad()
 {
     dgEntrusted.DataSource = IDataBase.DataToDataTable("select * from Books where IsActive=1 and Status=1");
     dgBooks.DataSource     = IDataBase.DataToDataTable("select * from Books where IsActive=1 and Status=0");
     dgReaders.DataSource   = IDataBase.DataToDataTable("select * from Readers where IsActive=1 ");
 }
예제 #44
0
 public ProviderSQL()
 {
     _db = DataBase.GetDataBase();
 }
예제 #45
0
 public FlightPlanManager(IDataBase sqliteData)
 {
     sqliteDataBase = sqliteData;
 }
 public DashboardController(IDataBase db, ICache cache)
 {
     _db    = db;
     _cache = cache;
 }
예제 #47
0
        public override void Update()
        {
            SQLiteParameter[] Parameters = new SQLiteParameter[]
            {
                new SQLiteParameter()
                {
                    ParameterName = "@SYSTEM_TYPE", Value = this.SYSTEM_TYPE
                },
                new SQLiteParameter()
                {
                    ParameterName = "@ROAD_NAME", Value = this.ROAD_NAME
                },
                new SQLiteParameter()
                {
                    ParameterName = "@ACQUISITION_DATE", Value = this.ACQUISITION_DATE
                },
                new SQLiteParameter()
                {
                    ParameterName = "@ACQUISITION_UNIT", Value = this.ACQUISITION_UNIT
                },
                new SQLiteParameter()
                {
                    ParameterName = "@PROCESS_UNIT", Value = this.PROCESS_Unit
                },
                new SQLiteParameter()
                {
                    ParameterName = "@PROCESS_DATE", Value = this.PROCESS_Date
                },
                new SQLiteParameter()
                {
                    ParameterName = "@STATE", Value = this.STATE
                },
                new SQLiteParameter()
                {
                    ParameterName = "@REMARK", Value = this.Remark
                },

                new SQLiteParameter()
                {
                    ParameterName = "@GROUND_LEVEL", Value = string.IsNullOrEmpty(this.GROUND_LEVEL)?DBNull.Value:(object)this.GROUND_LEVEL
                },
                new SQLiteParameter()
                {
                    ParameterName = "@CO_X", Value = this.X
                },
                new SQLiteParameter()
                {
                    ParameterName = "@CO_Y", Value = this.Y
                },
                new SQLiteParameter()
                {
                    ParameterName = "@SURVEY_ID", Value = this.SURVEY_ID
                },
                new SQLiteParameter()
                {
                    ParameterName = "@INVERT_LEVEL", Value = string.IsNullOrEmpty(this.INVERT_LEVEL)?DBNull.Value: (object)this.INVERT_LEVEL
                },
                new SQLiteParameter()
                {
                    ParameterName = "@MANHOLE_TYPE", Value = this.MANHOLE_TYPE
                },
                new SQLiteParameter()
                {
                    ParameterName = "@SEDIMENT_DEPTH", Value = string.IsNullOrEmpty(this.SEDIMENT_DEPTH)?DBNull.Value:(object)this.SEDIMENT_DEPTH
                },
                new SQLiteParameter()
                {
                    ParameterName = "@FLOW_STATE", Value = this.FLOW_STATE
                },
                new SQLiteParameter()
                {
                    ParameterName = "@BOTTOM_TYPE", Value = this.BOTTOM_TYPE
                },
                new SQLiteParameter()
                {
                    ParameterName = "@MANHOLE_MATERIAL", Value = this.MANHOLE_MATERIAL
                },
                new SQLiteParameter()
                {
                    ParameterName = "@MANHOLE_SHAPE", Value = this.MANHOLE_SHAPE
                },
                new SQLiteParameter()
                {
                    ParameterName = "@COVER_MATERIAL", Value = this.COVER_MATERIAL
                },
                new SQLiteParameter()
                {
                    ParameterName = "@COVER_STATE", Value = this.COVER_STATE
                },
                new SQLiteParameter()
                {
                    ParameterName = "@WATER_QUALITY", Value = this.WATER_QUALITY
                },
                new SQLiteParameter()
                {
                    ParameterName = "@WATER_LEVEL", Value = string.IsNullOrEmpty(this.WATER_LEVEL)?DBNull.Value:(object)this.WATER_LEVEL
                },
                new SQLiteParameter()
                {
                    ParameterName = "@ID", Value = this.ID
                }
                //new SQLiteParameter(){ ParameterName="@ObjectID" ,Value=this.ObjectID,OleDbType= OleDbType.Integer}
            };
            string sql = string.Format("update PS_MANHOLE set SYSTEM_TYPE=@SYSTEM_TYPE,ROAD_NAME=@ROAD_NAME,"
                                       + "ACQUISITION_DATE=@ACQUISITION_DATE,ACQUISITION_UNIT=@ACQUISITION_UNIT,PROCESS_UNIT=@PROCESS_UNIT,"
                                       + "PROCESS_DATE=@PROCESS_DATE,STATE=@STATE,REMARK=@REMARK,"
                                       + "GROUND_LEVEL=@GROUND_LEVEL,CO_X=@CO_X,CO_Y=@CO_Y,SURVEY_ID=@SURVEY_ID,INVERT_LEVEL=@INVERT_LEVEL,"
                                       + " MANHOLE_TYPE=@MANHOLE_TYPE,SEDIMENT_DEPTH=@SEDIMENT_DEPTH,FLOW_STATE=@FLOW_STATE,BOTTOM_TYPE=@BOTTOM_TYPE,"
                                       + " MANHOLE_MATERIAL=@MANHOLE_MATERIAL,MANHOLE_SHAPE=@MANHOLE_SHAPE,COVER_MATERIAL=@COVER_MATERIAL,COVER_STATE=@COVER_STATE,"
                                       + " WATER_QUALITY=@WATER_QUALITY"
                                       + " where  ID=@ID ");

            IDataBase pDataBase = SysDBUnitiy.OleDataBase;

            pDataBase.OpenConnection();
            try
            {
                pDataBase.ExecuteNonQuery(sql, Parameters);
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                pDataBase.CloseConnection();
            }
        }
예제 #48
0
 public EventRepository(IDataBase dbService)
 {
     _dbService = dbService;
 }
예제 #49
0
        public override void Update()
        {
            string sql = "update  PS_PIPE  set   US_OBJECT_ID=@US_OBJECT_ID,DS_OBJECT_ID=@DS_OBJECT_ID,SYSTEM_TYPE=@SYSTEM_TYPE,Width=@Width,PIPE_LENGTH=@PIPE_LENGTH,"
                         + "US_POINT_INVERT_LEVEL=@US_POINT_INVERT_LEVEL,US_INVERT_LEVEL=@US_INVERT_LEVEL,DS_POINT_INVERT_LEVEL=@DS_POINT_INVERT_LEVEL,DS_INVERT_LEVEL=@DS_INVERT_LEVEL,SEDIMENT_DEPTH=@SEDIMENT_DEPTH,"
                         + "MATERIAL=@MATERIAL,STATE=@STATE,PRESSURE=@PRESSURE,ROAD_NAME=@ROAD_NAME,ACQUISITION_DATE=@ACQUISITION_DATE,Remark=@Remark,US_SURVEY_ID=@US_SURVEY_ID,DS_SURVEY_ID=@DS_SURVEY_ID,"
                         + "ACQUISITION_UNIT=@ACQUISITION_UNIT,PROCESS_DATE=@PROCESS_DATE,PROCESS_UNIT=@PROCESS_UNIT,SHAPE_Length=@SHAPE_Length,Water_State=@Water_State,WATER_QUALITY=@WATER_QUALITY,WATER_LEVEL=@WATER_LEVEL,Dirtcion=@Dirtcion  where ID=@ID  ";

            SQLiteParameter[] Parameters = new SQLiteParameter[]
            {
                new SQLiteParameter()
                {
                    ParameterName = "@US_OBJECT_ID", Value = this.US_OBJECT_ID
                },
                new SQLiteParameter()
                {
                    ParameterName = "@DS_OBJECT_ID", Value = this.DS_OBJECT_ID
                },
                new SQLiteParameter()
                {
                    ParameterName = "@SYSTEM_TYPE", Value = this.SYSTEM_TYPE
                },
                new SQLiteParameter()
                {
                    ParameterName = "@Width", Value = string.IsNullOrEmpty(this.Width)?DBNull.Value:(object)int.Parse(this.Width)
                },
                new SQLiteParameter()
                {
                    ParameterName = "@PIPE_LENGTH", Value = string.IsNullOrEmpty(this.Pipe_Length)?DBNull.Value:(object)double.Parse(this.Pipe_Length)
                },
                new SQLiteParameter()
                {
                    ParameterName = "@US_POINT_INVERT_LEVEL", Value = string.IsNullOrEmpty(this.US_POINT_INVERT_LEVEL)?DBNull.Value:(object)double.Parse(this.US_POINT_INVERT_LEVEL)
                },
                new SQLiteParameter()
                {
                    ParameterName = "@US_INVERT_LEVEL", Value = string.IsNullOrEmpty(this.US_INVERT_LEVEL)?DBNull.Value:(object)double.Parse(this.US_INVERT_LEVEL)
                },
                new SQLiteParameter()
                {
                    ParameterName = "@DS_POINT_INVERT_LEVEL", Value = string.IsNullOrEmpty(this.DS_POINT_INVERT_LEVEL)?DBNull.Value:(object)double.Parse(this.DS_POINT_INVERT_LEVEL)
                },
                new SQLiteParameter()
                {
                    ParameterName = "@DS_INVERT_LEVEL", Value = string.IsNullOrEmpty(this.DS_INVERT_LEVEL)?DBNull.Value:(object)double.Parse(this.DS_INVERT_LEVEL)
                },
                new SQLiteParameter()
                {
                    ParameterName = "@SEDIMENT_DEPTH", Value = string.IsNullOrEmpty(this.SEDIMENT_DEPTH)?DBNull.Value:(object)double.Parse(this.SEDIMENT_DEPTH)
                },

                new SQLiteParameter()
                {
                    ParameterName = "@MATERIAL", Value = this.MATERIAL
                },
                new SQLiteParameter()
                {
                    ParameterName = "@STATE", Value = this.STATE
                },
                new SQLiteParameter()
                {
                    ParameterName = "@PRESSURE", Value = this.PRESSURE
                },
                new SQLiteParameter()
                {
                    ParameterName = "@ROAD_NAME", Value = this.ROAD_NAME
                },
                new SQLiteParameter()
                {
                    ParameterName = "@ACQUISITION_DATE", Value = this.ACQUISITION_DATE
                },
                new SQLiteParameter()
                {
                    ParameterName = "@Remark", Value = this.Remark
                },
                new SQLiteParameter()
                {
                    ParameterName = "@US_SURVEY_ID", Value = this.US_SURVEY_ID
                },
                new SQLiteParameter()
                {
                    ParameterName = "@DS_SURVEY_ID", Value = this.DS_SURVEY_ID
                },
                new SQLiteParameter()
                {
                    ParameterName = "@ACQUISITION_UNIT", Value = this.ACQUISITION_UNIT
                },
                new SQLiteParameter()
                {
                    ParameterName = "@PROCESS_DATE", Value = this.PROCESS_Date
                },
                new SQLiteParameter()
                {
                    ParameterName = "@PROCESS_UNIT", Value = this.PROCESS_Unit
                },
                new SQLiteParameter()
                {
                    ParameterName = "@SHAPE_Length", Value = string.IsNullOrEmpty(this.Lenght)?DBNull.Value:(object)double.Parse(this.Lenght)
                },
                new SQLiteParameter()
                {
                    ParameterName = "@Water_State", Value = this.WATER_State
                },
                new SQLiteParameter()
                {
                    ParameterName = "@WATER_QUALITY", Value = this.WATER_QUALITY
                },
                new SQLiteParameter()
                {
                    ParameterName = "@WATER_LEVEL", Value = string.IsNullOrEmpty(this.WATER_LEVEL)?DBNull.Value:(object)double.Parse(this.WATER_LEVEL)
                },
                new SQLiteParameter()
                {
                    ParameterName = "@Dirtcion", Value = this.Dirtcion
                },
                //new SQLiteParameter(){ ParameterName="@OBJECTID" ,Value=this.ObjectID,OleDbType= OleDbType.Integer }
                new SQLiteParameter()
                {
                    ParameterName = "@ID", Value = this.ID
                }
            };
            IDataBase pDataBase = SysDBUnitiy.OleDataBase;

            pDataBase.OpenConnection();
            try
            {
                pDataBase.ExecuteNonQuery(sql, Parameters);
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                pDataBase.CloseConnection();
            }
        }
예제 #50
0
        /* public override void Delete()
         * {
         *
         *    string sql = string.Format("update {0} set IsDelete=0 where ID='{1}'", this.ClassName, this.ID);
         *    IDataBase pDataBase = SysDBUnitiy.OleDataBase;
         *    pDataBase.OpenConnection();
         *    try
         *    {
         *        pDataBase.ExecuteNonQuery(sql);
         *    }
         *    finally
         *    {
         *        pDataBase.CloseConnection();
         *    }
         *
         *
         * }*/
        public override void AddNew()
        {
            string sql = "insert into PS_PIPE(ID,US_OBJECT_ID,DS_OBJECT_ID,SYSTEM_TYPE,Width,PIPE_LENGTH,"
                         + "US_POINT_INVERT_LEVEL,US_INVERT_LEVEL,DS_POINT_INVERT_LEVEL,DS_INVERT_LEVEL,SEDIMENT_DEPTH,"
                         + "MATERIAL,STATE,PRESSURE,ROAD_NAME,ACQUISITION_DATE,Remark,US_SURVEY_ID,DS_SURVEY_ID,"
                         + "ACQUISITION_UNIT,PROCESS_DATE,PROCESS_UNIT,SHAPE_Length,Water_State,WATER_QUALITY,WATER_LEVEL,Dirtcion) "
                         + " values(@ID,@US_OBJECT_ID,@DS_OBJECT_ID,@SYSTEM_TYPE,@Width,@PIPE_LENGTH,"
                         + "@US_POINT_INVERT_LEVEL,@US_INVERT_LEVEL,@DS_POINT_INVERT_LEVEL,@DS_INVERT_LEVEL,@SEDIMENT_DEPTH,"
                         + "@MATERIAL,@STATE,@PRESSURE,@ROAD_NAME,@ACQUISITION_DATE,@Remark,@US_SURVEY_ID,@DS_SURVEY_ID,"
                         + "@ACQUISITION_UNIT,@PROCESS_DATE,@PROCESS_UNIT,@SHAPE_Length,@Water_State,@WATER_QUALITY,@WATER_LEVEL,@Dirtcion)";

            SQLiteParameter[] Parameters = new SQLiteParameter[]
            {
                new SQLiteParameter()
                {
                    ParameterName = "@ID", Value = this.ID
                },
                new SQLiteParameter()
                {
                    ParameterName = "@US_OBJECT_ID", Value = this.US_OBJECT_ID
                },
                new SQLiteParameter()
                {
                    ParameterName = "@DS_OBJECT_ID", Value = this.DS_OBJECT_ID
                },
                new SQLiteParameter()
                {
                    ParameterName = "@SYSTEM_TYPE", Value = this.SYSTEM_TYPE
                },
                new SQLiteParameter()
                {
                    ParameterName = "@Width", Value = this.Width
                },
                new SQLiteParameter()
                {
                    ParameterName = "@PIPE_LENGTH", Value = string.IsNullOrEmpty(this.Pipe_Length)?DBNull.Value:(object)double.Parse(this.Pipe_Length)
                },
                new SQLiteParameter()
                {
                    ParameterName = "@US_POINT_INVERT_LEVEL", Value = string.IsNullOrEmpty(this.US_POINT_INVERT_LEVEL)?DBNull.Value:(object)double.Parse(this.US_POINT_INVERT_LEVEL)
                },
                new SQLiteParameter()
                {
                    ParameterName = "@US_INVERT_LEVEL", Value = string.IsNullOrEmpty(this.US_INVERT_LEVEL)?DBNull.Value:(object)double.Parse(this.US_INVERT_LEVEL)
                },
                new SQLiteParameter()
                {
                    ParameterName = "@DS_POINT_INVERT_LEVEL", Value = string.IsNullOrEmpty(this.DS_POINT_INVERT_LEVEL)?DBNull.Value:(object)double.Parse(this.DS_POINT_INVERT_LEVEL)
                },
                new SQLiteParameter()
                {
                    ParameterName = "@DS_INVERT_LEVEL", Value = string.IsNullOrEmpty(this.DS_INVERT_LEVEL)?DBNull.Value:(object)double.Parse(this.DS_INVERT_LEVEL)
                },
                new SQLiteParameter()
                {
                    ParameterName = "@SEDIMENT_DEPTH", Value = string.IsNullOrEmpty(this.SEDIMENT_DEPTH)?DBNull.Value:(object)double.Parse(this.SEDIMENT_DEPTH)
                },

                new SQLiteParameter()
                {
                    ParameterName = "@MATERIAL", Value = this.MATERIAL
                },
                new SQLiteParameter()
                {
                    ParameterName = "@STATE", Value = this.STATE
                },
                new SQLiteParameter()
                {
                    ParameterName = "@PRESSURE", Value = this.PRESSURE
                },
                new SQLiteParameter()
                {
                    ParameterName = "@ROAD_NAME", Value = this.ROAD_NAME
                },
                new SQLiteParameter()
                {
                    ParameterName = "@ACQUISITION_DATE", Value = this.ACQUISITION_DATE
                },
                new SQLiteParameter()
                {
                    ParameterName = "@Remark", Value = this.Remark
                },
                new SQLiteParameter()
                {
                    ParameterName = "@US_SURVEY_ID", Value = this.US_SURVEY_ID
                },
                new SQLiteParameter()
                {
                    ParameterName = "@DS_SURVEY_ID", Value = this.DS_SURVEY_ID
                },
                new SQLiteParameter()
                {
                    ParameterName = "@ACQUISITION_UNIT", Value = this.ACQUISITION_UNIT
                },
                new SQLiteParameter()
                {
                    ParameterName = "@PROCESS_DATE", Value = this.PROCESS_Date
                },
                new SQLiteParameter()
                {
                    ParameterName = "@PROCESS_UNIT", Value = this.PROCESS_Unit
                },
                new SQLiteParameter()
                {
                    ParameterName = "@SHAPE_Length", Value = string.IsNullOrEmpty(this.Lenght)?DBNull.Value:(object)double.Parse(this.Lenght)
                },
                new SQLiteParameter()
                {
                    ParameterName = "@Water_State", Value = this.WATER_State
                },
                new SQLiteParameter()
                {
                    ParameterName = "@WATER_QUALITY", Value = this.WATER_QUALITY
                },
                new SQLiteParameter()
                {
                    ParameterName = "@WATER_LEVEL", Value = string.IsNullOrEmpty(this.WATER_LEVEL)?DBNull.Value:(object)double.Parse(this.WATER_LEVEL)
                },
                new SQLiteParameter()
                {
                    ParameterName = "@Dirtcion", Value = this.Dirtcion
                }
            };
            IDataBase pDataBase = SysDBUnitiy.OleDataBase;

            pDataBase.OpenConnection();
            try
            {
                pDataBase.ExecuteNonQuery(sql, Parameters);
                //this.CurClassName = "PS_PIPE";
                //sql = "select max(objectid) from PS_PIPE";
                //this.ObjectID = int.Parse(pDataBase.ExecuteScalar(sql).ToString());
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                pDataBase.CloseConnection();
            }
        }
예제 #51
0
        public override void Update()
        {
            string sql = "update  PS_SLUICE  set  US_OBJECT_ID=@US_OBJECT_ID,DS_OBJECT_ID=@DS_OBJECT_ID,SYSTEM_TYPE=@SYSTEM_TYPE,INVERT_LEVEL=@INVERT_LEVEL,Width=@Width,"
                         + "OPEN_LIMIT=@OPEN_LIMIT,SLUICE_TYPE=@SLUICE_TYPE,STATE=@STATE,ROAD_NAME=@ROAD_NAME,ACQUISITION_DATE=@ACQUISITION_DATE,Remark=@Remark,US_SURVEY_ID=@US_SURVEY_ID,DS_SURVEY_ID=@DS_SURVEY_ID,"
                         + "ACQUISITION_UNIT=@ACQUISITION_UNIT,PROCESS_DATE=@PROCESS_DATE,PROCESS_UNIT=@PROCESS_UNIT,SHAPE_Length=@SHAPE_Length  where  ID=@ID  ";

            SQLiteParameter[] Parameters = new SQLiteParameter[]
            {
                new SQLiteParameter()
                {
                    ParameterName = "@US_OBJECT_ID", Value = this.US_OBJECT_ID
                },
                new SQLiteParameter()
                {
                    ParameterName = "@DS_OBJECT_ID", Value = this.DS_OBJECT_ID
                },
                new SQLiteParameter()
                {
                    ParameterName = "@SYSTEM_TYPE", Value = this.SYSTEM_TYPE
                },
                new SQLiteParameter()
                {
                    ParameterName = "@INVERT_LEVEL", Value = string.IsNullOrEmpty(this.INVERT_LEVEL)?DBNull.Value:(object)double.Parse(this.INVERT_LEVEL)
                },
                new SQLiteParameter()
                {
                    ParameterName = "@Width", Value = string.IsNullOrEmpty(this.Width)?DBNull.Value:(object)double.Parse(this.Width)
                },
                new SQLiteParameter()
                {
                    ParameterName = "@OPEN_LIMIT", Value = string.IsNullOrEmpty(this.OPEN_LIMIT)?DBNull.Value:(object)double.Parse(this.OPEN_LIMIT)
                },
                new SQLiteParameter()
                {
                    ParameterName = "@SLUICE_TYPE", Value = this.SLUICE_TYPE
                },
                new SQLiteParameter()
                {
                    ParameterName = "@STATE", Value = this.STATE
                },
                new SQLiteParameter()
                {
                    ParameterName = "@ROAD_NAME", Value = this.ROAD_NAME
                },
                new SQLiteParameter()
                {
                    ParameterName = "@ACQUISITION_DATE", Value = this.ACQUISITION_DATE
                },
                new SQLiteParameter()
                {
                    ParameterName = "@Remark", Value = this.Remark
                },
                new SQLiteParameter()
                {
                    ParameterName = "@US_SURVEY_ID", Value = this.US_SURVEY_ID
                },
                new SQLiteParameter()
                {
                    ParameterName = "@DS_SURVEY_ID", Value = this.DS_SURVEY_ID
                },
                new SQLiteParameter()
                {
                    ParameterName = "@ACQUISITION_UNIT", Value = this.ACQUISITION_UNIT
                },
                new SQLiteParameter()
                {
                    ParameterName = "@PROCESS_DATE", Value = this.PROCESS_Date
                },
                new SQLiteParameter()
                {
                    ParameterName = "@PROCESS_UNIT", Value = this.PROCESS_Unit
                },
                new SQLiteParameter()
                {
                    ParameterName = "@SHAPE_Length", Value = string.IsNullOrEmpty(this.Lenght)?DBNull.Value:(object)double.Parse(this.Lenght)
                },
                new SQLiteParameter()
                {
                    ParameterName = "@ID", Value = this.ID
                }
            };
            IDataBase pDataBase = SysDBUnitiy.OleDataBase;

            pDataBase.OpenConnection();
            try
            {
                pDataBase.ExecuteNonQuery(sql, Parameters);
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                pDataBase.CloseConnection();
            }
        }
예제 #52
0
 public SelectTable(DBType dbType, string ConnectionStr) : this()
 {
     dataBase = DataBaseFactory.GetDataBase(dbType, ConnectionStr);
 }
예제 #53
0
 public static void InitDataBase()
 {
     _database = new SQL();
 }
예제 #54
0
        /// <summary>
        /// Process the startup args and initialise the logging.
        /// </summary>
        /// <param name="o"></param>
        /// <param name="args"></param>
        private static void Startup(DamselflyOptions o, string[] args)
        {
            Logging.Verbose = o.Verbose;
            Logging.Trace   = o.Trace;

            if (Directory.Exists(o.SourceDirectory))
            {
                if (!Directory.Exists(o.ConfigPath))
                {
                    Directory.CreateDirectory(o.ConfigPath);
                }

                Logging.LogFolder = Path.Combine(o.ConfigPath, "logs");

                Log.Logger = Logging.InitLogs();

                if (o.ReadOnly)
                {
                    o.NoEnableIndexing     = true;
                    o.NoGenerateThumbnails = true;
                }

                // TODO: Do away with static members here. We should pass this
                // through to the config service and pick them up via DI
                IndexingService.EnableIndexing = !o.NoEnableIndexing;
                IndexingService.RootFolder     = o.SourceDirectory;
                ThumbnailService.PicturesRoot  = o.SourceDirectory;
                ThumbnailService.Synology      = o.Synology;
                ThumbnailService.SetThumbnailRoot(o.ThumbPath);
                ThumbnailService.EnableThumbnailGeneration = !o.NoGenerateThumbnails;

                var tieredPGO = System.Environment.GetEnvironmentVariable("DOTNET_TieredPGO") == "1";

                Logging.Log("Startup State:");
                Logging.Log($" Damselfly Ver: {Assembly.GetExecutingAssembly().GetName().Version}");
                Logging.Log($" CLR Ver: {Environment.Version}");
                Logging.Log($" OS: {Environment.OSVersion}");
                Logging.Log($" CPU Arch: {RuntimeInformation.ProcessArchitecture}");
                Logging.Log($" Processor Count: {Environment.ProcessorCount}");
                Logging.Log($" Read-only mode: {o.ReadOnly}");
                Logging.Log($" Synology = {o.Synology}");
                Logging.Log($" Indexing = {!o.NoEnableIndexing}");
                Logging.Log($" ThumbGen = {!o.NoGenerateThumbnails}");
                Logging.Log($" Images Root set as {o.SourceDirectory}");
                Logging.Log($" TieredPGO Enabled={tieredPGO}");

                IDataBase dbType = null;

                if (!o.UsePostgresDB)
                {
                    string dbFolder = Path.Combine(o.ConfigPath, "db");

                    if (!Directory.Exists(dbFolder))
                    {
                        Logging.Log(" Created DB folder: {0}", dbFolder);
                        Directory.CreateDirectory(dbFolder);
                    }

                    string dbPath = Path.Combine(dbFolder, "damselfly.db");
                    dbType = new SqlLiteModel(dbPath);
                    Logging.Log(" Sqlite Database location: {0}", dbPath);
                }
                else // Postgres
                {
                    // READ Postgres config json
                    dbType = PostgresModel.ReadSettings("settings.json");
                    Logging.Log(" Postgres Database location: {0}");
                }

                // TODO: https://docs.microsoft.com/en-us/ef/core/managing-schemas/migrations/providers?tabs=dotnet-core-cli
                BaseDBModel.InitDB <ImageContext>(dbType, o.ReadOnly);

                // Make ourselves low-priority.
                System.Diagnostics.Process.GetCurrentProcess().PriorityClass = System.Diagnostics.ProcessPriorityClass.Idle;

                StartWebServer(o.Port, args);

                Logging.Log("Shutting down.");
            }
            else
            {
                Console.WriteLine("Folder {0} did not exist. Exiting.", o.SourceDirectory);
            }
        }
예제 #55
0
파일: frmMain.cs 프로젝트: MonoBrasil/CsDO
 private void CreateConnection()
 {
     switch (cbxDriver.SelectedIndex)
     {
         case (int) Config.DBMS.PostgreSQL:
             driver = new CsDO.Drivers.Npgsql.NpgsqlDriver(
                 Config.Server, Config.Port, Config.User,
                 Config.Database, Config.Password);
             break;
         case (int) Config.DBMS.OleDB:
             driver = new CsDO.Drivers.OleDb.OleDbDriver(
                 Config.Server, Config.Database, Config.User,
                 Config.Password);
             break;
         case (int) Config.DBMS.MSSQLServer:
             driver = new CsDO.Drivers.SqlServer.SqlServerDriver(
                 Config.Server, Config.User, Config.Database,
                 Config.Password);
             break;
         default:
             driver = null;
             break;
     }
 }
예제 #56
0
파일: DAOTest.cs 프로젝트: justinweb/FEDAO
 public PTTradingUnitOperator(IDataBase crtDataBase) : base(crtDataBase)
 {
     CurrentDataBase = crtDataBase;
     TableName       = MyTableName;
 }
예제 #57
0
 static Conf()
 {
     _driver = new CsDO.Drivers.Generic();
 }
예제 #58
0
파일: DAOTest.cs 프로젝트: justinweb/FEDAO
 public TestOperator(IDataBase crtDataBase) : base(crtDataBase)
 {
     CurrentDataBase = crtDataBase;
     this.TableName  = MyTableName;
 }
예제 #59
0
 private void SetDBMethod(IDataBase method)
 {
     _mainModel.DBMethod = method;
     _adminPanel.DB_Method = method;
     _mainModel.Load();
 }
예제 #60
0
파일: DAOTest.cs 프로젝트: justinweb/FEDAO
 public OracleDAOTestOperator(IDataBase database) : base(database)
 {
     TableName = myTableName;
 }