Esempio n. 1
0
        /// <summary>
        /// Creates a select operation with all DataType's members and inheritance inner joins
        /// </summary>
        /// <returns>Select operation</returns>
        protected Select <TType> CreateSelect()
        {
            Select <TType> select = new Select <TType>();
            DataType       dtype  = DataType;

            select.AddMembers(dtype.DataMembers.ToArray());

            return(select);
        }
Esempio n. 2
0
        private void MenuItemPropietarios_Click(object sender, EventArgs e)
        {
            Master.Visible       = true;
            gridMainHome.Visible = false;

            var dataType = DataType <Propietario> .GetDataType();

            Select select = new Select();

            select.DataType = dataType;
            select.AddMembers(select.DataType.AllDataMembers);
            select.Limit = new SelectLimit(0, 20);

            new SelectController(Master, select).Start();
        }
Esempio n. 3
0
        public void GenericOperations()
        {
            MapTypes();
            //Drop();
            //Create();

            for (int i = 0; i < 0; i++)
            {
                CustomerContact cc = new CustomerContact();
                cc.Firstname = "Fulanito " + i;
                cc.LastName  = "De tal " + i;
                cc.BirthDate = DateTime.Now;

                cc.Customer           = new Customer();
                cc.Customer.LegalName = "Cliente " + i;
                cc.Customer.Email     = "Email " + i;

                cc.Address1              = new Address();
                cc.Address1.Street       = "Calle " + i;
                cc.Address1.Number       = "# " + i;
                cc.Address1.Country      = new Country();
                cc.Address1.Country.Name = "Pais " + i;

                cc.Address2         = new Address();
                cc.Address2.Street  = "2 Calle " + i;
                cc.Address2.Number  = "2 # " + i;
                cc.Address2.Country = cc.Address1.Country;

                DataBase.Table <int, Country>().Add(0, cc.Address1.Country);
                DataBase.Table <int, Address>().Add(0, cc.Address1);
                DataBase.Table <int, Address>().Add(0, cc.Address2);
                DataBase.Table <int, Customer>().Add(0, cc.Customer);
                DataBase.Table <int, CustomerContact>().Add(0, cc);
            }

            Select <CustomerContact> select = new Select <CustomerContact>();

            select.AddMembers
            (
                c => c.Id,
                c => c.BirthDate,
                c => c.Customer.LegalName,
                c => c.Address1.Street,
                c => c.Address1.Country.Name,
                c => c.Address2.Street,
                c => c.Address2.Country.Name
            );

            var dtype = DataType <CustomerContact> .GetMap();

            select.Where.Add(new Filters.ValueCompareFilter()
            {
                Member         = dtype[x => x.Id],
                ValueToCompare = 3,
                Operator       = Data.CompareOperator.LessThanEqual,
            });

            select.OrderBy.Add(new Operations.OrderBy()
            {
                Member = dtype[x => x.Id], Direction = Data.SortDirection.Descending
            });

            var result = DataBase.Select <CustomerContact>(select).ToList();

            //Drop();
        }