예제 #1
0
        public void TestProduct1()
        {
            IProductFactory pf      = new MockProductFactory();
            string          xmlPath = Path.Combine(Environment.CurrentDirectory, "ProductSample.xml");
            ProductBase     product = pf.CreateProduct("TestProduct", xmlPath);

            // as if we are taking order transactions from database
            Dictionary <string, object> row = new Dictionary <string, object>();

            row.Add("Amount", 3000);
            //row.Add("Amount", (Decimal)3000);
            //row.Add("Amount", DBNull.Value);
            //row.Add("Amount", null);
            row.Add("DealPrice", (Decimal)1.25);
            row.Add("DealerID", "Somebody");

            IDataSourceStore dsStore = new DataSourceStore();
            IDataSource      ds      = new TableDataSource(row);

            dsStore.AddDataSource(ds);

            foreach (var evDef in product.GetHoldEvents(dsStore))
            {
                foreach (var result in product.TakeReactionsFor(evDef, dsStore))
                {
                    Decimal amount = (Decimal)result.Item2["Amount"];
                    Assert.AreEqual <Decimal>(-3000, amount);
                    // insert dictionary columns into database accounting table
                }
            }
        }
예제 #2
0
        public void SETFASTREPORT4()
        {
            //20210902密
            Class1 TKID = new Class1();//用new 建立類別實體
            SqlConnectionStringBuilder sqlsb = new SqlConnectionStringBuilder(ConfigurationManager.ConnectionStrings["dbconn"].ConnectionString);

            //資料庫使用者密碼解密
            sqlsb.Password = TKID.Decryption(sqlsb.Password);
            sqlsb.UserID   = TKID.Decryption(sqlsb.UserID);

            String connectionString;

            sqlConn = new SqlConnection(sqlsb.ConnectionString);

            StringBuilder SQL1 = new StringBuilder();

            SQL1 = SETSQL4();
            Report report4 = new Report();

            report4.Load(@"REPORT\訂單排產狀況表.frx");

            report4.Dictionary.Connections[0].ConnectionString = sqlsb.ConnectionString;

            TableDataSource table = report4.GetDataSource("Table") as TableDataSource;

            table.SelectCommand = SQL1.ToString();

            report4.Preview = previewControl4;
            report4.Show();
        }
예제 #3
0
        public void SETFASTREPORT2()
        {
            string SQL;
            string SQL2;

            report1 = new Report();
            report1.Load(@"REPORT\原物料的進貨矩陣.frx");

            // 20210902密
            Class1 TKID = new Class1();//用new 建立類別實體
            SqlConnectionStringBuilder sqlsb = new SqlConnectionStringBuilder(ConfigurationManager.ConnectionStrings["dbconn"].ConnectionString);

            //資料庫使用者密碼解密
            sqlsb.Password = TKID.Decryption(sqlsb.Password);
            sqlsb.UserID   = TKID.Decryption(sqlsb.UserID);

            String connectionString;

            sqlConn = new SqlConnection(sqlsb.ConnectionString);

            report1.Dictionary.Connections[0].ConnectionString = sqlsb.ConnectionString;


            //report1.Dictionary.Connections[0].ConnectionString = "server=192.168.1.105;database=TKPUR;uid=sa;pwd=dsc";

            TableDataSource Table = report1.GetDataSource("Table") as TableDataSource;

            SQL = SETFASETSQL2();
            Table.SelectCommand = SQL;

            report1.Preview = previewControl2;
            report1.Show();
        }
예제 #4
0
        public void SETFASTREPORT()
        {
            StringBuilder SQL = new StringBuilder();



            Report report1 = new Report();

            if (comboBox5.Text.Equals("遊覽車對帳明細表"))
            {
                report1.Load(@"REPORT\遊覽車對帳明細表.frx");

                SQL = SETSQL();
            }
            else if (comboBox5.Text.Equals("多年期月份團務比較表"))
            {
                report1.Load(@"REPORT\多年期月份團務比較表.frx");

                SQL = SETSQL2();
            }

            report1.Dictionary.Connections[0].ConnectionString = ConfigurationManager.ConnectionStrings["dbconn"].ConnectionString;
            TableDataSource table = report1.GetDataSource("Table") as TableDataSource;

            table.SelectCommand = SQL.ToString();
            report1.SetParameterValue("P1", dateTimePicker4.Value.ToString("yyyy/MM/dd"));
            report1.SetParameterValue("P2", dateTimePicker5.Value.ToString("yyyy/MM/dd"));

            report1.Preview = previewControl1;
            report1.Show();
        }
        protected void BeginInsertBatch(Action<IEnumerable<TableStorageOperationState>> action)
        {
            var ds = new TableDataSource<TableEntry>();

            int enteries = DEFAULT_ENTERIES;
            if (txtEnteries.Text != "")
                enteries = Convert.ToInt32(txtEnteries.Text);

            int size = DEFAULT_SIZE;
            if (txtSize.Text != "")
                size = Convert.ToInt32(txtSize.Text);

            byte[] data = new byte[size];

            var list = new List<TableEntry>();

            for (int i = 0; i < enteries; i++)
            {
                // Spread partition key into groups with the max entity transaction count
                string partitionKey = Math.Ceiling((double)(i+1) / (Data.Constants.MAX_ENTITY_TRANSACTION_COUNT * Convert.ToInt32(txtPartitions.Text))).ToString();

                list.Add(new TableEntry(partitionKey, data));
            }

            ds.AddTableEntryAsync(list, action);
        }
예제 #6
0
        private void LoadDataSources(Dictionary <string, Dictionary <string, object> > configuration)
        {
            foreach (KeyValuePair <string, Dictionary <string, object> > sourceEntry in configuration)
            {
                string name = sourceEntry.Key;
                string type = (string)sourceEntry.Value["type"];

                if (type == "sql")
                {
                    _dataSources[name] = new SqlDataSource(_app, name, sourceEntry.Value);
                    Runtime.TraceInfo("Created sql data source named '%s'.", name);
                }
                else if (type == "tableStorage")
                {
                    _dataSources[name] = new TableDataSource(_app, name, sourceEntry.Value);
                    Runtime.TraceInfo("Created table storage data source named '%s'.", name);
                }
                else if (type == "inproc")
                {
                    _dataSources[name] = new InprocDataSource(_app, name, sourceEntry.Value);
                    Runtime.TraceInfo("Created local in-memory data source named '%s'.", name);
                }
                else
                {
                    Runtime.Abort("Missing or invalid type attribute for data source named '%s'.", name);
                }
            }
        }
예제 #7
0
        private void Initialization()
        {
            if (tableDataSource == null)
            {
                DataTable filterRefTable = DataSourceHelper.GetDataTable(DataSource);

                // Initialization SessionWorker
                if (SessionWorker == null)
                {
                    var sw = new SessionWorker {
                        Key = Guid.NewGuid().ToString()
                    };
                    sw.SetSession(HttpContext.Current.Session);
                    sw.Object     = filterRefTable.DataSet;
                    SessionWorker = sw;
                }

                // Initialization tableDataSource
                Type tableAdapterType =
                    TableAdapterTools.GetTableAdapterType(filterRefTable.GetType());
                tableDataSource = new TableDataSource
                {
                    ID            = "tableDataSource_ID",
                    TypeName      = tableAdapterType.FullName,
                    SelectMethod  = this._storage.SelectMethod,
                    FillType      = TableDataSourceFillType.ParametersNotChanged,
                    SessionWorker = this.SessionWorker,
                    SetFilterByCustomConditions = false,
                };
                tableDataSource.View.CustomConditions.AddRange(_storage.CustomConditions);
            }
        }
예제 #8
0
        public MyTableView()
        {
            InitializeComponent();

            Delegate   = new TableDelegate();
            DataSource = new TableDataSource();
        }
예제 #9
0
        public void SETFASTREPORT5(string SDAY, string TG006)
        {
            //20210902密
            Class1 TKID = new Class1();//用new 建立類別實體
            SqlConnectionStringBuilder sqlsb = new SqlConnectionStringBuilder(ConfigurationManager.ConnectionStrings["dbconn"].ConnectionString);

            //資料庫使用者密碼解密
            sqlsb.Password = TKID.Decryption(sqlsb.Password);
            sqlsb.UserID   = TKID.Decryption(sqlsb.UserID);

            String connectionString;

            sqlConn = new SqlConnection(sqlsb.ConnectionString);



            StringBuilder SQL1 = new StringBuilder();

            SQL1 = SETSQL5(SDAY, TG006);
            Report report1 = new Report();

            report1.Load(@"REPORT\銷售年報-業務員-客戶.frx");

            report1.Dictionary.Connections[0].ConnectionString = sqlsb.ConnectionString;

            TableDataSource table = report1.GetDataSource("Table") as TableDataSource;

            table.SelectCommand = SQL1.ToString();

            //report1.SetParameterValue("P1", dateTimePicker1.Value.ToString("yyyyMMdd"));
            //report1.SetParameterValue("P2", dateTimePicker2.Value.ToString("yyyyMMdd"));
            report1.Preview = previewControl4;
            report1.Show();
        }
 public TableEntriesFactory(TableDataSource source, Workspace workspace, DocumentId documentId) :
     base(source)
 {
     _source     = source;
     _workspace  = workspace;
     _documentId = documentId;
 }
예제 #11
0
        public void SETFASTREPORT()
        {
            //20210902密
            Class1 TKID = new Class1();//用new 建立類別實體
            SqlConnectionStringBuilder sqlsb = new SqlConnectionStringBuilder(ConfigurationManager.ConnectionStrings["dbconn"].ConnectionString);

            //資料庫使用者密碼解密
            sqlsb.Password = TKID.Decryption(sqlsb.Password);
            sqlsb.UserID   = TKID.Decryption(sqlsb.UserID);

            String connectionString;

            sqlConn = new SqlConnection(sqlsb.ConnectionString);



            string SQL;

            report1 = new Report();
            report1.Load(@"REPORT\業務商品排名表.frx");

            report1.Dictionary.Connections[0].ConnectionString = sqlsb.ConnectionString;

            TableDataSource Table = report1.GetDataSource("Table") as TableDataSource;

            SQL = SETFASETSQL();
            Table.SelectCommand = SQL;
            report1.Preview     = previewControl1;
            report1.Show();
        }
예제 #12
0
        public void SETFASTREPORT()
        {
            string SQL;
            Report report1 = new Report();

            report1.Load(@"REPORT\每月個人伙食費統計表.frx");

            //20210902密
            Class1 TKID = new Class1();//用new 建立類別實體
            SqlConnectionStringBuilder sqlsb = new SqlConnectionStringBuilder(ConfigurationManager.ConnectionStrings["dbconn"].ConnectionString);

            //資料庫使用者密碼解密
            sqlsb.Password = TKID.Decryption(sqlsb.Password);
            sqlsb.UserID   = TKID.Decryption(sqlsb.UserID);

            String connectionString;

            sqlConn = new SqlConnection(sqlsb.ConnectionString);

            report1.Dictionary.Connections[0].ConnectionString = sqlsb.ConnectionString;

            //report1.Dictionary.Connections[0].ConnectionString = "server=192.168.1.105;database=TKPUR;uid=sa;pwd=dsc";

            TableDataSource Table = report1.GetDataSource("Table") as TableDataSource;

            SQL = SETFASETSQL();

            report1.SetParameterValue("P1", dateTimePicker1.Value.ToString("yyyy/MM/dd"));

            Table.SelectCommand = SQL;

            report1.Preview = previewControl1;
            report1.Show();
        }
예제 #13
0
        public void SETFASTREPORT()
        {
            //20210902密
            Class1 TKID = new Class1();//用new 建立類別實體
            SqlConnectionStringBuilder sqlsb = new SqlConnectionStringBuilder(ConfigurationManager.ConnectionStrings["dbconn"].ConnectionString);

            //資料庫使用者密碼解密
            sqlsb.Password = TKID.Decryption(sqlsb.Password);
            sqlsb.UserID   = TKID.Decryption(sqlsb.UserID);

            String connectionString;

            sqlConn = new SqlConnection(sqlsb.ConnectionString);



            StringBuilder SQL1 = new StringBuilder();

            SQL1 = SETSQL();
            Report report1 = new Report();

            report1.Load(@"REPORT\銷售商品-客戶表.frx");

            report1.Dictionary.Connections[0].ConnectionString = sqlsb.ConnectionString;

            TableDataSource table = report1.GetDataSource("Table") as TableDataSource;

            table.SelectCommand = SQL1.ToString();

            //report1.SetParameterValue("P1", textBox1.Text);
            //report1.SetParameterValue("P2", textBox2.Text);
            report1.Preview = previewControl1;
            report1.Show();
        }
예제 #14
0
        protected void btnRecreate_Click(object sender, EventArgs e)
        {
            var ds = new TableDataSource<TableEntry>();

            ds.DeleteTestTable();
            System.Threading.Thread.Sleep(40000);
            ds.CreateTestTable();
        }
예제 #15
0
 private async void btnDeleteAll_Click(object sender, RoutedEventArgs e)
 {
     if (await TableDataSource.DeleteEntities(tablelist))
     {
         tablelist = null;
         lstEntities.ItemsSource = null;
     }
 }
예제 #16
0
 public QueryWizardForm(TableDataSource table)
 {
     FTable = table;
     InitializeComponent();
     Localize();
     Init();
     Config.RestoreFormState(this);
 }
예제 #17
0
        private void SetDetails()
        {
            TableDataSource dataSource = new TableDataSource();

            dataSource.Table = Table;

            report.Page.Details.DataSource = dataSource;
        }
예제 #18
0
 public TableEntriesFactory(TableDataSource source, Workspace workspace, ProjectId projectId, DocumentId documentId, object id)
 {
     _source     = source;
     _workspace  = workspace;
     _projectId  = projectId;
     _documentId = documentId;
     _id         = id;
 }
        public async Task LintSolutionUseTsconfigs()
        {
            MockUIHierarchyItem mockSolutionHierarchyItem = new MockUIHierarchyItem()
            {
                Object = solution
            };

            UIHierarchyItem[] selectedItems = new UIHierarchyItem[] { mockSolutionHierarchyItem };

            MockErrorsTableDataSource mockErrorsTableDataSource = new MockErrorsTableDataSource();

            TableDataSource.InjectMockErrorsTableDataSource(mockErrorsTableDataSource);

            settings.UseTsConfig = true;

            try
            {
                bool hasVSErrors = await LintFilesCommandBase.LintLintLint(false, selectedItems);

                Assert.IsFalse(hasVSErrors);
                Assert.IsTrue(mockErrorsTableDataSource.HasErrors());
                Assert.AreEqual(7, mockErrorsTableDataSource.Snapshots.Count);

                // Note file5 is referenced by a tsconfig that isn't in the project, so doesn't get included
                string expected1 = Path.GetFullPath(@"../../artifacts/tsconfig/multiple/a/file1.ts");
                string expected2 = Path.GetFullPath(@"../../artifacts/tsconfig/multiple/b/file2.ts");
                string expected3 = Path.GetFullPath(@"../../artifacts/tsconfig/multiple/b/file3.ts");
                string expected4 = Path.GetFullPath(@"../../artifacts/tsconfig/multiple/a/c/file4.ts");
                //string expected5 = Path.GetFullPath(@"../../artifacts/tsconfig/none/b/file5.ts");
                string expected6 = Path.GetFullPath(@"../../artifacts/tsconfig/multiple/a/c/file6.tsx");
                string expected7 = Path.GetFullPath(@"../../artifacts/tsconfig/multiple/file7.ts");
                string expected8 = Path.GetFullPath(@"../../artifacts/tsconfig/multiple/test.ts");

                Assert.IsTrue(mockErrorsTableDataSource.Snapshots.Keys.Contains(expected1));
                Assert.IsTrue(mockErrorsTableDataSource.Snapshots.Keys.Contains(expected2));
                Assert.IsTrue(mockErrorsTableDataSource.Snapshots.Keys.Contains(expected3));
                Assert.IsTrue(mockErrorsTableDataSource.Snapshots.Keys.Contains(expected4));
                //Assert.IsTrue(mockErrorsTableDataSource.Snapshots.Keys.Contains(expected5));
                Assert.IsTrue(mockErrorsTableDataSource.Snapshots.Keys.Contains(expected6));
                Assert.IsTrue(mockErrorsTableDataSource.Snapshots.Keys.Contains(expected7));
                Assert.IsTrue(mockErrorsTableDataSource.Snapshots.Keys.Contains(expected8));

                // Similar to TslintWithTsconfigTest.LintAll, again this level of detail may be too much
                Assert.AreEqual(3, mockErrorsTableDataSource.Snapshots[expected1].Count());
                Assert.AreEqual(4, mockErrorsTableDataSource.Snapshots[expected2].Count());
                Assert.AreEqual(3, mockErrorsTableDataSource.Snapshots[expected3].Count());
                Assert.AreEqual(3, mockErrorsTableDataSource.Snapshots[expected4].Count());
                //Assert.AreEqual(4, mockErrorsTableDataSource.Snapshots[expected5].Count());
                Assert.AreEqual(11, mockErrorsTableDataSource.Snapshots[expected6].Count());
                Assert.AreEqual(4, mockErrorsTableDataSource.Snapshots[expected7].Count());
                Assert.AreEqual(5, mockErrorsTableDataSource.Snapshots[expected8].Count());
            }
            finally
            {
                TableDataSource.InjectMockErrorsTableDataSource(null);
                settings.UseTsConfig = false;
            }
        }
예제 #20
0
        public void SETFASTREPORT()
        {
            //20210902密
            Class1 TKID = new Class1();//用new 建立類別實體
            SqlConnectionStringBuilder sqlsb = new SqlConnectionStringBuilder(ConfigurationManager.ConnectionStrings["dbconn"].ConnectionString);

            //資料庫使用者密碼解密
            sqlsb.Password = TKID.Decryption(sqlsb.Password);
            sqlsb.UserID   = TKID.Decryption(sqlsb.UserID);

            String connectionString;

            sqlConn = new SqlConnection(sqlsb.ConnectionString);



            StringBuilder SQL1 = new StringBuilder();

            Report report1 = new Report();

            if (comboBox1.Text.Trim().Equals("ERP各業務總金額"))
            {
                report1.Load(@"REPORT\ERP各業務總金額.frx");
                SQL1 = SETSQL();
            }
            else if (comboBox1.Text.Trim().Equals("ERP各業務總金額、月份金額"))
            {
                report1.Load(@"REPORT\ERP各業務總金額、月份金額.frx");
                SQL1 = SETSQL2();
            }
            else if (comboBox1.Text.Trim().Equals("ERP各業務總金額、月份、客戶金額"))
            {
                report1.Load(@"REPORT\ERP各業務總金額、月份、客戶金額.frx");
                SQL1 = SETSQL3();
            }
            else if (comboBox1.Text.Trim().Equals("ERP各業務總金額、月份、客戶、商品金額"))
            {
                report1.Load(@"REPORT\ERP各業務總金額、月份、客戶、商品金額.frx");
                SQL1 = SETSQL4();
            }
            else if (comboBox1.Text.Trim().Equals("ERP各商品合計"))
            {
                report1.Load(@"REPORT\ERP各商品合計.frx");
                SQL1 = SETSQL5();
            }


            report1.Dictionary.Connections[0].ConnectionString = sqlsb.ConnectionString;

            TableDataSource table = report1.GetDataSource("Table") as TableDataSource;

            table.SelectCommand = SQL1.ToString();

            //report1.SetParameterValue("P1", dateTimePicker1.Value.ToString("yyyyMMdd"));
            //report1.SetParameterValue("P2", dateTimePicker2.Value.ToString("yyyyMMdd"));
            report1.Preview = previewControl1;
            report1.Show();
        }
        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            // Prepare table. We use standart data table
            DataTable table = new DataTable();

            table.Columns.Add("Sine", typeof(double));
            table.Columns.Add("Time", typeof(DateTime));
            table.Columns.Add("Index", typeof(int));
            table.Columns.Add("Sqrt", typeof(double));

            for (int i = 0; i < 100; i++)
            {
                table.Rows.Add(
                    Math.Sin(i / 10.0),
                    DateTime.Now + new TimeSpan(0, 0, i),
                    i,
                    Math.Sqrt(i));
            }

            // Prepare data source with mapping
            TableDataSource data = new TableDataSource(table);

            // X is time in seconds
            data.SetXMapping(row => ((DateTime)row["Time"] - (DateTime)table.Rows[0][1]).TotalSeconds);
            // Y is value of "Sine" column
            data.SetYMapping(row => 10 * (double)row["Sine"]);
            // Map HSB color computes from "Index" column to dependency property Brush of marker
            data.AddMapping(ShapePointMarker.FillProperty,
                            row => new SolidColorBrush(new HsbColor(3 * (int)row["Index"], 1, 1).ToArgbColor()));
            // Map "Sqrt" based values to marker size
            data.AddMapping(ShapePointMarker.SizeProperty,
                            row => 4 + (double)row["Sqrt"]);

            // Plot first graph
            plotter.AddLineGraph(data,
                                 new Pen(Brushes.Blue, 2),
                                 new CirclePointMarker(),
                                 new PenDescription("First series (Sine)"));

            // Prepare data source for second graph. table.Rows is enumerable,
            // so we can plot its contents as IEnumerable with items of TableRow type
            EnumerableDataSource <DataRow> data2 = new EnumerableDataSource <DataRow>(table.Rows);

            // X is time in seconds again
            data2.SetXMapping(row => ((DateTime)row["Time"] - (DateTime)table.Rows[0][1]).TotalSeconds);
            // Y is value of "Sqrt" column
            data2.SetYMapping(row => (double)row["Sqrt"]);

            // Plot second graph without markers
            plotter.AddLineGraph(data2,
                                 Colors.Red, 3.0,
                                 "Second series (Sqrt)");

            // Force evertyhing plotted to be visible
            plotter.Viewport.FitToView();
        }
 public TableEntriesFactory(TableDataSource source, Workspace workspace, ProjectId projectId, DocumentId documentId, object id) :
     base(source)
 {
     _source      = source;
     _workspace   = workspace;
     _projectId   = projectId;
     _documentId  = documentId;
     _id          = id;
     _errorSource = (id as ErrorSourceId)?.ErrorSource ?? string.Empty;
 }
예제 #23
0
        /// <summary>
        /// Initializes a new instance of the <see cref="TableDataSourceFacts"/> class.
        /// </summary>
        public TableDataSourceFacts()
        {
            this.operation = Substitute.For <IDataOperationInfo>();
            this.operation.OperationId.ReturnsForAnyArgs(Guid.NewGuid());

            this.target = new TableDataSource(this.ConnectionFactory, "dbo.wibble")
            {
                Parent = this.operation
            };
        }
예제 #24
0
        private async void btnDelete_Click(object sender, RoutedEventArgs e)
        {
            var entity = (DynamicTableEntity)lstEntities.SelectedItem;

            if (await TableDataSource.DeleteEntity(entity))
            {
                tablelist.Remove(entity);
                lstEntities.ItemsSource = tablelist;
            }
        }
예제 #25
0
 protected VisualStudioBaseTodoListTable(
     Workspace workspace,
     ITodoListProvider todoListProvider,
     string identifier,
     ITableManagerProvider provider
     ) : base(workspace, provider, StandardTables.TasksTable)
 {
     _source = new TableDataSource(workspace, todoListProvider, identifier);
     AddInitialTableSource(workspace.CurrentSolution, _source);
 }
예제 #26
0
 public TableEntriesSource(
     TableDataSource source,
     Workspace workspace,
     DocumentId documentId
     )
 {
     _source     = source;
     _workspace  = workspace;
     _documentId = documentId;
 }
예제 #27
0
파일: FrmPURTATB.cs 프로젝트: TKFood/TKPUR
        public void SETFASTREPORT2()
        {
            StringBuilder MID = new StringBuilder();
            StringBuilder ID  = new StringBuilder();

            MID.Clear();
            ID.Clear();

            foreach (DataGridViewRow row in dataGridView4.Rows)
            {
                if (Convert.ToBoolean(row.Cells[0].Value))
                {
                    MID.AppendFormat(@" '{0}',", row.Cells["MID"].Value.ToString());
                    ID.AppendFormat(@" '{0}',", row.Cells["ID"].Value.ToString());
                }
            }

            MID.AppendFormat(@" '01e5cf12-ccd4-4d80-a767-0298eaed9bc2'");
            ID.AppendFormat(@" '01e5cf12-ccd4-4d80-a767-0298eaed9bc2'");

            string SQL;
            string SQL2;

            report1 = new Report();
            report1.Load(@"REPORT\請購變更單明細.frx");

            //20210902密
            Class1 TKID = new Class1();//用new 建立類別實體
            SqlConnectionStringBuilder sqlsb = new SqlConnectionStringBuilder(ConfigurationManager.ConnectionStrings["dbconn"].ConnectionString);

            //資料庫使用者密碼解密
            sqlsb.Password = TKID.Decryption(sqlsb.Password);
            sqlsb.UserID   = TKID.Decryption(sqlsb.UserID);

            String connectionString;

            sqlConn = new SqlConnection(sqlsb.ConnectionString);

            report1.Dictionary.Connections[0].ConnectionString = sqlsb.ConnectionString;


            //report1.Dictionary.Connections[0].ConnectionString = "server=192.168.1.105;database=TKPUR;uid=sa;pwd=dsc";

            TableDataSource Table  = report1.GetDataSource("Table") as TableDataSource;
            TableDataSource Table1 = report1.GetDataSource("Table1") as TableDataSource;

            SQL = SETFASETSQL3(MID.ToString());
            Table.SelectCommand = SQL;

            SQL2 = SETFASETSQL4(ID.ToString());
            Table1.SelectCommand = SQL2;

            report1.Preview = previewControl2;
            report1.Show();
        }
예제 #28
0
        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            // Prepare table. We use standart data table
            DataTable table = new DataTable();
            table.Columns.Add("Sine", typeof(double));
            table.Columns.Add("Time", typeof(DateTime));
            table.Columns.Add("Index", typeof(int));
            table.Columns.Add("Sqrt", typeof(double));

            for (int i = 0; i < 100; i++)
            {
                table.Rows.Add(
                    Math.Sin(i / 10.0),
                    DateTime.Now + new TimeSpan(0, 0, i),
                    i,
                    Math.Sqrt(i));
            }

            // Prepare data source with mapping 
            TableDataSource data = new TableDataSource(table);
            // X is time in seconds
            data.SetXMapping(row => ((DateTime)row["Time"] - (DateTime)table.Rows[0][1]).TotalSeconds);
            // Y is value of "Sine" column
            data.SetYMapping(row => 10 * (double)row["Sine"]);
            // Map HSB color computes from "Index" column to dependency property Brush of marker
            data.AddMapping(ShapePointMarker.FillProperty,
                row => new SolidColorBrush(new HsbColor(3 * (int)row["Index"], 1, 1).ToArgbColor()));
            // Map "Sqrt" based values to marker size
            data.AddMapping(ShapePointMarker.SizeProperty,
                row => 4 + (double)row["Sqrt"]);

            // Plot first graph
            plotter.AddLineGraph(data,
                new Pen(Brushes.Blue, 2),
                new CirclePointMarker(),
                new PenDescription("First series (Sine)"));

            // Prepare data source for second graph. table.Rows is enumerable, 
            // so we can plot its contents as IEnumerable with items of TableRow type
            EnumerableDataSource<DataRow> data2 = new EnumerableDataSource<DataRow>(table.Rows);
            // X is time in seconds again
            data2.SetXMapping(row => ((DateTime)row["Time"] - (DateTime)table.Rows[0][1]).TotalSeconds);
            // Y is value of "Sqrt" column
            data2.SetYMapping(row => (double)row["Sqrt"]);

            // Plot second graph without markers
            plotter.AddLineGraph(data2,
                Colors.Red, 3.0,
                "Second series (Sqrt)");

            // Force evertyhing plotted to be visible
            plotter.Viewport.FitToView();
        }
예제 #29
0
 public override void CreateTable(TableDataSource source)
 {
     if (DataSet.Tables.Contains(source.TableName))
     {
         source.Table = DataSet.Tables[source.TableName];
         base.CreateTable(source);
     }
     else
     {
         source.Table = null;
     }
 }
예제 #30
0
        protected UIHierarchyItem[] Arrange(string solutionPath)
        {
            Initialize(solutionPath);
            MockUIHierarchyItem mockSolutionHierarchyItem = new MockUIHierarchyItem()
            {
                Object = solution
            };

            selectedItems             = new UIHierarchyItem[] { mockSolutionHierarchyItem };
            mockErrorsTableDataSource = new MockErrorsTableDataSource();
            TableDataSource.InjectMockErrorsTableDataSource(mockErrorsTableDataSource);
            return(selectedItems);
        }
예제 #31
0
        //This will take a long time, because it require to delete the Table first,
        //then recreate it and add data to it.
        private async void btnRegenerate_Click(object sender, RoutedEventArgs e)
        {
            btnDelete.IsEnabled     = false;
            btnDeleteAll.IsEnabled  = false;
            btnRegenerate.IsEnabled = false;

            if (await TableDataSource.DeleteTable())
            {
                tablelist = await TableDataSource.CreateSampleData();

                lstEntities.ItemsSource = tablelist;
            }
            btnDelete.IsEnabled     = true;
            btnDeleteAll.IsEnabled  = true;
            btnRegenerate.IsEnabled = true;
        }
예제 #32
0
        public void SETFASTREPORT2()
        {
            string SQL;

            report2 = new Report();
            report2.Load(@"REPORT\業務客戶排名表.frx");

            report2.Dictionary.Connections[0].ConnectionString = ConfigurationManager.ConnectionStrings["dbconn"].ConnectionString;

            TableDataSource Table = report2.GetDataSource("Table") as TableDataSource;

            SQL = SETFASETSQL2();
            Table.SelectCommand = SQL;
            report2.Preview     = previewControl2;
            report2.Show();
        }
예제 #33
0
        public void TestIsEqual_DateTime_NotEqual_TableField()
        {
            Field            sourceField = new LiteralField("DateTime", "sourceField", "2016-02-28");
            Field            targetField = new TableField("DateTime", "targetField");
            SimpleCondition  condition   = new IsEqual(sourceField, targetField);
            IDataSourceStore dsStore     = new DataSourceStore();
            IDataSource      ds          = new TableDataSource(new Dictionary <string, object>()
            {
                { "targetField", "2016-02-27" }
            });
            bool isHold = condition.IsSimpleConditonHold(dsStore.AddDataSource(ds));

            bool expected = false;

            Assert.AreEqual <bool>(expected, isHold);
        }
예제 #34
0
        /// <summary>
        /// Adds a file dataset (Shapefile or raster) to a new local dynamic map service layer.
        /// </summary>
        /// <param name="workspaceType">The workspace type (FileGDB, Raster, SDE, Shapefile) <see cref="http://resources.arcgis.com/en/help/runtime-wpf/apiref/index.html?ESRI.ArcGIS.Client.Local~ESRI.ArcGIS.Client.Local.WorkspaceFactoryType.html"/>.</param>
        /// <param name="directoryPath">A <see cref="System.String"/> representing the directory path.</param>
        /// <param name="fileNames">A <see cref="System.Collections.Generic.List{System.String}"/> representing the name of the file (for raster datasets this must include the extension).</param>
        /// <param name="callback">The Action delegate to call back on once the dynamic layer work is complete.</param>                
        public void AddFileDatasetToDynamicMapServiceLayer(WorkspaceFactoryType workspaceType, string directoryPath, List<string> fileNames, Action<ArcGISLocalDynamicMapServiceLayer> callback)
        {
            try
            {
            // Generate a unique workspace ID (any unique string).
            string uniqueId = Guid.NewGuid().ToString();

            // Create a new WorkspaceInfo object with a unique ID.
            WorkspaceInfo workspaceInfo = new WorkspaceInfo(uniqueId, workspaceType, "DATABASE=" + directoryPath);

            // Create a new LocalMapService instance.
            LocalMapService localMapService = new LocalMapService
            {
                // Set the path property.
                Path = _emptyMpkPath,

                // Enable the dynamic layers capability.
                EnableDynamicLayers = true
            };

            // Register the workspace to be used with this service.
            localMapService.DynamicWorkspaces.Add(workspaceInfo);

            // Asynchronously start the local map service.
            localMapService.StartAsync(x =>
            {
                // Create the local dynamic map service layer.
                ArcGISLocalDynamicMapServiceLayer arcGisLocalDynamicMapServiceLayer = null;

                // Create a new ArcGISLocalDynamicMapServiceLayer passing in the newly started local service.
                arcGisLocalDynamicMapServiceLayer = new ArcGISLocalDynamicMapServiceLayer(localMapService)
                {
                    // Assign the filename as the map layer ID.
                    ID = "Workspace: " + (new DirectoryInfo(directoryPath)).Name,

                    // Enable the dynamic layers capability.
                    EnableDynamicLayers = true,
                };

                // Handle the layer initialized event inline to perform the layer dynamic layer management.
                arcGisLocalDynamicMapServiceLayer.Initialized += (s, e) =>
                {
                    // Create a DynamicLayerInfoCollection to hold the new datasets as "dynamic layers".
                    DynamicLayerInfoCollection dynamicLayerInfoCollection = new DynamicLayerInfoCollection();

                    // Create a LayerDrawingOptionsCollection to specify the symbology for each layer.
                    LayerDrawingOptionsCollection layerDrawingOptionsCollection = new LayerDrawingOptionsCollection();

                    // Iterate over each of the selected files in the workspace.
                    int counter = 0;
                    foreach (string fileName in fileNames)
                    {
                        // Create a new DynamicLayerInfo (to make changes to existing map service layers use the CreateDynamicLayerInfosFromLayerInfos() method.
                        DynamicLayerInfo dynamicLayerInfo = new DynamicLayerInfo
                        {
                            // Assign a layer ID.
                            ID = counter,

                            // Specify a friendly name.
                            Name = "Dataset: " + fileName
                        };

                        // Create a DataSource object to represent the physical datasource implementation (table or raster) which will become the DataSource
                        // property of a new LayerDataSource in the map service. Other supported datasource types are JoinDataSource and QueryDataSource.
                        DataSource dataSource = null;

                        // If the workspace type is Raster create a new RasterDataSource.
                        if (workspaceInfo.FactoryType == WorkspaceFactoryType.Raster)
                        {
                            // Create a new RasterDataSource object
                            dataSource = new RasterDataSource
                            {
                                // Match the DataSourceName to the physical filename on disk (including extension).
                                DataSourceName = fileName,

                                // Provide the WorkspaceID (the unique workspace identifier created earlier). A LocalMapService may have multiple dynamic workspaces.
                                WorkspaceID = workspaceInfo.Id
                            };
                        }
                        else
                        {
                            // Else if the workspace is not Raster create a new TableDataSource
                            dataSource = new TableDataSource
                            {
                                // Match the DataSourceName to the physical filename on disk (excluding extension).
                                DataSourceName = fileName,

                                // Provide the WorkspaceID (the unique workspace identifier created earlier). A LocalMapService may have multiple dynamic workspaces.
                                WorkspaceID = workspaceInfo.Id
                            };

                            /*
                                * Apply a renderer for vector layers.
                                * Note: It is always necessary to provide a renderer when the layer being added (represented by a DynamicLayerInfo) is part of a new
                                * DynamicLayerInfoCollection as opposed to using the CreateDynamicLayerInfosFromLayerInfos() method which creates a DynamicLayerInfoCollection
                                * containing the existing layers in the map service.
                            */

                            // Create a new LayerDrawingOptions object to hold the renderer information.
                            var layerDrawOpt = new LayerDrawingOptions()
                            {
                                // Match up the LayerID to the ID of the layer within the service.
                                LayerID = counter,
                            };

                            // We need to determine the geometry type of the new feature class.
                            // To do this, we will submit a request to the ..\MapServer\dynamicLayer?.. endpoint which will return the service level metadata,
                            // allowing us to identify the geometry type and create an appropriate renderer.
                            // Note:- This is a workaround until the next release where GetAllDetails will honor the DynamicLayerInfoCollection.

                            // Create a new WebClient instance to make the request and download the response.
                            WebClient webClient = new WebClient();

                            // Register an asynchronous handler in which to create the renderers and apply the to the dynamic map service layer.
                            webClient.DownloadDataCompleted += (client, downloadDataEventArgs) =>
                            {

                                // Read the JSON response as XML
                                XmlReader reader = System.Runtime.Serialization.Json.JsonReaderWriterFactory.CreateJsonReader(downloadDataEventArgs.Result, new XmlDictionaryReaderQuotas());

                                // Get the root XML element
                                XElement root = XElement.Load(reader);

                                // Query for the "geometryType" element
                                XElement geometryType = root.XPathSelectElement("//geometryType");

                                // Create the render based on the geometry type
                                switch (geometryType.Value)
                                {
                                    case "esriGeometryPoint":
                                        layerDrawOpt.Renderer = new SimpleRenderer() { Symbol = new SimpleMarkerSymbol() { Color = new SolidColorBrush(GetRandomColor()), Size = 8 } };
                                        break;
                                    case "esriGeometryPolyline":
                                        layerDrawOpt.Renderer = new SimpleRenderer() { Symbol = new SimpleLineSymbol() { Color = new SolidColorBrush(GetRandomColor()) } };
                                        break;
                                    case "esriGeometryPolygon":
                                        layerDrawOpt.Renderer = new SimpleRenderer() { Symbol = new SimpleFillSymbol() { Fill = new SolidColorBrush(GetRandomColor()), BorderBrush = new SolidColorBrush(GetRandomColor()) } };
                                        break;
                                }

                                // Set the LayerDrawingOptions property on the local dynamic map service layer (the LayerID property ties this to the DynamicLayerInfo object).
                                layerDrawingOptionsCollection.Add(layerDrawOpt);

                                // Update the layer drawing options property on the dynamic map service layer.
                                arcGisLocalDynamicMapServiceLayer.LayerDrawingOptions = layerDrawingOptionsCollection;

                                // Need to refresh the layer after the renderer(s) have been applied.
                                arcGisLocalDynamicMapServiceLayer.Refresh();

                            };

                            // Make the request for the service metadata
                            // e.g. http://127.0.0.1:<PORT>/arcgis/rest/services/<MPK_NAME>/MapServer/dynamicLayer?layer={"id":0,"source":{"type":"dataLayer","dataSource":{"type":"table","workspaceId":"MyWorkspace","dataSourceName":"MyFeatureClassName"}}}
                            webClient.DownloadDataAsync(new Uri(arcGisLocalDynamicMapServiceLayer.Url
                                + "/dynamicLayer?layer={'id':" + counter.ToString() + ","
                                + "'source':{'type':'dataLayer','dataSource':{"
                                + "'type':'table',"
                                + "'workspaceId':'" + workspaceInfo.Id + "',"
                                + "'dataSourceName':'" + fileName + "'"
                                + "}}}"));
                        }

                        // Set the Source property of the DynamicLayerInfo object.
                        dynamicLayerInfo.Source = new LayerDataSource { DataSource = dataSource };

                        // Add the new DynamicLayerInfo object to the collection.
                        dynamicLayerInfoCollection.Add(dynamicLayerInfo);

                        // Increment the counter which is being used to assign Layer IDs.
                        counter++;
                    }

                    // Update the DynamicLayerInfos property on the dynamic map service layer.
                    arcGisLocalDynamicMapServiceLayer.DynamicLayerInfos = dynamicLayerInfoCollection;

                    // Call the Action delegate.
                    callback(arcGisLocalDynamicMapServiceLayer);
                };

                // Call the Initialize method on the layer to initialize the layer properties.
                arcGisLocalDynamicMapServiceLayer.Initialize();
            });
            }
            catch (Exception ex)
            {
            MessageBox.Show(ex.Message, "Error", MessageBoxButton.OK, MessageBoxImage.Error);
            }
        }
        private async Task<ArcGISDynamicMapServiceLayer> AddFileDatasetToDynamicMapServiceLayer(WorkspaceFactoryType workspaceType, string directoryPath, List<string> fileNames)
        {
            try
            {
                // Create a new WorkspaceInfo object with a unique ID.
                string uniqueId = Guid.NewGuid().ToString();
                WorkspaceInfo workspaceInfo = new WorkspaceInfo(uniqueId, workspaceType, "DATABASE=" + directoryPath);

                // Create and initialize a new LocalMapService instance.
                LocalMapService localMapService = new LocalMapService(_emptyMapPackage) { EnableDynamicLayers = true };
                localMapService.DynamicWorkspaces.Add(workspaceInfo);
                await localMapService.StartAsync();

                // Create and initialize new ArcGISLocalDynamicMapServiceLayer over the local service.
                var dynLayer = new ArcGISDynamicMapServiceLayer()
                {
                    ID = "Workspace: " + (new DirectoryInfo(directoryPath)).Name,
                    ServiceUri = localMapService.UrlMapService
                };
                await dynLayer.InitializeAsync();

                // Create a DynamicLayerInfoCollection to hold the new datasets as "dynamic layers".
                DynamicLayerInfoCollection dynamicLayerInfoCollection = new DynamicLayerInfoCollection();
                dynLayer.DynamicLayerInfos = dynamicLayerInfoCollection;

                // Create a LayerDrawingOptionsCollection to specify the symbology for each layer.
                LayerDrawingOptionCollection layerDrawingOptionsCollection = new LayerDrawingOptionCollection();
                dynLayer.LayerDrawingOptions = layerDrawingOptionsCollection;

                // Iterate over each of the selected files in the workspace.
                int counter = 0;
                foreach (string fileName in fileNames)
                {
                    // Create a new DynamicLayerInfo (to make changes to existing map service layers use the CreateDynamicLayerInfosFromLayerInfos() method.
                    DynamicLayerInfo dynamicLayerInfo = new DynamicLayerInfo { ID = counter, Name = "Dataset: " + fileName };

                    // Create a DataSource object to represent the physical datasource implementation (table or raster) which will become the DataSource 
                    // property of a new LayerDataSource in the map service. Other supported datasource types are JoinDataSource and QueryDataSource.
                    DataSource dataSource = null;

                    // If the workspace type is Raster create a new RasterDataSource.
                    if (workspaceInfo.FactoryType == WorkspaceFactoryType.Raster)
                    {
                        // Create a new RasterDataSource object
                        dataSource = new RasterDataSource
                        {
                            // Match the DataSourceName to the physical filename on disk (including extension).
                            DataSourceName = fileName,

                            // Provide the WorkspaceID (the unique workspace identifier created earlier). A LocalMapService may have multiple dynamic workspaces.
                            WorkspaceID = workspaceInfo.Id
                        };
                    }
                    else
                    {
                        // Else if the workspace is not Raster create a new TableDataSource
                        dataSource = new TableDataSource
                        {
                            // Match the DataSourceName to the physical filename on disk (excluding extension).
                            DataSourceName = fileName,

                            // Provide the WorkspaceID (the unique workspace identifier created earlier). A LocalMapService may have multiple dynamic workspaces.
                            WorkspaceID = workspaceInfo.Id
                        };
                    }

                    // Set the Source property of the DynamicLayerInfo object.
                    dynamicLayerInfo.Source = new LayerDataSource { DataSource = dataSource };

                    // Add the new DynamicLayerInfo object to the collection.
                    dynamicLayerInfoCollection.Add(dynamicLayerInfo);

                    // Create a new LayerDrawingOptions object to hold the renderer information.
                    var layerDrawOpt = new LayerDrawingOptions()
                    {
                        // Match up the LayerID to the ID of the layer within the service.
                        LayerID = counter,
                    };

                    // Use the GetDetails method which now supports dynamic data sources to determine the geometry type of the new datasource.
                    var featureLayerInfo = await dynLayer.GetDetailsAsync(dynamicLayerInfo.ID);

                    switch (featureLayerInfo.GeometryType)
                    {
                        case GeometryType.Envelope:
                            layerDrawOpt.Renderer = new SimpleRenderer() { Symbol = new SimpleFillSymbol() { Color = GetRandomColor(), Outline = new SimpleLineSymbol() { Color = GetRandomColor() } } };
                            break;
                        case GeometryType.MultiPoint:
                            layerDrawOpt.Renderer = new SimpleRenderer() { Symbol = new SimpleMarkerSymbol() { Color = GetRandomColor(), Size = 8 } };
                            break;
                        case GeometryType.Point:
                            layerDrawOpt.Renderer = new SimpleRenderer() { Symbol = new SimpleMarkerSymbol() { Color = GetRandomColor(), Size = 8 } };
                            break;
                        case GeometryType.Polygon:
                            layerDrawOpt.Renderer = new SimpleRenderer() { Symbol = new SimpleFillSymbol() { Color = GetRandomColor(), Outline = new SimpleLineSymbol() { Color = GetRandomColor() } } };
                            break;
                        case GeometryType.Polyline:
                            layerDrawOpt.Renderer = new SimpleRenderer() { Symbol = new SimpleLineSymbol() { Color = GetRandomColor() } };
                            break;
                        default:
                            break;
                    }

                    // Set the LayerDrawingOptions property on the local dynamic map service layer (the LayerID property ties this to the DynamicLayerInfo object).
                    layerDrawingOptionsCollection.Add(layerDrawOpt);

                    counter++;
                }

                return dynLayer;
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Error", MessageBoxButton.OK, MessageBoxImage.Error);
                return null;
            }
        }