public MethodResponse <List <Product> > GetProducts()
        {
            var listProducts = new List <Product>();
            var response     = new MethodResponse <List <Product> >();

            try
            {
                var data    = new DataEngine();
                var dataSet = (DataSet)data.GetProducts().Result;

                foreach (DataTable table in dataSet.Tables)
                {
                    foreach (DataRow dr in table.Rows)
                    {
                        var products = new Product()
                        {
                            Nombre      = dr["Nombre"].ToString(),
                            Descripcion = dr["Descripcion"].ToString(),
                            Marca       = dr["Marca"].ToString(),
                            Precio      = double.Parse(dr["Precio"].ToString()),
                            Stock       = int.Parse(dr["Stock"].ToString())
                        };
                        listProducts.Add(products);
                    }
                }
                response.Code   = 0;
                response.Result = listProducts;
            }
            catch (Exception ex)
            {
                response.Code    = -1;
                response.Message = $"DataConversionError: {ex.Message}";
            }
            return(response);
        }
        public MethodResponse <string> DeleteProduct(object infoProduct)
        {
            var response = new MethodResponse <string>();

            try
            {
                var dataEngine = new DataEngine();
                var res        = dataEngine.DeleteProduct(infoProduct);

                if (int.Parse(res.Code.ToString()) != 0 && (bool)res.Result == false)
                {
                    return(new MethodResponse <string>()
                    {
                        Code = res.Code, Message = res.Message
                    });
                }
                response.Code    = 0;
                response.Message = "Se elimino correctamente el producto";
            }
            catch (Exception ex)
            {
                response.Code    = -1;
                response.Message = $"DataConversionError: {ex.Message}";
            }
            return(response);
        }
Esempio n. 3
0
        protected virtual DiffInfo LoadFromPackage(string path)
        {
            IProcessingContext context = new SimpleProcessingContext();

            CommandInstallerContext.Setup(context, Path.GetFileNameWithoutExtension(path), UpgradeAction.Preview, Sitecore.Update.Utils.InstallMode.Install, null, new List <ContingencyEntry>());
            ISource <PackageEntry> source    = new PackageReader(path);
            ISink <PackageEntry>   installer = DoCreateInstallerSink(context);
            var sorter = new PackageDumper(source);

            sorter.Initialize(context);
            sorter.Populate(installer);
            installer.Flush();
            var commands = new List <ICommand>(sorter.Commands);
            var engine   = new DataEngine {
                FilterCommands = false, OptimizeCommands = false
            };

            engine.ProcessCommands(ref commands);

            var          info = new DiffInfo(commands, string.Empty, string.Empty, "Generated by ConvertFromPackage command.");
            MetadataView view = UpdateHelper.LoadMetadata(path);

            if (view != null)
            {
                info.Readme      = view.Readme;
                info.InstallMode = view.Comment;
                info.Title       = view.PackageName;
            }
            ;

            return(info);
        }
        private void cmbLengthMaterial_SelectionChangeCommitted(Object sender, EventArgs e)
        {
            l = new Accessor.AtlanticCanvasLenght();
            l = cmbLengthMaterial.SelectedItem as Accessor.AtlanticCanvasLenght;

            materialID = l.MaterialID;
            tblMaterial mat = DataEngine.GetMaterial(materialID);

            lblFrame.Text      = mat.Name;
            lblMaterialID.Text = mat.MaterialID;

            costingSquareTwoFifty.MaterialID = l.MaterialID;
            costingSquareTwoFifty.SetDisplay();

            costingSquareAtwo.MaterialID = l.MaterialID;
            costingSquareAtwo.SetDisplay();

            costingFourFifty.MaterialID = l.MaterialID;
            costingFourFifty.SetDisplay();

            costingSquareFourFifty.MaterialID = l.MaterialID;
            costingSquareFourFifty.SetDisplay();

            costingPane.MaterialID = l.MaterialID;
            costingPane.SetDisplay();

            costingFiveFifty.MaterialID = l.MaterialID;
            costingFiveFifty.SetDisplay();

            SetDisplay();
        }
Esempio n. 5
0
        public object Execute(Expression expression)
        {
            var sqlExpression = ExecuteImp(expression, typeof(UpdateExpression));

            DataEngine.ExecuteNonQuery(sqlExpression);
            return(null);
        }
        public MethodResponse <string> InsProduct(object infoProduct)
        {
            var response = new MethodResponse <string>();

            try
            {
                var data = new DataEngine();

                if (infoProduct != null)
                {
                    var res = data.InsProduct(infoProduct);

                    if ((int)res.Code != 0 && (bool)res.Result == false)
                    {
                        return(new MethodResponse <string>()
                        {
                            Code = res.Code, Message = res.Message
                        });
                    }
                }
                response.Code    = 0;
                response.Message = "Se inserto correctamente el producto";
            }
            catch (Exception ex)
            {
                response.Code    = -1;
                response.Message = $"DataConversionError: {ex.Message}";
            }
            return(response);
        }
Esempio n. 7
0
        public FolderPage()
        {
            base.OnAppearing();

            if (viewModel == null)
            {
                viewModel = new FolderViewModel();
            }

            if (viewModel.Folders.Count == 0)
            {
                viewModel.LoadFoldersCommand.Execute(null);
            }

            List <Folder> CurrentFolders;

            new DataEngine(); //lazy init

            if (DataEngine.Folders == null)
            {
                CurrentFolders = DataEngine.getFolders();
            }
            else
            {
                CurrentFolders = DataEngine.Folders;
            }
            FoldersListView = new ListView();
            AddCellData(CurrentFolders);
        }
Esempio n. 8
0
        static void Main(string[] args)
        {
            SAPTestHelper.Current.SetSession();
            SAPTestHelper.Current.TurnScreenLog(ScreenLogLevel.All);
            DataEngine de = new DataEngine();

            DataEngine.GlobalBindingMode = new BindingMode()
            {
                LoopMode     = LoopType.Loop,
                RecusionMode = RecusionType.NoRecursion
            };
            DataSet ds = ExcelHelper.Current.Open(@"C:\Demo\1.xlsx").ReadAll();

            de.SetData(ds);
            ExcelHelper.Current.Close();
            de.CurrentId = 1;

            Driver.Current.SetDataEngine(de);

            WorkFlow flow = Driver.Current.GetWorkFlow(typeof(MB1A_CreateGoodsIssueDoc));

            flow.Execute();

            flow = Driver.Current.GetWorkFlow(typeof(MB03_DisplayMaterialDocument));
            flow.Execute();
            Driver.Current.Finish();

            SAPReport report = new SAPReport();
            TestStep  step1  = new TestStep();

            report.Detail.Add(step1);
            step1.InputDatas.Add(new TestData());
        }
Esempio n. 9
0
        private IEnumerable Select(Expression expression)
        {
            var elementType   = TypeSystem.GetElementType(expression.Type);
            var sqlExpression = ExecuteImp(expression, typeof(SelectExpression));

            return(DataEngine.ExecuteQuery(elementType, sqlExpression));
        }
Esempio n. 10
0
        /// <summary>
        /// 切换数据引擎。
        /// </summary>
        /// <returns></returns>
        public IActionResult ChangeDataEngine()
        {
            if (HttpContext.Request.Method.ToUpper() != "POST")
            {
                return(new JsonResult(new ResultMessage {
                    ResultCode = WebAPIStatus.STATE_FAIL, Message = "无效的请求。"
                }));
            }
            if (!(HttpContext.Request.Form.ContainsKey("key")))
            {
                return(new JsonResult(new ResultMessage {
                    ResultCode = WebAPIStatus.STATE_FAIL, Message = "未指定数据引擎的有效键名称。"
                }));
            }
            string        Key       = HttpContext.Request.Form["key"];
            int           rate      = DataEngine.ChangeEngine(Key);
            ResultMessage ResultMsg = new ResultMessage();

            if (rate == DataEngine.ENGINE_CHANGE_OK)
            {
                ResultMsg.ResultCode = WebAPIStatus.STATE_OK;
            }
            else
            {
                ResultMsg.ResultCode = rate;
                ResultMsg.Message    = "数据引擎切换失败。";
            }
            return(new JsonResult(ResultMsg));
        }
        public TestServiceContainer()
        {
            StorageDriver = new RamDriver();
            StorageDriver.Initialize(
                new DummyTracer(),
                new RamDriverSettings
            {
                Descriptor  = DataGen.BuildContainerDescriptor(),
                StorageRoot = ConfigurationManager.AppSettings["storageDriverInitString"]
            }
                );

            const int maxconcurrency = 16;

            ServiceInstanceName = TestHostInstanceName;
            Engine = new DataEngine(
                new DummyTracer(),
                ServiceInstanceName + "-Engine", maxconcurrency, StorageDriver, StorageDriver.GetDescriptor());
            EngineCache = new TestableEngineCache(Engine);
            DataService = new DataService(
                new DummyTracer(),
                new DummyHostedProcess(), ServiceInstanceName, maxconcurrency, EngineCache);
            DataServiceHost = CreateServiceHost(DataService, new[]
            {
                new Uri("net.tcp://" + TestHostBaseAddressTcp)
            }, maxconcurrency, ServiceInstanceName, maxconcurrency);
            DataServiceHost.Opened += DataServiceHostOnOpened;
            DataServiceHost.Open();
        }
Esempio n. 12
0
        public void Update(Expression expression, Expression updateExpression)
        {
            var sqlExpression = (UpdateExpression)ExecuteImp(expression, typeof(UpdateExpression));

            sqlExpression.Set = updateExpression;
            DataEngine.ExecuteNonQueryExpression(sqlExpression);
        }
        public void Init(DataEngine eng)
        {
            this.eng = eng;
            tableLayoutPanel1.SuspendLayout();

            tblFields.SuspendLayout();
            tblFields.Controls.Clear();

            tblFields.RowStyles.Clear();
            tblFields.RowCount = 1;

            for (var i = 0; i < eng.Categories.Count; i++)
            {
                var fl = new FieldLabel(eng.Categories[i]);
                tblFields.Controls.Add(fl, 0, tblFields.RowCount);
                tblFields.RowCount++;
            }

            for (var i = 0; i < eng.Measures.Count; i++)
            {
                var fl = new FieldLabel(eng.Measures[i]);
                tblFields.Controls.Add(fl, 0, tblFields.RowCount);
                tblFields.RowCount++;
            }
            tblFields.ResumeLayout();

            tableLayoutPanel1.ResumeLayout();
        }
Esempio n. 14
0
 //Инициализация формы
 public Form1()
 {
     InitializeComponent();
     foreach (IceButton.IceButton i in tmenu.Controls)
     {
         i.Text = i.Tag.ToString();
     }
     try
     {
         if (!System.IO.File.Exists(fileName))
         {
             System.IO.File.WriteAllBytes(fileName, Source.template);
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
         System.Threading.Thread.CurrentThread.Abort();
     }
     dt = new DataEngine(fileName, "ID", "Dates", "Header", "Body", "Worker", "IsDone");
     LoadToGrid(dt.SelectAllTasks(tableName));
     iceButton1.Click += new EventHandler(iceButton1_Click); //Sea
     iceButton2.Click += new EventHandler(iceButton2_Click); //Add
     iceButton5.Click += new EventHandler(iceButton5_Click); //Delete one
     iceButton6.Click += new EventHandler(iceButton6_Click); //ToDay
     iceButton4.Click += new EventHandler(iceButton4_Click);
     iceButton3.Click += new EventHandler(iceButton3_Click);
     t_search.KeyDown += new KeyEventHandler(t_search_KeyDown);
     dataGridView1.CellDoubleClick += new DataGridViewCellEventHandler(dataGridView1_CellDoubleClick);
 }
Esempio n. 15
0
 public AnalyticsEngine()
 {
     _metricCollection = new List <IMetric>();
     _factorMethods    = new List <Func <IMetric> >();
     dataEngine        = new DataEngine();
     //dataEngine.SetDataEngine(@"C:\Users\hawk\Desktop\Ruslans Data_1");
 }
Esempio n. 16
0
 /// <summary>
 /// 创建一个 <see cref="TransactionDbAccess"/> 的对象实例。
 /// </summary>
 /// <param name="cmd">与事务关联的 DbCommand 对象。</param>
 /// <param name="owner">创建该事务的引擎对象实例。</param>
 internal TransactionDbAccess(IDbCommand cmd, DataEngine owner)
 {
     DbCommand      = cmd;
     _Engine        = owner;
     _parserAdapter = owner.CommandParserAdapter;
     _Errors        = new List <DbError>();
 }
Esempio n. 17
0
        private async Task <ItemDefinition> GetItemInformation(String ItemFieldName, IEnumerable <dynamic> characterEquipment, DictionaryComponentResponseOfint64AndDestinyItemInstanceComponent instancedItems)
        {
            try
            {
                var items = await DataEngine.GetDetailedInformationFromHash <ItemDefinition>(DestinyTable.ItemDefinition, characterEquipment.Select(x => (ulong)x.itemHash).ToArray());

                var itemHash = (await DataEngine.GetTableDump <dynamic>(DestinyTable.InventoryBucketDefinition))
                               .Where(x => x.Value.displayProperties.name == ItemFieldName).Select(x => new { x.Key, x.Value }).First();

                var item = items.Where(x => x.Value.inventory.bucketTypeHash == itemHash.Key).Select(x => x.Value).First();

                var intaItem = (long)(characterEquipment.Where(x => x.itemHash == item.hash).Select(x => x.itemInstanceId).First());

                var instanceItem = instancedItems.data.Where(x => x.Key == intaItem).Select(x => x.Value).First();

                if (instanceItem.primaryStat != null)
                {
                    var statName = (await DataEngine.GetDetailedInformationFromHash <dynamic>(DestinyTable.StatDefinition, instanceItem.primaryStat.statHash)).First().Value.displayProperties.name;

                    instanceItem.primaryStat.StatName = statName;
                }
                item.ItemInstanceInformation = instanceItem;

                return(item);
            }
            catch (Exception ex)
            {
                return(null);
            }
        }
Esempio n. 18
0
        /// <summary>
        /// 初始化要使用的 Wunion.DataAdapter.NetCore 数据引擎。
        /// </summary>
        /// <param name="env">用于获到当前请求 Hotting 信息的对象。</param>
        /// <param name="configuration">用于读取 appsettings.json 配置文件的对象。</param>
        public static void UseDataEngine(IHostingEnvironment env, IConfiguration configuration)
        {
            IConfigurationSection Section   = configuration.GetSection("ConnectionStrings");
            SqliteDbAccess        SqliteDBA = new SqliteDbAccess();
            string wwwroot = env.WebRootPath;

            if (wwwroot[wwwroot.Length - 1] != '\\')
            {
                wwwroot += "\\";
            }
            SqliteDBA.ConnectionString = Section.GetValue <string>("SQLite").Replace("{wwwroot}", wwwroot);
            DataEngine.AppendDataEngine(SqliteDBA, new SqliteParserAdapter()); // 添加为默认引擎。

            SqlServerDbAccess MsSqlDBA = new SqlServerDbAccess();

            MsSqlDBA.ConnectionString = Section.GetValue <string>("SQLServer");
            DataEngine.AppendDataEngine(MsSqlDBA, new SqlServerParserAdapter(), "SQLServer");

            MySqlDBAccess MySqlDBA = new MySqlDBAccess();

            MySqlDBA.ConnectionString = Section.GetValue <string>("MariaDB");
            DataEngine.AppendDataEngine(MySqlDBA, new MySqlParserAdapter(), "MariaDB");

            NpgsqlDbAccess NpgsqlDBA = new NpgsqlDbAccess();

            NpgsqlDBA.ConnectionString = Section.GetValue <string>("PostgreSQL");
            DataEngine.AppendDataEngine(NpgsqlDBA, new NpgsqlParserAdapter(), "PostgreSQL");
        }
Esempio n. 19
0
        public void Locate_Non_Existent()
        {
            DataEngine.InitializeEngines();
            var engine = DataEngine.Locate("ThisNameSurelyDon'tExist");

            Assert.IsNull(engine);
        }
        private bool ExecuteCreateTable(TestExecutePattern pattern, DataEngine db, string tableName, object controller)
        {
            int result          = 0;
            DbCommandBuilder cb = GetTableBuilder(tableName);

            Debug.WriteLine("");
            if (pattern == TestExecutePattern.InTransaction)
            {
                Debug.WriteLine("在事务中执行!");
                DBTransactionController trans = (DBTransactionController)controller;
                Debug.WriteLine(cb.Parsing(db.CommandParserAdapter));
                Debug.WriteLine("执行结果:");
                if (trans.DBA.TableExists(tableName))
                {
                    Debug.Write(string.Format("创建失败,表名 {0} 在数据库中已存在!", tableName));
                    return(false);
                }
                else
                {
                    result = trans.DBA.ExecuteNoneQuery(cb); // execute create table.
                    if (result != -1)
                    {
                        Debug.Write(string.Format("成功创建表 {0} !", tableName));
                        return(true);
                    }
                    else
                    {
                        Debug.Write(trans.DBA.Errors.LastOrDefault().Message);
                        return(false);
                    }
                }
            }
            else
            {
                Debug.WriteLine("批量处理器执行!");
                BatchCommander batch = (BatchCommander)controller;
                Debug.WriteLine(cb.Parsing(db.CommandParserAdapter));
                Debug.WriteLine("执行结果:");
                if (batch.TableExists(tableName))
                {
                    Debug.Write(string.Format("表名 {0} 在数据库中已存在!", tableName));
                    return(false);
                }
                else
                {
                    result = batch.ExecuteNonQuery(cb); // execute create table.
                    if (result != -1)
                    {
                        Debug.Write(string.Format("成功创建表 {0} !", tableName));
                        return(true);
                    }
                    else
                    {
                        Debug.Write(string.Format("表 {0} 创建失败!", tableName));
                        return(false);
                    }
                }
            }
        }
Esempio n. 21
0
 protected virtual void UseConnectionPool(DataEngine db)
 {
     db.UseDefaultConnectionPool((pool) => {
         pool.RequestTimeout     = TimeSpan.FromSeconds(15);
         pool.ReleaseTimeout     = TimeSpan.FromMinutes(10);
         pool.MaximumConnections = 32;
     });
 }
Esempio n. 22
0
 /// <summary>
 /// 创建一个 <see cref="MultiQuerySelector"/> 的对象实例.
 /// </summary>
 /// <param name="engine">用于执行查询的数据引擎.</param>
 internal MultiQuerySelector(DataEngine engine)
 {
     ReadEngine    = engine;
     Command       = new DbCommandBuilder();
     fBlock        = new FromBlock();
     AgentsIndexes = new Dictionary <Type, AgentBufferItem>();
     Agents        = new List <AgentBufferItem>();
 }
Esempio n. 23
0
 public void Init()
 {
     engine            = new SqliteEngine("");
     ArchivesServer    = new ArchivesDataServer();
     ArchivesServer.DB = engine;
     HumanServer       = new HumanDataServer();
     HumanServer.DB    = engine;
 }
Esempio n. 24
0
        public void Locate_Engine_ForTest()
        {
            DataEngine.InitializeEngines();
            var engine = DataEngine.Locate("AnInvariantName");

            Assert.IsNotNull(engine);
            ConsoleEx.WriteLine("\n- {0}\n", engine);
        }
        public void SQLite3()
        {
            Debug.WriteLine("");
            Debug.WriteLine("SQLite3 -----------------");
            DataEngine db = GetDbContext("sqlite3", useConnectionPool: false);

            ExecuteDrop(db);
        }
 private void ExecuteDrop(DataEngine db)
 {
     using (BatchCommander batch = new BatchCommander(db))
     {
         ExecuteDrop(batch, table_products);
         ExecuteDrop(batch, table_categories);
     }
 }
Esempio n. 27
0
        public void ClinicianLanding_TC()
        {
            DataEngine keyDataEngine = new DataEngine();

            //http://jira.auscare.local:8080/secure/Tests.jspa#/testCase/CHS-T832
            keyDataEngine.ExecuteScript(@"C:\Users\anushri.mundada\source\repos\SeleniumProject\TestData\KD.xlsx", "ClinicianLanding");

            Thread.Sleep(3333);
        }
        public void PostgreSQL()
        {
            Debug.WriteLine("");
            Debug.WriteLine("PostgreSQL -----------------");
            DataEngine db = GetDbContext("npgsql");

            ExecuteDrop(db);
            ReleaseDb(db);
        }
        public void MySQL()
        {
            Debug.WriteLine("");
            Debug.WriteLine("MySQL -----------------");
            DataEngine db = GetDbContext("mysql");

            ExecuteDrop(db);
            ReleaseDb(db);
        }
        public void SQLServer()
        {
            Debug.WriteLine("");
            Debug.WriteLine("Microsoft SQL Server -----------------");
            DataEngine db = GetDbContext("ms-sql");

            ExecuteDrop(db);
            ReleaseDb(db);
        }
Esempio n. 31
0
        public static void UsingSampleData()
        {
            var dataEngine = new DataEngine();

            dataEngine.IsUsingSampleData = true;
            var p = dataEngine.Create <Student>();

            Console.WriteLine($"{p.Name}:{p.Age} has scores below\nMath:{p.Math}\nEnglish:{p.English}\nHistory:{p.History}\nTotal:{p.TotalScole()}");
        }
Esempio n. 32
0
        /// <summary>
        /// Gets the diff.
        /// </summary>
        /// <param name="sourcePath">The source path.</param>
        /// <param name="targetPath">The target path.</param>
        /// <returns>
        /// The diff.
        /// </returns>
        public static List<ICommand> GetDiffCommands(string sourcePath, string targetPath)
        {
            var targetManager = Factory.Instance.GetSourceDataManager();
              var sourceManager = Factory.Instance.GetTargetDataManager();

              sourceManager.SerializationPath = sourcePath;
              targetManager.SerializationPath = targetPath;
              IDataIterator sourceDataIterator = sourceManager.ItemIterator;
              IDataIterator targetDataIterator = targetManager.ItemIterator;

              var engine = new DataEngine();

              var commands = new List<ICommand>();
              commands.AddRange(GenerateDiff(sourceDataIterator, targetDataIterator));
              engine.ProcessCommands(ref commands);
              return commands;
        }
Esempio n. 33
0
        public static List<ICommand> GetDiffCommands(string sourcePath, string targetPath, CollisionBehavior collisionBehavior = CollisionBehavior.Undefined)
        {
            var targetManager = Factory.Instance.GetSourceDataManager();
              var sourceManager = Factory.Instance.GetTargetDataManager();

              sourceManager.SerializationPath = sourcePath;
              targetManager.SerializationPath = targetPath;

              IDataIterator sourceDataIterator = sourceManager.ItemIterator;
              IDataIterator targetDataIterator = targetManager.ItemIterator;

              var engine = new DataEngine();

              var commands = new List<ICommand>();
              commands.AddRange(GenerateDiff(sourceDataIterator, targetDataIterator));
            //if an item is found to be deleted AND added, we can be sure it's a move
              var deleteCommands = commands.OfType<DeleteItemCommand>();
              var shouldBeUpdateCommands =
              commands.OfType<AddItemCommand>()
              .Select(a => new
              {
                  Added = a,
                  Deleted = deleteCommands.FirstOrDefault(d => d.ItemID == a.ItemID)
              }).Where(u => u.Deleted != null).ToList();
              foreach (var command in shouldBeUpdateCommands)
              {
              commands.AddRange(command.Deleted.GenerateUpdateCommand(command.Added));
              commands.Remove(command.Added);
              commands.Remove(command.Deleted);
              //now, this one is an assumption, but would go wrong without the assumption anyway: this assumption is in fact safer
              //if the itempath of a delete command starts with this delete command, it will be moved along to the new node, not deleted, just leave it alone
              commands.RemoveAll(c => c is DeleteItemCommand && ((DeleteItemCommand)c).ItemPath.StartsWith(command.Deleted.ItemPath));
              }

              commands.ForEach(_ => _.CollisionBehavior = collisionBehavior);

              engine.ProcessCommands(ref commands);
              return commands;
        }
        public List<ICommand> GetDiffCommands(string sourcePath, string targetPath)
        {
            Console.WriteLine("The source path is: " + sourcePath);
            Console.WriteLine("The Target path is: " + targetPath);
            RemoveUnWantedItems(sourcePath);
            RemoveUnWantedItems(targetPath);

            var targetManager = Factory.Instance.GetSourceDataManager();
            var sourceManager = Factory.Instance.GetTargetDataManager();

            sourceManager.SerializationPath = sourcePath;
            targetManager.SerializationPath = targetPath;
            var sourceDataIterator = sourceManager.ItemIterator;
            var targetDataIterator = targetManager.ItemIterator;

            var engine = new DataEngine();

            var commands = new List<ICommand>();
            commands.AddRange(GenerateDiff(sourceDataIterator, targetDataIterator));
            engine.ProcessCommands(ref commands);
            return commands;
        }
Esempio n. 35
0
        public void TestMethod1()
        {
            var prop = typeof(ReflectionTest).GetProperties().Where(p => p.PropertyType.IsPrimitive).ToList();

            DataEngine de = new DataEngine();

            de.IsUsingSampleData = true;
            var sample = de.Create<SampleDataTest>();
            Assert.AreEqual(sample.Age, 11);
            var sample1 = de.Create<SampleDataB>();
            Assert.AreEqual(sample1.Age, 11);
        }
Esempio n. 36
0
            private void button31_Click(object sender, EventArgs e)
            {
                SqlConnection conn = new SqlConnection("Data Source=(local);Initial Catalog=cdsj;Integrated Security=True");
                conn.Open();
                SqlDataAdapter dbAdapter4 = new SqlDataAdapter();
                dbAdapter4.SelectCommand = new SqlCommand("procGetData", conn);  //存储过程名称procGetData
                dbAdapter4.SelectCommand.CommandType = CommandType.StoredProcedure;
                dbAdapter4.SelectCommand.Parameters.Add("@sc", System.Data.SqlDbType.NVarChar, 50);   //传入参数
                dbAdapter4.SelectCommand.Parameters["@sc"].Value = "JA01010008201";

                dbAdapter4.Fill(ds_pollution, "pt");
                conn.Close();

                DataTable _dt = new DataTable();
                _dt = ds_pollution.Tables[0].Clone();
                
                DataEngine de = new DataEngine();
                de.Data = _dt;
                de.DataFields = "YAxis=concentration,XAxis=test_time";

                chart31.Title = "统计图标题"; 
                //chart31.Use3D =  true ; // 3D效果
         
                //chart31.DefaultSeries.DefaultElement.Transparency = 10;
                //chart31.ShadingEffectMode =  ShadingEffectMode.Five;  // 3d效果的色彩数

                chart31.DefaultSeries.Type = SeriesType.Line; //折线

                //chart31.DefaultSeries.Type = SeriesType.Column; //柱状
                // chart31.DefaultSeries.Type = SeriesType.Spline; //曲线

                //chart31.YAxis.Scale =;
                chart31.XAxis.Label.Text = "x轴标题";
                chart31.YAxis.Label.Text = "y轴标题";

                //chart31.TempDirectory = Application.StartupPath;
                //chart31.FileName = "Dailysell";
                chart31.SeriesCollection.Clear();
                //chart31.Series.Data= ds_pollution.Tables[0];
                chart31.SeriesCollection.Add(de.GetSeries());
                
            }
Esempio n. 37
0
        private void InitializeComponents()
        {
            DataEngine = new DataEngine(this, 0);
            PreFrameLogicEngine = new PreFrameLogicEngine(this, 2);
            LogicEngine = new LogicEngine(this, 3);
            PostFrameLogicEngine = new PostFrameLogicEngine(this, 4);
            _uiEngine = new UIEngineImpl(this, 1);
            Stats = new StatsBase(this, 7);
            SoundEngine = new SoundEngineXNA(this, 5);
            Components.Add(PreFrameLogicEngine);
            Components.Add(LogicEngine);
            Components.Add(PostFrameLogicEngine);
            Components.Add(SoundEngine);
            Components.Add(_uiEngine);
            Components.Add(Stats);
            SoundEngine.Enabled = !CommandLineOptions.DedicatedServer;
            _uiEngine.Enabled = true;

            if (!CommandLineOptions.DedicatedServer)
            {
                GraphicsEngine = new GraphicsEngineImpl(this, 6);
                Components.Add(GraphicsEngine);
            }
        }
Esempio n. 38
0
    private void generarGraficos(string formatoSeleccionado1, string formatoSeleccionado2)
    {
        DataEngine de = new DataEngine();

        Chart1.TitleBox.Visible = false;

        if (formatoSeleccionado1 == "SUM")
          Chart1.Title = "Numero de Ajustes por ";
        else
          Chart1.Title = "Promedio de Ajustes por ";

        de.DataFields = "XAxis=descripcion,YAxis=cantidad,Name=descripcion";
        Chart1.Series.DataFields = "XAxis=descripcion,YAxis=cantidad,Name=descripcion";

        switch (formatoSeleccionado2)
        {
          case "SINIESTRO":
        Chart1.Title += "Siniestro";
        break;
          case "PRODUCTO":
        Chart1.Title += "Producto";
        break;
          case "RAMO":
        Chart1.Title += "Ramo";
        break;
          case "ASEGURADORA":
        Chart1.Title += "Aseguradora";
        break;
          case "COBERTURA":
        Chart1.Title += "Cobertura";
        break;
          case "BROKER":
        Chart1.Title += "Broker";
        break;
          case "AJUSTADOR":
        Chart1.Title += "Ajustador";
        break;
        }

        formatoGrafico(this.Chart1, "PIE");

        de.Data = dataPie(formatoSeleccionado1, formatoSeleccionado2);
        Chart1.SeriesCollection.Clear();
        Chart1.SeriesCollection.Add(de.GetSeries());
        Chart1.DataBind();
    }
        protected override void ProcessRecord()
        {
            // Use default logger
            XmlConfigurator.Configure((XmlElement) ConfigurationManager.GetSection("log4net"));

            PerformInstallAction("admin",
                () =>
                {
                    var targetManager = Factory.Instance.GetSourceDataManager();
                    var sourceManager = Factory.Instance.GetTargetDataManager();

                    sourceManager.SerializationPath = SourcePath;
                    targetManager.SerializationPath = TargetPath;

                    var sourceDataIterator = sourceManager.ItemIterator;
                    var targetDataIterator = targetManager.ItemIterator;

                    var engine = new DataEngine();

                    var commands = new List<ICommand>();
                    commands.AddRange(GenerateDiff(sourceDataIterator, targetDataIterator));
                    //if an item is found to be deleted AND added, we can be sure it's a move
                    var deleteCommands = commands.OfType<DeleteItemCommand>();
                    var shouldBeUpdateCommands =
                        commands.OfType<AddItemCommand>()
                            .Select(a => new
                            {
                                Added = a,
                                Deleted = deleteCommands.FirstOrDefault(d => d.ItemID == a.ItemID)
                            }).Where(u => u.Deleted != null).ToList();
                    foreach (var command in shouldBeUpdateCommands)
                    {
                        commands.AddRange(command.Deleted.GenerateUpdateCommand(command.Added));
                        commands.Remove(command.Added);
                        commands.Remove(command.Deleted);
                        //now, this one is an assumption, but would go wrong without the assumption anyway: this assumption is in fact safer
                        //if the itempath of a delete command starts with this delete command, it will be moved along to the new node, not deleted, just leave it alone
                        commands.RemoveAll(
                            c =>
                                c is DeleteItemCommand &&
                                ((DeleteItemCommand) c).ItemPath.StartsWith(command.Deleted.ItemPath));
                    }

                    engine.ProcessCommands(ref commands);
                    WriteObject(commands, true);
                });
        }