Inheritance: MonoBehaviour
	void Start() 
	{
		// STEP 1
		// Gradient is set directly on the object
		var mountainTerrain = new RidgedMultifractal();
		RenderAndSetImage(mountainTerrain);

		// Stop rendering if we're only getting as far as this tutorial
		// step. It saves me from doing multiple files.
		if (_tutorialStep <= 1) return;

		// STEP 2
		var baseFlatTerrain = new Billow();
		baseFlatTerrain.Frequency = 2.0;
		RenderAndSetImage(baseFlatTerrain);


		if (_tutorialStep <= 2) return;

		// STEP 3
		var flatTerrain = new ScaleBias(0.125, -0.75, baseFlatTerrain);
		RenderAndSetImage(flatTerrain);

		if (_tutorialStep <= 3) return;

		// STEP 4
		var terrainType = new Perlin();
		terrainType.Frequency = 0.5;
		terrainType.Persistence = 0.25;

		var finalTerrain = new Select(flatTerrain, mountainTerrain, terrainType);
		finalTerrain.SetBounds(0, 1000);
		finalTerrain.FallOff = 0.125;
		RenderAndSetImage(finalTerrain);
	}
Beispiel #2
0
        public void Exec_AggregateMax()
        {
            const double expected = 100.00;

            // overload #1
            double result = new
                Select(Aggregate.Max("UnitPrice"))
                .From(Product.Schema)
                .ExecuteScalar<double>();
            Assert.AreEqual(expected, result);

            // overload #2
            result = new
                Select(Aggregate.Max(Product.UnitPriceColumn))
                .From(Product.Schema)
                .ExecuteScalar<double>();
            Assert.AreEqual(expected, result);

            // overload #3
            result = new
                Select(Aggregate.Max("UnitPrice", "MostExpensive"))
                .From(Product.Schema)
                .ExecuteScalar<double>();
            Assert.AreEqual(expected, result);

            // overload #4
            result = new
                Select(Aggregate.Max(Product.UnitPriceColumn, "MostExpensive"))
                .From(Product.Schema)
                .ExecuteScalar<double>();
            Assert.AreEqual(expected, result);
        }
    //databind to total orders by eta and company id
    protected void bind_chart(Int32 companyid)
    {
        try
        {
            int _countopen = 0;

            //total open orders for this company or total open orders for company = -1
            if (companyid > -1)
            {
                _countopen = new Select(OrderTable.OrderIDColumn).From<OrderTable>().Where(OrderTable.CompanyIDColumn).IsEqualTo(companyid).
                    And(OrderTable.JobClosedColumn).IsEqualTo(false).GetRecordCount();
            }
            else
            {
                _countopen = new Select(OrderTable.OrderIDColumn).From<OrderTable>().Where(OrderTable.JobClosedColumn).IsEqualTo(false).GetRecordCount();
            }
            //bind to gauge
            this.dxgaugeSumopen.Value = _countopen.ToString();
        }
        catch (Exception ex)
        {
            this.dxlblerr1.Text = ex.Message.ToString();
            this.dxlblerr1.Visible = true;
        }
    }
Beispiel #4
0
        protected void FillElement(IWebElement element, object value)
        {
            if (value == null)
            {
                return;
            }

            if (IsInput(element))
            {
                String inputType = element.GetAttribute("type");
                if (inputType == null || inputType == TextInputType || inputType == PasswordInputType)
                {
                    element.SendKeys(value.ToString());
                }
                else if (inputType == CheckboxType)
                {
                    CheckBox checkBox = new CheckBox(element);
                    checkBox.Set(bool.Parse(value.ToString()));
                }
                else if (inputType == RadioType)
                {
                    Radio radio = new Radio(element);
                    radio.SelectByValue(value.ToString());
                }
            }
            else if (IsSelect(element))
            {
                Select select = new Select(element);
                select.SelectByValue(value.ToString());
            }
            else if (IsTextArea(element))
            {
                element.SendKeys(value.ToString());
            }
        }
Beispiel #5
0
 public SelectionElement(string myAlias, Select.EdgeList myEdgeList, bool myIsGroupedOrAggregated, IDChainDefinition myRelatedIDChainDefinition, IAttributeDefinition myElement = null)
     : this(myAlias, myRelatedIDChainDefinition)
 {
     EdgeList = myEdgeList;
     IsGroupedOrAggregated = myIsGroupedOrAggregated;
     Element = myElement;
 }
Beispiel #6
0
 public Delete(string table, Select select, bool allowMultiple)
 {
     Table.Name = table;
     AllowMultiple = allowMultiple;
     Select = select;
     Filter = FilterType.Select;
 }
Beispiel #7
0
    // Use this for initialization
    void Start()
    {
        IModule mountainTerrain = new RidgedMulti();
        IModule baseFlatTerrain = new Billow();
        ((Billow)baseFlatTerrain).Frequency = 2.0;
        IModule flatTerrain = new ScaleBias(baseFlatTerrain, 0.125, -0.75);
        IModule terrainType = new Perlin();
        ((Perlin)terrainType).Frequency = 0.5;
        ((Perlin)terrainType).Persistence = 0.25;
        IModule terrainSelector = new Select(flatTerrain, mountainTerrain, terrainType);
        ((Select)terrainSelector).SetBounds(0.0, 1000.0);
        ((Select)terrainSelector).SetEdgeFallOff(0.125);
        IModule finalTerrain = new Turbulence(terrainSelector);
        ((Turbulence)finalTerrain).Frequency = 4.0;
        ((Turbulence)finalTerrain).Power = 0.125;

        NoiseMapBuilderPlane heightMapBuilder = new NoiseMapBuilderPlane(256, 256);
        heightMapBuilder.SetBounds(6.0, 10.0, 1.0, 5.0);
        heightMapBuilder.Build(finalTerrain);
        RendererImage render = new RendererImage();
        render.SourceNoiseMap = heightMapBuilder.Map;
        render.ClearGradient ();
        render.AddGradientPoint(-1.0000, new Color32(32, 160, 0, 255));
        render.AddGradientPoint(-0.2500, new Color32(224, 224, 0, 255));
        render.AddGradientPoint(0.2500, new Color32(128, 128, 128, 255));
        render.AddGradientPoint(1.0000, new Color32(255, 255, 255, 255));
        render.IsLightEnabled = true;
        render.LightContrast = 3.0;
        render.LightBrightness = 2.0;
        render.Render();

        tex = render.GetTexture();
    }
Beispiel #8
0
        public void Exec_AggregateAvg()
        {
            const double expected = 55.5922077922078; //55.5922;

            // overload #1
            double result = new
                Select(Aggregate.Avg("UnitPrice"))
                .From(Product.Schema)
                .ExecuteScalar<double>();
            //Assert.AreEqual(expected, result);
            Assert.AreEqual(Math.Round(expected, 8), Math.Round(result, 8));  // [[55.5922]]!=[[55.5922077922078]]

            // overload #2
            result = new
                Select(Aggregate.Avg(Product.UnitPriceColumn))
                .From(Product.Schema)
                .ExecuteScalar<double>();
            //Assert.AreEqual(expected, result);
            Assert.AreEqual(Math.Round(expected, 8), Math.Round(result, 8));
            // overload #3
            result = new
                Select(Aggregate.Avg("UnitPrice", "AverageUnitPrice"))
                .From(Product.Schema)
                .ExecuteScalar<double>();
            //Assert.AreEqual(expected, result);
            Assert.AreEqual(Math.Round(expected, 8), Math.Round(result, 8));
            // overload #4
            result = new
                Select(Aggregate.Avg(Product.UnitPriceColumn, "AverageUnitPrice"))
                .From(Product.Schema)
                .ExecuteScalar<double>();
            //Assert.AreEqual(expected, result);
            Assert.AreEqual(Math.Round(expected, 8), Math.Round(result, 8));
        }
Beispiel #9
0
 // Use this for initialization
 void Start()
 {
     posicionAPuntador = new Vector3 (transform.position.x,transform.position.y+5,0);
     seleccionador = new Select ();
     seleccionador = GameObject.FindGameObjectWithTag("Select").GetComponent<Select>();
     escogido = false;
 }
 private bool BarcodeExist()
 {
     try
     {
         int count = 1;
         switch (SysPara.AutoGenerateBarcode)
         {
             case 0:
             case 1:
                 count = new Select().From(TTestInfo.Schema).Where(TTestInfo.Columns.Barcode).IsEqualTo(txtBarcode.Text.Trim()).
                     And(TTestInfo.Columns.PatientId).IsNotEqualTo(vPatient_ID).GetRecordCount();
                 break;
             case 2:
                 count = new Select().From(TTestInfo.Schema).Where(TTestInfo.Columns.TestTypeId).IsEqualTo(vTestType_ID).
                 And(TTestInfo.Columns.Barcode).IsEqualTo(txtBarcode.Text.Trim()).GetRecordCount();
                 break;
         }
         if (count > 0) return true;
         else return false;
     }
     catch (Exception ex)
     {
         return true;
     }
 }
        public void Acc_Exec_AggregateAvg()
        {
            const double expected = 28.8664;

            // overload #1
            double result = new
                Select(Aggregate.Avg("UnitPrice"))
                .From(Product.Schema)
                .ExecuteScalar<double>();
            Assert.AreEqual(expected, result);

            // overload #2
            result = new
                Select(Aggregate.Avg(Product.UnitPriceColumn))
                .From(Product.Schema)
                .ExecuteScalar<double>();
            Assert.AreEqual(expected, result);

            // overload #3
            result = new
                Select(Aggregate.Avg("UnitPrice", "AverageUnitPrice"))
                .From(Product.Schema)
                .ExecuteScalar<double>();
            Assert.AreEqual(expected, result);

            // overload #4
            result = new
                Select(Aggregate.Avg(Product.UnitPriceColumn, "AverageUnitPrice"))
                .From(Product.Schema)
                .ExecuteScalar<double>();
            Assert.AreEqual(expected, result);
        }
Beispiel #12
0
        public SelectTests()
        {
            context = new TestingContext();
            select = new Select<Role>(context.Set<Role>());

            context.Set<Role>().Add(ObjectFactory.CreateRole());
            context.DropData();
        }
Beispiel #13
0
        public SelectTests()
        {
            context = new TestingContext();
            select = new Select<Role>(context.Set<Role>());

            context.DropData();
            SetUpData();
        }
    public static MvcHtmlString UxSelectWithDataSource(this HtmlHelper htmlHelper, DataSource dataSource, string selectedValue = null, SelectAppearanceType appearance = null, bool liveSearch = false, bool showTick = false, bool showArrow = false, bool autoWidth = true, string width = null, bool disabled = false, string header = null, string container = null, string clientId = null)
    {
        var select = new Select(selectedValue, dataSource, appearance, liveSearch, showTick, showArrow, autoWidth, width, disabled, header, container, clientId);

        MvcHtmlString start = htmlHelper.Partial("ControlTemplates/" + select.ViewTemplate + "Start", select);
        MvcHtmlString end = htmlHelper.Partial("ControlTemplates/" + select.ViewTemplate + "End", select);

        return MvcHtmlString.Create(start.ToHtmlString() + end.ToHtmlString());
    }
		public void can_render_options_from_enumerable_of_simple_objects()
		{
			var optionNodes = new Select("foo.Bar").Options(new[] { 1, 2 }).ToString()
				.ShouldHaveHtmlNode("foo_Bar")
				.ShouldHaveChildNodesCount(2);

			optionNodes[0].ShouldBeUnSelectedOption("1", "1");
			optionNodes[1].ShouldBeUnSelectedOption("2", "2");
		}
Beispiel #16
0
 public void Exec_Simple()
 {
     //string dbPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), @"MyApplication\Northwind.db3");
     //DataService.Providers["Northwind"].DefaultConnectionString =
     //    String.Format(@"Data Source={0};Version=3;New=False;Connection Timeout=3", dbPath);
     
     int records = new Select("productID").From("Products").GetRecordCount();
     Assert.IsTrue(records == 77);
 }
Beispiel #17
0
        public SelectTests()
        {
            context = new TestingContext();
            select = new Select<TestModel>(context.Set<TestModel>());

            context.Set<TestModel>().RemoveRange(context.Set<TestModel>());
            context.Set<TestModel>().Add(ObjectFactory.CreateTestModel());
            context.SaveChanges();
        }
        /// <summary>
        /// hàm thực hiện việc xác nhận thông tin 
        /// </summary>
        /// <param name="objPhieuNhap"></param>
        /// <returns></returns>
        public ActionResult HuyXacNhanPhieuTraLaiKho(TPhieuNhapxuatthuoc objPhieuNhap)
        {
            HisDuocProperties objHisDuocProperties = PropertyLib._HisDuocProperties;
            string errorMessage = "";
            try
            {
                using (var Scope = new TransactionScope())
                {
                    using (var dbScope = new SharedDbConnectionScope())
                    {
                        SqlQuery sqlQuery = new Select().From(TPhieuNhapxuatthuocChitiet.Schema)
                            .Where(TPhieuNhapxuatthuocChitiet.Columns.IdPhieu).IsEqualTo(objPhieuNhap.IdPhieu);
                        TPhieuNhapxuatthuocChitietCollection objPhieuNhapCtCollection =
                            sqlQuery.ExecuteAsCollection<TPhieuNhapxuatthuocChitietCollection>();

                        foreach (TPhieuNhapxuatthuocChitiet objPhieuNhapCt in objPhieuNhapCtCollection)
                        {
                            //Kiểm tra ở kho nhập xem thuốc đã sử dụng chưa
                            ActionResult _Kiemtrathuochuyxacnhan = Kiemtrathuochuyxacnhan(objPhieuNhap, objPhieuNhapCt);
                            if (_Kiemtrathuochuyxacnhan != ActionResult.Success) return _Kiemtrathuochuyxacnhan;
                            int id_thuockho = -1;
                            StoredProcedure sp = SPs.ThuocNhapkhoOutput(objPhieuNhapCt.NgayHethan, objPhieuNhapCt.GiaNhap, objPhieuNhapCt.GiaBan,
                                                                      objPhieuNhapCt.SoLuong, Utility.DecimaltoDbnull(objPhieuNhapCt.Vat),
                                                                      objPhieuNhapCt.IdThuoc, objPhieuNhap.IdKhonhap, objPhieuNhapCt.MaNhacungcap,
                                                                      objPhieuNhapCt.SoLo, objPhieuNhapCt.SoDky, objPhieuNhapCt.SoQdinhthau, -1, id_thuockho,
                                                                      objPhieuNhap.NgayXacnhan, objPhieuNhapCt.GiaBhyt, objPhieuNhapCt.GiaPhuthuDungtuyen, objPhieuNhapCt.GiaPhuthuTraituyen, objPhieuNhapCt.KieuThuocvattu);
                            sp.Execute();
                            sp = SPs.ThuocXuatkho(objPhieuNhap.IdKhoxuat, objPhieuNhapCt.IdThuoc,
                                                          objPhieuNhapCt.NgayHethan, objPhieuNhapCt.GiaNhap,objPhieuNhapCt.GiaBan,
                                                          Utility.DecimaltoDbnull(objPhieuNhapCt.Vat),
                                                          Utility.Int32Dbnull(objPhieuNhapCt.SoLuong), objPhieuNhapCt.IdThuockho, objPhieuNhapCt.MaNhacungcap, objPhieuNhapCt.SoLo, objHisDuocProperties.XoaDulieuKhiThuocDaHet ? 1 : 0, errorMessage);

                            sp.Execute();
                            errorMessage = Utility.sDbnull(sp.OutputValues[0]);

                        }
                        //Xóa toàn bộ chi tiết trong TBiendongThuoc
                        new Delete().From(TBiendongThuoc.Schema)
                            .Where(TBiendongThuoc.IdPhieuColumn).IsEqualTo(objPhieuNhap.IdPhieu).Execute();
                        new Update(TPhieuNhapxuatthuoc.Schema)
                            .Set(TPhieuNhapxuatthuoc.Columns.IdNhanvien).EqualTo(null)
                            .Set(TPhieuNhapxuatthuoc.Columns.NguoiXacnhan).EqualTo(null)
                            .Set(TPhieuNhapxuatthuoc.Columns.NgayXacnhan).EqualTo(null)
                            .Set(TPhieuNhapxuatthuoc.Columns.TrangThai).EqualTo(0)
                            .Where(TPhieuNhapxuatthuoc.Columns.IdPhieu).IsEqualTo(objPhieuNhap.IdPhieu).Execute();
                    }
                    Scope.Complete();
                    return ActionResult.Success;
                }
            }
            catch (Exception exception)
            {
                log.Error("Loi ban ra tu sp :{0}", errorMessage);
                log.Error("Loi trong qua trinh xac nhan don thuoc :{0}", exception);
                return ActionResult.Error;
            }
        }
Beispiel #19
0
        static void Main(string[] args)
        {
            Select select = new Select();

            Authentication auth = new Authentication();
            auth.version = "1.1";   // Specify which Select API Version (1.0 or 1.1)

            PropertyFile rb = PropertyFile.getBundle("Environment");
            select.Url = rb.get("soap_url");
            auth.login = rb.get("soap_login");
            auth.password = rb.get("soap_password");

            // ProdTest
            //select.Url = "https://soap.prodtest.sj.vindicia.com/v1.0/soap.pl";
            //select.Url = "https://soap.prodtest.sj.vindicia.com/soap.pl";
            //auth.login = "******";
            //auth.password = "";

            // Staging:
            //select.Url = https://soap.staging.sj.vindicia.com/soap.pl
            //auth.login = xxx_soap
            //auth.password = "";

            // Production:
            //select.Url = https://soap.vindicia.com/soap.pl
            //auth.login = xxx_soap
            //auth.password = "";

            Console.WriteLine("soapVersion=" + SEL001BillSelect.getSelectVersion(auth));
            Console.WriteLine();
            Console.WriteLine("Using version=" + auth.version);
            Console.WriteLine("soapURL=" + select.Url);
            Console.WriteLine("soapLogin="******"FAILED" + DateTime.Now.DayOfYear + DateTime.Now.Hour + DateTime.Now.Minute + DateTime.Now.Second;
                string soapId = bill.run(select, auth, startMerchantTransactionId);

                Console.WriteLine("billTransactions soapId=" + soapId + "\n");
            }

            if (bFetch)
            {
                SEL002FetchSelect.run(select, auth);

                Console.WriteLine("fetchBillingResults completed.\n");
            }

            Console.ReadLine();
        }
Beispiel #20
0
 public ModuleBase GetTaigaNoise()
 {
     if (TaigaNoise == null)
     {
         TaigaNoise = new Select(0, 1, 1, StandartNoise, 
             new ScaleBias(0.5, 0, new Perlin(1, 2, 0.25, 4, DataBaseHandler.DataBase.Seed, QualityMode.High)), 
             new BiomeTranslator(Biomes, BiomeTypes.Taiga, Bounds.left, Bounds.top, Bounds.width, Bounds.height));
     }
     return TaigaNoise;
 }
Beispiel #21
0
        public void basic_select_renders_with_no_options()
        {
            var element = new Select("foo.Bar").ToString()
                .ShouldHaveHtmlNode("foo_Bar")
                .ShouldHaveAttributesCount(2)
                .ShouldBeNamed(HtmlTag.Select);

            element.ShouldHaveAttribute(HtmlAttribute.Name).WithValue("foo.Bar");
            element.ShouldHaveNoChildNodes();
        }
Beispiel #22
0
        public void Exec_AggregateExpression()
        {
            double result = new
                Select(Aggregate.Sum("UnitPrice*Quantity", "ProductSales"))
                .From(OrderDetail.Schema)
                .ExecuteScalar<double>();

            result = Math.Round(result, 2);
            Assert.IsTrue(result == 1354458.59);
        }
Beispiel #23
0
        public void Exec_SimpleWhereAnd()
        {
            ProductCollection products =
                DB.Select().From("Products")
                    .Where("categoryID").IsEqualTo(5)
                    .And("productid").IsGreaterThan(50)
                    .ExecuteAsCollection<ProductCollection>();

            int records = new Select().From("Products").Where("categoryID").IsEqualTo(5).And("productid").IsGreaterThan(50).GetRecordCount();
            Assert.IsTrue(records == 4);
        }
		public void select_with_options_for_enum_renders_enum_values_as_options()
		{
			var html = new Select("foo.Bar").Options<FakeEnum>().Selected(FakeEnum.Two).ToString();

			var element = html.ShouldHaveHtmlNode("foo_Bar");
			var optionNodes = element.ShouldHaveChildNodesCount(4);
			optionNodes[0].ShouldBeUnSelectedOption((int)FakeEnum.Zero, FakeEnum.Zero);
			optionNodes[1].ShouldBeUnSelectedOption((int)FakeEnum.One, FakeEnum.One);
			optionNodes[2].ShouldBeSelectedOption((int)FakeEnum.Two, FakeEnum.Two);
			optionNodes[3].ShouldBeUnSelectedOption((int)FakeEnum.Three, FakeEnum.Three);
		}
Beispiel #25
0
    /*
    ** 2001 September 15
    **
    ** The author disclaims copyright to this source code.  In place of
    ** a legal notice, here is a blessing:
    **
    **    May you do good and not evil.
    **    May you find forgiveness for yourself and forgive others.
    **    May you share freely, never taking more than you give.
    **
    *************************************************************************
    ** This file contains C code routines that are called by the parser
    ** to handle SELECT statements in SQLite.
    *************************************************************************
    **  Included in SQLite3 port to C#-SQLite;  2008 Noah B Hart
    **  C#-SQLite is an independent reimplementation of the SQLite software library
    **
    **  SQLITE_SOURCE_ID: 2011-06-23 19:49:22 4374b7e83ea0a3fbc3691f9c0c936272862f32f2
    **
    *************************************************************************
    */
    //#include "sqliteInt.h"


    /*
    ** Delete all the content of a Select structure but do not deallocate
    ** the select structure itself.
    */
    static void clearSelect( sqlite3 db, Select p )
    {
      sqlite3ExprListDelete( db, ref p.pEList );
      sqlite3SrcListDelete( db, ref p.pSrc );
      sqlite3ExprDelete( db, ref p.pWhere );
      sqlite3ExprListDelete( db, ref p.pGroupBy );
      sqlite3ExprDelete( db, ref p.pHaving );
      sqlite3ExprListDelete( db, ref p.pOrderBy );
      sqlite3SelectDelete( db, ref p.pPrior );
      sqlite3ExprDelete( db, ref p.pLimit );
      sqlite3ExprDelete( db, ref p.pOffset );
    }
Beispiel #26
0
        private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            // if (e.ColumnIndex == 4)
            //  {

            // textBox_id.Text = dataGridView2.Rows[e.RowIndex].Cells[0].Value.ToString();

            Select s = new Select();
            s.Show();

            // }
        }
    /// <summary>
    /// simple binding to country table using DAL
    /// </summary>
    protected void bind_data_grid()
    {
        string[] _cols2 = { "PackageTypeTable.PackageTypeID", "PackageTypeTable.PackageType" };
        string[] _order = { "PackageTypeTable.PackageType" };

        DataTable _dt = new Select(_cols2).From(DAL.Logistics.Tables.PackageTypeTable)
            .Where(DAL.Logistics.PackageTypeTable.PackageTypeColumn).IsNotNull().OrderAsc(_order).ExecuteDataSet().Tables[0];
        
        this.dxgridSearch.DataSource = _dt;
        this.dxgridSearch.KeyFieldName = "PackageTypeID";
        this.dxgridSearch.DataBind(); 
       
    }
Beispiel #28
0
        public void Acc_Collection_LoadTypedObject()
        {
            List<PID> result = new
                Select("productid", "productname", "unitprice")
                .From(Product.Schema)
                .OrderAsc("productid")
                .ExecuteTypedList<PID>();

            Assert.AreEqual(77, result.Count);
            Assert.AreEqual("Chai", result[0].ProductName);
            Assert.AreEqual(1, result[0].ProductID);
            Assert.AreEqual(18, result[0].UnitPrice);
        }
    /// <summary>
    /// simple binding to country table using DAL
    /// </summary>
    protected void bind_data_grid()
    {
        string[] _cols2 = { "Departments.DepartmentID", "Departments.Department" };
        string[] _order = { "Departments.Department" };

        DataTable _dt = new Select(_cols2).From(DAL.Logistics.Tables.Department)
            .Where(DAL.Logistics.Department.DepartmentXColumn).IsNotNull().OrderAsc(_order).ExecuteDataSet().Tables[0];
        
        this.dxgridSearch.DataSource = _dt;
        this.dxgridSearch.KeyFieldName = "DepartmentID";
        this.dxgridSearch.DataBind(); 
       
    }
 /// <summary>
 /// Fetches all test.
 /// </summary>
 /// <param name="repeatTime">The repeat time.</param>
 /// <returns>The fetch all test.</returns>
 /// <remarks>http://wintersun.cnblogs.com/</remarks>
 public long FetchAllTest(int repeatTime)
 {
     return Utility.PerformanceWatch(
         () =>
         {
             for (int i = 0; i < repeatTime; i++)
             {
                 var product = new Select().From<Product>();
                 var customer = new Select().From<Customer>();
                 var category = new Select().From<Category>();
             }
         });
 }
Beispiel #31
0
 Read16(
     Select(u => u == 0xA5A55AA5,
            Instr(Mnemonic.diswdt, InstrClass.Linear | InstrClass.Privileged),
Beispiel #32
0
 public static List <TestInfo> GetItems() => Select.ToList();
Beispiel #33
0
 public static List <AreaInfo> GetItems()
 {
     return(Select.ToList());
 }
Beispiel #34
0
        /// <summary>
        /// This method is intended to respond to client side Qi queries.
        /// Use of this method from .Net should be avoided in favor of
        /// one of the methods that take a delegate of type
        /// WhereDelegate&lt;LoginCounterColumns&gt;.
        /// </summary>
        /// <param name="where"></param>
        /// <param name="database"></param>
        public static LoginCounterCollection Where(QiQuery where, Database database = null)
        {
            var results = new LoginCounterCollection(database, Select <LoginCounterColumns> .From <LoginCounter>().Where(where, database));

            return(results);
        }
Beispiel #35
0
 /// <summary>
 /// 数据项是否存在
 /// </summary>
 /// <param name="entity"></param>
 /// <returns></returns>
 public static Task <bool> Exists(Config entity) =>
 Select.WhereDynamic(entity).AnyAsync();
Beispiel #36
0
 Instr(Mnemonic.scxt, reg16, mem16),  // 4 - reg, mem
 Read16(
     Select(u => (u & 0x4F0000FC) == 0x4F000000,
            Instr(Mnemonic.extp, R8w, pageNo),
Beispiel #37
0
 public void WriteSelect(string text) => Select.Append(text);
Beispiel #38
0
        protected void Page_Load(object sender, EventArgs e)
        {
            //---------------------------------------------------------
            // 1、新增记录
            //---------------------------------------------------------
            var branch = new Branch();

            branch.DeptCode = SPs.P_Branch_GetMaxBranchDeptCode(2, 1).ExecuteScalar() + "";
            branch.Name     = "客服部";
            branch.Comment  = "客户售后服务维护部门";
            branch.ParentId = 1;
            branch.Sort     = 7;
            branch.Depth    = 2;
            //AddDate这个属性不用赋值,ORM框架生成更新语句时会自动过滤该字段,更新时将会使用数据库中设置的默认值
            //branch.AddDate = DateTime.Now;

            //保存数据入库
            branch.Save();
            WriteLine("记录添加成功,新增Id为:" + branch.Id);


            //----------------------------------------------------------
            // 2、修改记录
            //----------------------------------------------------------
            var branchModel = Branch.SingleOrDefault(x => x.Id == branch.Id);

            //也可以这样用
            //var branchModel = new Branch(x => x.Id == branch.Id);
            //打印读取出来的数据
            WriteLine(branchModel.ToString());

            //修改名称为“售后服务部”
            branchModel.Name = "售后服务部";
            //保存
            branchModel.Save();

            //重新从数据库中读取出来并打印到输出窗口
            WriteLine((new Branch(x => x.Id == branch.Id)).ToString());


            //----------------------------------------------------------
            // 3、判断刚刚修改的记录是否存在
            //----------------------------------------------------------
            if (Branch.Exists(x => x.Id == branch.Id))
            {
                WriteLine("Id为" + branch.Id + "的记录存在!");
            }
            else
            {
                WriteLine("Id为" + branch.Id + "的记录不存在!");
            }


            //---------------------------------------------------------
            // 4、删除记录
            //---------------------------------------------------------
            //删除当前记录
            Branch.Delete(x => x.Id == branch.Id);
            //也可以这样操作:
            //branchModel.Delete();
            WriteLine("删除Id为" + branch.Id + "的记录成功!");


            //--------------------------------------------------------
            // 5、判断刚刚删除的记录是否存在
            //--------------------------------------------------------
            if (Branch.Exists(x => x.Id == branch.Id))
            {
                WriteLine("Id为" + branch.Id + "的记录存在!");
            }
            else
            {
                WriteLine("Id为" + branch.Id + "的记录不存在!");
            }


            //--------------------------------------------------------
            // 6、使用类实体附带的函数查询
            //--------------------------------------------------------
            //查找出所有记录 -- 使用All()
            var list = Branch.All();

            foreach (var item in list)
            {
                //打印记录到输出窗口
                WriteLine(item.ToString());
            }

            //查询指定条件的记录 -- 使用Find()
            IList <Branch> il = Branch.Find(x => x.Id > 2);

            foreach (var item in il)
            {
                WriteLine(item.ToString());
            }

            //获取第二页记录(每页3条记录)
            il = Branch.GetPaged("Id Asc", 2, 3);
            foreach (var item in il)
            {
                WriteLine(item.ToString());
            }

            //使用Id倒序排序,获取第三页记录(每页3条记录)
            il = Branch.GetPaged("Id Desc", 3, 3);
            foreach (var item in il)
            {
                WriteLine(item.ToString());
            }


            //--------------------------------------------------
            // 7、使用Select类查询
            //--------------------------------------------------
            //创建Select对象
            //var select = new Select();
            //显示指定的列
            var select = new Select(new string[] { BranchTable.Id, BranchTable.Name, BranchTable.DeptCode });

            //指定查询表
            select.From <Branch>();

            //运行完上面这条语句后,SQL已经生成出来了,在Debug状态将鼠标指向select就可以看到,往下继续执行时,每添加一个属性都会添加在生成的SQL语句中
            //添加查询条件 -- Id大于2且编号头两位为01的部门
            select.Where(BranchTable.Id).IsGreaterThanOrEqualTo(2).And(BranchTable.DeptCode).StartsWith("01");
            //查询时括号添加列子
            //select.OpenExpression().Where("").IsEqualTo(0).Or("").IsEqualTo(11).CloseExpression().And("").IsEqualTo(3);

            //设置去重复 -- SubSonic没有去重复选项,需要自己手动修改DLL源码
            select.Distinct(true);
            //或
            //select.IsDistinct = true;

            //设置查询数量
            select.Top("5");

            //添加排序 -- 倒序
            select.OrderDesc(BranchTable.Sort);
            //或
            //List<string> orderByList = new List<string>();
            //orderByList.Add(BranchTable.Sort + " Desc");
            //orderByList.Add(BranchTable.Id + " Desc");
            //select.OrderBys = orderByList;

            //设置分页,获取第一页记录(每页10条记录)
            select.Paged(1, 10);

            //执行查询 -- 返回DataTable
            var dt = select.ExecuteDataTable();

            if (dt != null && dt.Rows.Count > 0)
            {
                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    WriteLine(dt.Rows[i][BranchTable.Id] + " " + dt.Rows[i][BranchTable.Name]);
                }
            }

            //执行查询 -- 返回List
            var bl = select.ToList <Branch>();

            foreach (var item in bl)
            {
                WriteLine(item.ToString());
            }

            //查询总记录数
            var recordCount = select.GetRecordCount();

            WriteLine("记录数量:" + recordCount.ToString());


            //-------------------------------------------------------------
            // 8、HotelDBDB查询类的使用方式
            //-------------------------------------------------------------
            //使用数据库名称+DB作为名称的类,可以直接调用聚合函数
            var db = new SubSonicTestDB();

            //平均值
            WriteLine("平均值:" + db.Avg <Branch>(x => x.Id).Where <Branch>(x => x.Id < 10).ExecuteScalar() + "");
            //计算数量
            WriteLine("计算数量:" + db.Count <Branch>(x => x.Id).ExecuteScalar() + "");
            //计算合计数量
            WriteLine("计算合计数量:" + db.Sum <Branch>(x => x.Id).ExecuteScalar() + "");
            //最大值
            WriteLine("最大值:" + db.Max <Branch>(x => x.Id).ExecuteScalar() + "");
            //最小值
            WriteLine("最小值:" + db.Min <Branch>(x => x.Id).ExecuteScalar() + "");


            //---------------------------------------------------------------
            // 9、存储过程调用方法
            //---------------------------------------------------------------
            //使用SPs.存储过程名称(参数1,参数2,参数3)就可以调用存储过程
            var obj = SPs.P_Branch_GetMaxBranchDeptCode(1, 0).ExecuteScalar();

            WriteLine(obj + "");


            //---------------------------------------------------------------
            // 10、直接执行QueryCommand的方式
            //---------------------------------------------------------------
            //获取数据源 -- 主要用于绑定连接的服务器,如果有多台服务器多个数据库时,可使用不同的数据源来进行绑定查找
            var provider = SubSonic.DataProviders.ProviderFactory.GetProvider();
            //定义事务,给后面的事务调用
            var batch = new BatchQuery(provider);

            var sql = string.Format("select * from {0}", BranchTable.TableName);
            //例一:获取影响记录数
            QueryCommand qcCommand = new QueryCommand(sql, provider);

            WriteLine(qcCommand.Provider.ExecuteQuery(qcCommand) + "");

            //例二:获取DataTable
            var q     = new SubSonic.Query.QueryCommand(sql, provider);
            var table = q.Provider.ExecuteDataSet(q).Tables[0];

            if (dt != null && table.Rows.Count > 0)
            {
                for (int i = 0; i < table.Rows.Count; i++)
                {
                    WriteLine(table.Rows[i][BranchTable.Id] + " " + table.Rows[i][BranchTable.Name]);
                }
            }

            //例三:使用事务执行
            batch.QueueForTransaction(qcCommand);
            batch.ExecuteTransaction();

            //例四:直接使用数据源执行
            provider.ExecuteQuery(qcCommand);


            //----------------------------------------------------------------
            // 11、Linq查询
            //----------------------------------------------------------------
            //Linq查询方式
            var query = new Query <Branch>(db.provider);
            var posts = from p in query
                        where p.DeptCode.StartsWith("0101")
                        select p;

            foreach (var item in posts)
            {
                WriteLine(item.ToString());
            }

            query = db.GetQuery <Branch>();
            posts = from p in query
                    where p.Id > 3 && p.Id < 6
                    select p;

            foreach (var item in posts)
            {
                WriteLine(item.ToString());
            }

            //获取查询结果2
            List <Branch> li2 = query.ToList <Branch>();

            foreach (var item in li2)
            {
                WriteLine(item.ToString());
            }


            //---------------------------------------------------------------------
            // 12、Linq多表关联查询
            //---------------------------------------------------------------------
            //方法一
            var query5 = from p in Position.All()
                         join b in Branch.All() on p.Branch_Id equals b.Id
                         where b.DeptCode == "0101"
                         select p;

            foreach (var item in query5)
            {
                WriteLine(item.ToString());
            }

            //方法二
            var qry = (from p in db.Position
                       join b in db.Branch on p.Branch_Id equals b.Id
                       where b.DeptCode == "0101"
                       select new ListView
            {
                PositionName = p.Name,
                BranchName = p.Branch_Name,
                DeptCode = b.DeptCode
            });

            foreach (var item in qry)
            {
                WriteLine(item.ToString());
            }


            //-------------------------------------------------------------------------
            // 13、使用事务
            //-------------------------------------------------------------------------
            //例一
            //从部门表中查询出编号为0102的Id、名称与说明三列
            var query1 = new SubSonic.Query.Select(provider, BranchTable.Id, BranchTable.Name, BranchTable.Comment).From(
                BranchTable.TableName).Where <Branch>(x => x.DeptCode == "0102");

            //加入事务
            batch.QueueForTransaction(query1);

            //查询部门编号为0102且职位名称后面两个字为主管的所有职位
            var query2 = new SubSonic.Query.Select(provider).From <Position>().Where <Position>(x => x.Branch_DeptCode == "0102").And(
                PositionTable.Name).EndsWith("主管");

            //加入事务
            batch.QueueForTransaction(query2);
            //运行事务,不返回任何信息
            batch.ExecuteTransaction();

            //例二
            batch = new BatchQuery();
            batch.Queue(query1);
            batch.Queue(query2);
            //执行事务,并返回数据
            using (IDataReader rdr = batch.ExecuteReader())
            {
                if (rdr.Read())
                {
                    //query1 results
                    for (int i = 0; i < rdr.FieldCount; i++)
                    {
                        WriteLine(rdr[i] + "");
                    }
                }
                rdr.NextResult();
                if (rdr.Read())
                {
                    //query2 results
                    for (int i = 0; i < rdr.FieldCount; i++)
                    {
                        WriteLine(rdr[i] + "");
                    }
                }
            }

            //例三
            batch = new BatchQuery(provider);
            var query3 = from p in db.Branch
                         where p.Id > 1 && p.Id < 10
                         select p;

            batch.Queue(query3);

            var query4 = from p in db.Position
                         where p.Branch_DeptCode == "0103"
                         select p;

            batch.Queue(query4);

            //执行事务,并返回数据
            using (var rdr = batch.ExecuteReader())
            {
                if (rdr.Read())
                {
                    //query3 results
                    for (int i = 0; i < rdr.FieldCount; i++)
                    {
                        WriteLine(rdr[i] + "");
                    }
                }
                rdr.NextResult();
                if (rdr.Read())
                {
                    //query4 results
                    for (int i = 0; i < rdr.FieldCount; i++)
                    {
                        WriteLine(rdr[i] + "");
                    }
                }
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            HttpContext.Current.Response.Cache.SetAllowResponseInBrowserHistory(false);
            HttpContext.Current.Response.Cache.SetCacheability(HttpCacheability.NoCache);
            HttpContext.Current.Response.Cache.SetNoStore();
            Response.Cache.SetExpires(DateTime.Now);
            Response.Cache.SetValidUntilExpires(true);
            Response.Cache.SetCacheability(System.Web.HttpCacheability.NoCache);
            Response.Cache.SetNoStore();

            if (Request.Cookies[FormsAuthentication.FormsCookieName] != null)
            {
                HttpCookie authCookie = Request.Cookies[FormsAuthentication.FormsCookieName];

                FormsAuthenticationTicket ticket = FormsAuthentication.Decrypt(authCookie.Value);

                if (ticket.Expiration <= DateTime.Now)
                {
                    Response.Redirect("~/PL/Membership/Login.aspx");

                }//end if

                else
                {
                    Session sessionObject = new Session();
                    FormsAuthenticationTicket newTicket = new FormsAuthenticationTicket(ticket.Version, ticket.Name, DateTime.Now, DateTime.Now.AddMinutes(sessionObject.getSessionTimeLimit()), ticket.IsPersistent, ticket.UserData);
                    string encryptedTicket = FormsAuthentication.Encrypt(newTicket);
                    HttpCookie cookie = new HttpCookie(FormsAuthentication.FormsCookieName, encryptedTicket);
                    cookie.Expires = newTicket.Expiration;
                    Response.Cookies.Add(cookie);

                }//end else

                if (ticket.UserData != "Super Admin")
                {
                    Response.Redirect("~/PL/Membership/Login.aspx");

                }//end if

            }//end if

            else
            {
                Response.Redirect("~/PL/Membership/Login.aspx");

            }//end else

            string totalNumberOfUsers;

            string errorMessage;

            Select selectObject = new Select();

            totalNumberOfUsers = Select.Select_Total_Number_Of_Users();

            errorMessage = selectObject.getErrorMessage();

            if(errorMessage != null)
            {
                lblError.Text = errorMessage;
                lblError.Visible = true;

                ErrorMessage message = new ErrorMessage();

                MsgBox(message.SQLServerErrorMessage);
            }

            else
            {
                lblTotal.Text = totalNumberOfUsers.ToString();

                string testUsers;

                string errorMessage2;

                Select selectObject2 = new Select();

                testUsers = Select.Select_Test_Users();

                errorMessage2 = selectObject2.getErrorMessage();

                if (errorMessage2 != null)
                {
                    lblError.Text = errorMessage2;
                    lblError.Visible = true;

                    ErrorMessage message = new ErrorMessage();

                    MsgBox(message.SQLServerErrorMessage);
                }

                else
                {
                    lblTestUsers.Text = testUsers.ToString();

                    int adminCompUsers;

                    string errorMessage3;

                    Select selectObject3 = new Select();

                    adminCompUsers = Select.Select_Admin_Comp_Users();

                    errorMessage3 = selectObject3.getErrorMessage();

                    if (errorMessage3 != null)
                    {
                        lblError.Text = errorMessage3;
                        lblError.Visible = true;

                        ErrorMessage message = new ErrorMessage();

                        MsgBox(message.SQLServerErrorMessage);
                    }

                    else
                    {
                        lblAdminCompUsers.Text = adminCompUsers.ToString();

                        int _testUsers = Convert.ToInt32(testUsers);

                        int _totalNumberOfUsers = Convert.ToInt32(totalNumberOfUsers);

                        int _adminCompUsers = Convert.ToInt32(adminCompUsers);

                        string clients = "0";

                        int _clients = Convert.ToInt32(clients);

                        _clients = _totalNumberOfUsers - _adminCompUsers - _testUsers - 14;

                        lblClients.Text = _clients.ToString();

                    }//end else

                }//end else

            }//end else

        }//end event
Beispiel #40
0
        /// <summary>
        /// This method is intended to respond to client side Qi queries.
        /// Use of this method from .Net should be avoided in favor of
        /// one of the methods that take a delegate of type
        /// WhereDelegate&lt;UserRoleColumns&gt;.
        /// </summary>
        /// <param name="where"></param>
        /// <param name="database"></param>
        public static UserRoleCollection Where(QiQuery where, Database database = null)
        {
            var results = new UserRoleCollection(database, Select <UserRoleColumns> .From <UserRole>().Where(where, database));

            return(results);
        }
Beispiel #41
0
 public virtual Task <TDto> GetAsync <TDto>(Expression <Func <TEntity, bool> > exp)
 {
     return(Select.Where(exp).ToOneAsync <TDto>());
 }
Beispiel #42
0
 public virtual Task <TDto> GetAsync <TDto>(TKey id)
 {
     return(Select.WhereDynamic(id).ToOneAsync <TDto>());
 }
Beispiel #43
0
        private void CatalogIndexMessageEvent()
        {
            if (Client.GetHabbo().FlatType == "private")
            {
                PrivateRooms mRoom = AleedaEnvironment.GetCache().GetPrivateRooms().getRoom(Client.GetHabbo().RoomId);

                if (mRoom == null)
                {
                    return;
                }

                #region Bots
                if (AleedaEnvironment.GetCache().GetRoomBots().RoomBotCounts(Client.GetHabbo().RoomId) != 0)
                {
                    AleedaEnvironment.GetCache().GetRoomBots().LoadAnyBotChats(Client.GetHabbo().Username, Client.GetHabbo().RoomId);
                }
                #endregion

                Response.Initialize(45);
                GetWallItems().SerializeWallDisplay(GetResponse(), Client.GetHabbo().RoomId);
                SendResponse();

                Response.Initialize(32);
                GetFloorItems().Serialize(GetResponse(), Client.GetHabbo().RoomId);
                SendResponse();

                Response.Initialize(471); // "GW"
                Serialize.RoomEntryInfo(Client, AleedaEnvironment.GetHabboHotel().GetHabbos().GetHabbo((UInt32)mRoom.OwnerID).Username, Response);
                SendResponse();

                Response.Initialize(28); // "@\"
                Serialize.SerializeUsers(true, Client.GetHabbo().RoomId, Response);
                SendRoom();

                Response.Initialize(34); // "@b"
                Serialize.SerializeStatus(true, Client.GetHabbo().RoomId, Response);
                SendRoom();
            }
            else if (Client.GetHabbo().FlatType == "public")
            {
                Response.Initialize(471); // "GW"
                Serialize.RoomEntryInfo(Client, "", Response);
                SendResponse();

                Response.Initialize(30); // "@^"
                Response.Append(Select.GetPublicRoomItems(Client.GetHabbo().FlatModel));
                SendResponse();

                try
                {
                    Response.Initialize(28); // "@\"
                    Serialize.SerializeUsers(false, Client.GetHabbo().pRoomId, GetResponse());
                    SendRoom();

                    Response.Initialize(34); // "@b"
                    Serialize.SerializeStatus(false, Client.GetHabbo().RoomId, GetResponse());
                    SendRoom();
                }
                catch (Exception e)
                {
                    Console.WriteLine(e);
                }
            }
        }
Beispiel #44
0
 Read16(
     Select(u => u == 0x97976897,
            Instr(Mnemonic.pwrdn, InstrClass.Linear | InstrClass.Privileged),
Beispiel #45
0
 Read16(
     Select(u => u == 0x87877887,
            Instr(Mnemonic.idle, InstrClass.Linear | InstrClass.Privileged),
Beispiel #46
0
        public void SelectByText(string text, int timeout)
        {
            Select select = this.Driver.GetElement <Select>(this.dropDownLocator);

            select.SelectByText(text, timeout);
        }
Beispiel #47
0
 /// <summary>
 /// 根据前缀查询配置项列表
 /// </summary>
 /// <param name="prefix"></param>
 /// <returns></returns>
 public static Task <List <Config> > QueryByPrefix(string prefix) =>
 Select.Where(a => a.Id.StartsWith(prefix)).ToListAsync();
Beispiel #48
0
        public string SelectedOption()
        {
            Select select = this.Driver.GetElement <Select>(this.dropDownLocator);

            return(select.SelectElement().SelectedOption.Text);
        }
Beispiel #49
0
 /// <summary>
 /// 验证键值是否存在
 /// </summary>
 /// <param name="key"></param>
 /// <returns></returns>
 public static Task <bool> Exists(string key) =>
 Select.AnyAsync(a => a.Id == key);
Beispiel #50
0
        public void CompleteSummaryTab()
        {
            Wait.For(this.GetWindow <DealNotebookWindow>(), window =>
            {
                Click.On(window.SummaryTab.Header);
                Enter.TextInto(window.SummaryTab.ProposedCmt, "10");
                Click.On(window.SummaryTab.AddButton);

                Wait.For(this.GetWindow <QuestionWindow>(), dialog =>
                {
                    Click.On(dialog.YesButton);
                }, WaitToFinish.YES);

                Wait.For(this.GetWindow <CommonSelectWindow>(), dialog =>
                {
                    Enter.TextInto(dialog.IdentifyBy, "borror2014");
                    Click.On(dialog.SearchButton);
                }, WaitToFinish.YES);

                Wait.For(this.GetWindow <CommonListByShortNameWindow>(), dialog =>
                {
                    Select.By(dialog.ShortNameList, 0);
                    Click.On(dialog.OkButton);
                }, WaitToFinish.YES);

                Wait.For(this.GetWindow <DealBorrowerDetailsWindow>(), dialog =>
                {
                    Click.On(dialog.OkButton);
                }, WaitToFinish.YES);

                Click.On(window.SummaryTab.DealClassificationButton);

                Wait.For(this.GetWindow <CommonSelectCodeWindow>(), dialog =>
                {
                    //Select.By(dialog.ClassificationTree, 1);
                    Enter.TextInto(dialog.SearchByCodeTextBox, "CPF");
                    Click.On(dialog.OkButton);
                }, WaitToFinish.YES);

                Click.On(window.SummaryTab.AdminAgentButton);

                Wait.For(this.GetWindow <QuestionWindow>(), dialog =>
                {
                    Click.On(dialog.YesButton);
                });

                Wait.For(this.GetWindow <DealAdminAgentWindow>(), childDialog =>
                {
                    Click.On(childDialog.CustomerButton);

                    Wait.For(this.GetWindow <CommonSelectWindow>(), dialogTwo =>
                    {
                        Enter.TextInto(dialogTwo.IdentifyBy, "BANK 1");
                        Click.On(dialogTwo.SearchButton);
                    }, WaitToFinish.YES);

                    Wait.For(this.GetWindow <CommonListByShortNameWindow>(), dialogTwo =>
                    {
                        Select.By(dialogTwo.ShortNameList, 0);
                        Click.On(dialogTwo.OkButton);
                    }, WaitToFinish.YES);

                    Click.On(childDialog.OkButton);
                }, WaitToFinish.YES);
            });
        }
Beispiel #51
0
        /// <summary>
        /// This method is intended to respond to client side Qi queries.
        /// Use of this method from .Net should be avoided in favor of
        /// one of the methods that take a delegate of type
        /// WhereDelegate&lt;MainObjectColumns&gt;.
        /// </summary>
        /// <param name="where"></param>
        /// <param name="database"></param>
        public static MainObjectCollection Where(QiQuery where, Database database = null)
        {
            var results = new MainObjectCollection(database, Select <MainObjectColumns> .From <MainObject>().Where(where, database));

            return(results);
        }
Beispiel #52
0
        internal static IEnumerable <dynamic> Select <TSource>(this IEnumerable <TSource> source, Filter filter)
        {
            var select = new Select <TSource>().Apply(filter);

            return(source.Select(select));
        }
Beispiel #53
0
        public void SelectByIndex(int index, int timeout)
        {
            Select select = this.Driver.GetElement <Select>(this.dropDownLocator, 300);

            select.SelectByIndex(index, timeout);
        }
Beispiel #54
0
/*
** Generate an expression tree to implement the WHERE, ORDER BY,
** and LIMIT/OFFSET portion of DELETE and UPDATE statements.
**
**     DELETE FROM table_wxyz WHERE a<5 ORDER BY a LIMIT 1;
**                            \__________________________/
**                               pLimitWhere (pInClause)
*/
        Expr sqlite3LimitWhere(
            Parse pParse,      /* The parser context */
            SrcList pSrc,      /* the FROM clause -- which tables to scan */
            Expr pWhere,       /* The WHERE clause.  May be null */
            ExprList pOrderBy, /* The ORDER BY clause.  May be null */
            Expr pLimit,       /* The LIMIT clause.  May be null */
            Expr pOffset,      /* The OFFSET clause.  May be null */
            char zStmtType     /* Either DELETE or UPDATE.  For error messages. */
            )
        {
            Expr     pWhereRowid  = null; /* WHERE rowid .. */
            Expr     pInClause    = null; /* WHERE rowid IN ( select ) */
            Expr     pSelectRowid = null; /* SELECT rowid ... */
            ExprList pEList       = null; /* Expression list contaning only pSelectRowid */
            SrcList  pSelectSrc   = null; /* SELECT rowid FROM x ... (dup of pSrc) */
            Select   pSelect      = null; /* Complete SELECT tree */

/* Check that there isn't an ORDER BY without a LIMIT clause.
 */

            if (pOrderBy != null && (pLimit == null))
            {
                sqlite3ErrorMsg(pParse, "ORDER BY without LIMIT on %s", zStmtType);
                pParse.parseError = 1;
                goto limit_where_cleanup_2;
            }

/* We only need to generate a select expression if there
** is a limit/offset term to enforce.
*/
            if (pLimit == null)
            {
/* if pLimit is null, pOffset will always be null as well. */
                Debug.Assert(pOffset == null);
                return(pWhere);
            }

/* Generate a select expression tree to enforce the limit/offset
** term for the DELETE or UPDATE statement.  For example:
**   DELETE FROM table_a WHERE col1=1 ORDER BY col2 LIMIT 1 OFFSET 1
** becomes:
**   DELETE FROM table_a WHERE rowid IN (
**     SELECT rowid FROM table_a WHERE col1=1 ORDER BY col2 LIMIT 1 OFFSET 1
**   );
*/

            pSelectRowid = sqlite3PExpr(pParse, TK_ROW, null, null, null);
            if (pSelectRowid == null)
            {
                goto limit_where_cleanup_2;
            }
            pEList = sqlite3ExprListAppend(pParse, null, pSelectRowid);
            if (pEList == null)
            {
                goto limit_where_cleanup_2;
            }

/* duplicate the FROM clause as it is needed by both the DELETE/UPDATE tree
** and the SELECT subtree. */
            pSelectSrc = sqlite3SrcListDup(pParse.db, pSrc, 0);
            if (pSelectSrc == null)
            {
                sqlite3ExprListDelete(pParse.db, pEList);
                goto limit_where_cleanup_2;
            }

/* generate the SELECT expression tree. */
            pSelect = sqlite3SelectNew(pParse, pEList, pSelectSrc, pWhere, null, null,
                                       pOrderBy, 0, pLimit, pOffset);
            if (pSelect == null)
            {
                return(null);
            }

/* now generate the new WHERE rowid IN clause for the DELETE/UDPATE */
            pWhereRowid = sqlite3PExpr(pParse, TK_ROW, null, null, null);
            if (pWhereRowid == null)
            {
                goto limit_where_cleanup_1;
            }
            pInClause = sqlite3PExpr(pParse, TK_IN, pWhereRowid, null, null);
            if (pInClause == null)
            {
                goto limit_where_cleanup_1;
            }

            pInClause->x.pSelect = pSelect;
            pInClause->flags    |= EP_xIsSelect;
            sqlite3ExprSetHeight(pParse, pInClause);
            return(pInClause);

/* something went wrong. clean up anything allocated. */
limit_where_cleanup_1:
            sqlite3SelectDelete(pParse.db, pSelect);
            return(null);

limit_where_cleanup_2:
            sqlite3ExprDelete(pParse.db, ref pWhere);
            sqlite3ExprListDelete(pParse.db, pOrderBy);
            sqlite3ExprDelete(pParse.db, ref pLimit);
            sqlite3ExprDelete(pParse.db, ref pOffset);
            return(null);
        }
Beispiel #55
0
        public void CreatePrimary()
        {
            Wait.For(this.GetWindow <DealNotebookWindow>(), window =>
            {
                Click.On(window.DistributionMenuItem);
                Click.On(window.PrimariesMenuItem);
            });

            Close.This(this.GetWindow <DealNotebookWindow>());
            Close.This(this.GetWindow <FacilityWindow>());
            Close.This(this.GetWindow <FacilityNavigatorWindow>());

            Wait.For(this.GetWindow <PrimaryListWindow>(), window =>
            {
                Click.On(window.AddButton);

                Wait.For(this.GetWindow <PrimaryCreateWindow>(), dialog =>
                {
                    Click.On(dialog.LenderButton);

                    Wait.For(this.GetWindow <CommonSelectWindow>(), childDialog =>
                    {
                        Enter.TextInto(childDialog.IdentifyBy, "BANK 1");
                        Click.On(childDialog.SearchButton);
                    }, WaitToFinish.YES);

                    Wait.For(this.GetWindow <CommonListByShortNameWindow>(), childDialog =>
                    {
                        Select.By(childDialog.ShortNameList, 0);
                        Click.On(childDialog.OkButton);
                    }, WaitToFinish.YES);

                    Click.On(dialog.BroughtInByButton);

                    Wait.For(this.GetWindow <CommonSelectWindow>(), childDialog =>
                    {
                        Enter.TextInto(childDialog.IdentifyBy, "BANK 1");
                        Click.On(childDialog.SearchButton);
                    }, WaitToFinish.YES);

                    Wait.For(this.GetWindow <CommonListByShortNameWindow>(), childDialog =>
                    {
                        Select.By(childDialog.ShortNameList, 0);
                        Click.On(childDialog.OkButton);
                    }, WaitToFinish.YES);

                    Click.On(dialog.OkButton);
                });

                Wait.For(this.GetWindow <PrimaryPendingOrigWindow>(), dialog =>
                {
                    Click.On(dialog.Facilities.Header);
                    Enter.TextInto(dialog.SellAmount, "10");

                    //Click.On(dialog.AmountsOrDates.Header);

                    Click.On(dialog.Contacts.Header);
                    Click.On(dialog.Contacts.AddContactsButton);

                    Wait.For(this.GetWindow <ContactsCircleWindow>(), childDialog =>
                    {
                        Select.By(childDialog.AvailableList, 0);
                        Click.On(childDialog.OkButton);
                    });

                    Wait.For(this.GetWindow <ContactsSelectionWindow>(), childDialog =>
                    {
                        Click.On(childDialog.ExitButton);
                    });

                    Click.On(dialog.Codes.Header);
                    //Click.On(dialog.Maintenance);
                    //Click.On(dialog.PortfolioAllocations); // TODO:

                    Click.On(dialog.WorkflowTab.Header);
                    Select.By(dialog.WorkflowTab.WorkflowTree, 0, true);

                    Wait.For(this.GetWindow <WarningWindow>(), childDialog =>
                    {
                        Click.On(childDialog.YesButton);
                    });

                    Wait.For(this.GetWindow <PortfolioSetCircledOrLegalTradeDateWindow>(), childDialog =>
                    {
                        Click.On(childDialog.OkButton);
                    });
                });

                Close.This(this.GetWindow <PrimaryPendingOrigWindow>());

                //Click.On(window.ExitButton);
            });

            Close.This(this.GetWindow <PrimaryListWindow>());

            // OPEN DEAL HERE
            //Wait.For(this.GetWindow<DealNotebookWindow>(), window =>
            //{
            //    Click.On(window.WorkflowTab.Header);
            //    Select.By(window.WorkflowTab.WorkflowTree, 0);
            //});
        }
Beispiel #56
0
 Read16(
     Select(u => u == 0xB7B748B7,
            Instr(Mnemonic.srst, InstrClass.Terminates | InstrClass.Privileged),
Beispiel #57
0
 Read16(
     Select(u => u == 0xB5B54AB5,
            Instr(Mnemonic.einit, InstrClass.Linear | InstrClass.Privileged),
Beispiel #58
0
 Read16(
     Select(u => u == 0xA7A758A7,
            Instr(Mnemonic.srvwdt, InstrClass.Linear | InstrClass.Privileged),
Beispiel #59
0
 public Any(Field field, SqlOperator sqlOperator, Select select) : base(field, sqlOperator)
 {
     Select = @select;
 }
Beispiel #60
0
 public static TestInfo GetItem(int Id) => SqlHelper.CacheShell(string.Concat("es_BLL_Test_", Id), itemCacheTimeout, () => Select.WhereId(Id).ToOne());