Esempio n. 1
0
        public static IEnumerable <SelectListItem> GetEntityTypes(string selectedId)
        {
            var entityTypes = EntityTypeManager.GetEntityTypes();

            return(entityTypes.Select(et => new SelectListItem {
                Selected = et.Id.ToString().Equals(selectedId), Text = et.Name, Value = et.Id.ToString()
            }));
        }
Esempio n. 2
0
        private void BindEntityTypeList()
        {
            EntityTypeCollection entityTypeList = new EntityTypeCollection();

            entityTypeList = EntityTypeManager.GetCollection(EntityEnum.EmployeeType);

            rptEntityTypeList.DataSource = entityTypeList;
            rptEntityTypeList.DataBind();
        }
Esempio n. 3
0
        private void BindEmailType()
        {
            EntityTypeCollection items = EntityTypeManager.GetCollection(EntityEnum.EmailType);

            drpEmailType.DataSource = items;
            drpEmailType.DataBind();

            drpEmailType.Items.Insert(0, new ListItem {
                Text = "Select Email Type", Value = "0"
            });
        }
Esempio n. 4
0
        private void BindEmployeeType()
        {
            EntityTypeCollection employeeTypeList = EntityTypeManager.GetCollection(EntityEnum.EmployeeType);

            drpEmployeeType.DataSource = employeeTypeList;
            drpEmployeeType.DataBind();

            drpEmployeeType.Items.Insert(0, new ListItem {
                Text = "(Select Emplyee Type)"
            });
        }
Esempio n. 5
0
        public void InitTest()
        {
            //BitArray bitArray = new BitArray(8);
            //bitArray.Set(0, true);
            //Console.WriteLine(bitArray.);
            //DataManager.Init();
            //Entity entity = new Entity("123");
            //EntityManager.DataChain.Add(entity);
            //Console.WriteLine(typeof(SystemAction<A1, B1>).FullName);
            //ActionManager.Init();
            EntityManager.Init();
            //for (int i = 0; i < 64; i++)
            //{
            //    EntityManager.CreateEntity(1, null);
            //}
            //LE2 e2 = new LE2();
            //DataBlock<D1> dataBlock = new DataBlock<D1>();
            //D1[] d1s = dataBlock.Datas;
            //A1 a1 = new A1();
            //C1 c1 = new C1();
            //Execute<A1, C1, D1> execute = e2.Execute;
            //execute?.Invoke(-12, ref a1, ref c1, ref d1s[2]);
            //Console.WriteLine(d1s[2].a);
            Console.WriteLine(EntityManager.CreateEntity(1, "123asd"));
            Console.WriteLine(EntityManager.CreateEntity(1, "1234"));
            Console.WriteLine(EntityManager.CreateEntity(1, "12"));
            Console.WriteLine(EntityManager.CreateEntity(0, "12345"));
            Console.WriteLine(EntityManager.CreateEntity(0, "12367"));
            EntityManager.RemoveEntity(EntityTypeManager.GetEntityTypeId(typeof(GroupB)), 0);
            EntityManager.Execute();
            Thread.Sleep(100);
            EntityManager.Execute();
            Thread.Sleep(100);
            EntityManager.Execute();
            Thread.Sleep(100);
            EntityManager.Execute();
            Thread.Sleep(100);
            Entity entity = EntityManager.GetEntity(1);

            Console.WriteLine("----------");
            Console.WriteLine(entity.GetData <D1>().a);
            Assert.AreEqual(entity.GetData <D1>().a, 1);
            Console.WriteLine(entity.Name);

            //GroupManager.GetEntityType(0).Execute(1);
            //Console.WriteLine();
            //GroupManager.GetEntityType(1).Execute(1);
            //LEAction lEAction = new LEAction();
            //Execute<A1, B1> action = lEAction.Execute;
        }
Esempio n. 6
0
        private void BindEmailType()
        {
            EntityTypeCollection items = EntityTypeManager.GetCollection(EntityEnum.Email);

            //ListItemCollection drpItems = new ListItemCollection();

            //ListItem option01 = new ListItem { Text = "List Item 01", Value = "1" };
            //ListItem option02 = new ListItem { Text = "List Item 02", Value = "2" };
            //ListItem option03 = new ListItem { Text = "List Item 03", Value = "3" };

            //drpItems.Add(option01);
            //drpItems.Add(option02);
            //drpItems.Add(option03);

            drpEmailType.DataSource = items;
            drpEmailType.DataBind();

            drpEmailType.Items.Insert(0, new ListItem {
                Text = "(Select Email Type)", Value = "0"
            });
        }
 public void DeleteEntityType(int entityTypeId)
 {
     if (entityTypeId > 0)
     {
         try
         {
             if (!EntityTypeManager.Delete(entityTypeId))
             {
                 throw new FaultException <EntityLookupServiceFault>(
                           new EntityLookupServiceFault("No records were affected"), "Delete failed");
             }
         }
         catch (BLLException ex)
         {
             throw new FaultException <EntityLookupServiceFault>(
                       new EntityLookupServiceFault(ex.Message), "Validation failed");
         }
     }
     else
     {
         throw new FaultException <EntityLookupServiceFault>(
                   new EntityLookupServiceFault("Entity TypeId was not valid"), "validation failed");
     }
 }
 public void SaveEntityType(EntityTypeDTO entityTypeToSave)
 {
     if (entityTypeToSave != null)
     {
         if (entityTypeToSave.EntityId > 0)
         {
             if (string.IsNullOrEmpty(entityTypeToSave.EntityTypeName))
             {
                 throw new FaultException <EntityLookupServiceFault>(
                           new EntityLookupServiceFault("EntityType value is required"), "Validation Failed");
             }
             else
             {
                 try
                 {
                     EntityTypeManager.Save(entityTypeToSave.EntityId, HydrateEntityType(entityTypeToSave));
                 }
                 catch (BLLException ex)
                 {
                     throw new FaultException <EntityLookupServiceFault>(
                               new EntityLookupServiceFault(ex.Message), "Save Failed");
                 }
             }
         }
         else
         {
             throw new FaultException <EntityLookupServiceFault>(
                       new EntityLookupServiceFault("Entity Id is required"), "Validation Failed");
         }
     }
     else
     {
         throw new FaultException <EntityLookupServiceFault>(
                   new EntityLookupServiceFault("EntityType object was invalid"), "Validation Failed");
     }
 }
 /// <summary>
 /// Get primary keys according to type of entity.
 /// </summary>
 /// <returns>List of primary keys.</returns>
 public List <string> GetPrimaryKeys()
 {
     return(EntityTypeManager.GetPrimaryKeys());
 }
Esempio n. 10
0
        /// <summary>
        /// Cria a model que será usada na vinculação.
        /// </summary>
        /// <param name="controllerContext"></param>
        /// <param name="bindingContext"></param>
        /// <param name="modelType"></param>
        /// <returns></returns>
        protected override object CreateModel(System.Web.Mvc.ControllerContext controllerContext, System.Web.Mvc.ModelBindingContext bindingContext, Type modelType)
        {
            var getMethodName = _getMethodName ?? string.Format("Get{0}", modelType.Name);
            var methods       = _flowType.GetMethods(System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.Public | System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Static);
            var getMethods    = methods.Where(f => f.Name == getMethodName).ToArray();
            var loader        = EntityTypeManager.GetLoader(modelType);

            System.Reflection.MethodInfo getMethod = null;
            if (getMethods.Length == 1)
            {
                getMethod = getMethods[0];
            }
            else if (loader.HasUid)
            {
                foreach (var method in getMethods)
                {
                    var methodParameters = method.GetParameters();
                    if (methodParameters.Length == 1 && methodParameters[0].ParameterType == typeof(int))
                    {
                        getMethod = method;
                        break;
                    }
                }
            }
            if (getMethod == null)
            {
                throw new InvalidOperationException(ResourceMessageFormatter.Create(() => Properties.Resources.EntityBinder_GetMethodNotFound, getMethodName, _flowType.FullName).Format());
            }
            var descriptor = GetTypeDescriptor(controllerContext, bindingContext);
            var record     = GetRecordOfKey(controllerContext, bindingContext, modelType);
            var flow       = GetFlowInstance();

            if (loader.HasUid && record.GetInt32(loader.UidPropertyName) <= 0)
            {
                return(CreateEntity(flow, modelType));
            }
            object[] parameters = null;
            if (record.Descriptor.Count == 1)
            {
                parameters = new object[] {
                    record.GetInt32(0)
                }
            }
            ;
            else
            {
                var methodParameters = getMethod.GetParameters();
                parameters = new object[methodParameters.Length];
                for (var i = 0; i < parameters.Length; i++)
                {
                    var key = record.Descriptor.FirstOrDefault(f => StringComparer.InvariantCultureIgnoreCase.Equals(f.Name, methodParameters[i].Name));
                    if (key == null && methodParameters[i].Name == "id" && loader.HasUid)
                    {
                        key = record.Descriptor.FirstOrDefault(f => StringComparer.InvariantCultureIgnoreCase.Equals(f.Name, loader.UidPropertyName));
                    }
                    if (key != null)
                    {
                        parameters[i] = Colosoft.Reflection.TypeConverter.Get(methodParameters[i].ParameterType, record.GetValue(key.Name));
                    }
                    ;
                }
            }
            Business.IEntity entity = null;
            try
            {
                entity = (Business.IEntity)getMethod.Invoke(flow, parameters);
            }
            catch (System.Reflection.TargetInvocationException ex)
            {
                throw ex.InnerException;
            }
            if (entity == null)
            {
                entity = CreateEntity(flow, modelType);
            }
            if (entity.Uid == 0)
            {
                entity.Uid = entity.TypeManager.GenerateInstanceUid(modelType);
            }
            return(entity);
        }
        public EntityTypeDTOCollection GetEntityTypeCollection(int entityId)
        {
            EntityTypeCollection entityTypeCollection = EntityTypeManager.GetCollection(entityId);

            return(HydrateEntityTypeDTO(entityTypeCollection));
        }
 /// <summary>
 /// Get foreign keys according to type name.
 /// </summary>
 /// <returns>List of foreign keys.</returns>
 public List <RelationshipDetail> GetForeignKeyDetails()
 {
     return(EntityTypeManager.GetForeignKeyDetails());
 }
Esempio n. 13
0
        public async Task <JsonResult> DeleteEntityType(EntityTypeAddEditModel entityType)
        {
            Quince.Utils.Messages.Response response = await EntityTypeManager.DeleteEntiTypeAsync(entityType.Id);

            return(Json(response));
        }
Esempio n. 14
0
        public PartialViewResult EditEntityType(long id)
        {
            var entityType = EntityTypeManager.GetEntityTypeEditModel(id);

            return(PartialView("AddEntityType", entityType));
        }
Esempio n. 15
0
 private void InitDatabase(UserManager <User> userManager, IMenuHelper menuHelper, EntityTypeManager entityTypeManager)
 {
 }
 /// <summary>
 /// Get navigation details according to name of type
 /// </summary>
 /// <returns>Navigation details of type</returns>
 public NavigationDetail GetNavigationDetail()
 {
     return(EntityTypeManager.GetNavigationDetail());
 }
Esempio n. 17
0
 public static IEnumerable <EntityTypeModel> GetEntityTypes()
 {
     return(EntityTypeManager.GetEntityTypes(true));
 }
Esempio n. 18
0
        public JsonResult GetEntityTypes(DTRequest dtRequest)
        {
            var response = EntityTypeManager.GetEntityTypes(dtRequest);

            return(Json(response));
        }
 /// <summary>
 /// Get simple properties of entity.
 /// </summary>
 /// <returns>Simple properties of entity.</returns>
 public List <EdmProperty> GetSimpleEntityProperties()
 {
     return(EntityTypeManager.GetSimpleEntityProperties());
 }
Esempio n. 20
0
        public PartialViewResult DeleteEntityType(long id)
        {
            var entityType = EntityTypeManager.GetEntityTypeEditModel(id);

            return(PartialView(entityType));
        }
 /// <summary>
 /// If any of key members of entity is store generated.
 /// </summary>
 /// <returns>If any of key members of entity is store generated.</returns>
 public bool HasStoreGeneratedKey()
 {
     return(EntityTypeManager.HasStoreGeneratedKey());
 }
 /// <summary>
 /// Get distinct unique properties of entity.
 /// </summary>
 /// <returns>List of unique properties.</returns>
 public List <PropertyInfo> GetUniqueProperties()
 {
     return(EntityTypeManager.GetUniqueProperties());
 }
        public EntityTypeDTO GetEntityType(int entityTypeId)
        {
            EntityType entityType = EntityTypeManager.GetItem(entityTypeId);

            return(HydrateEntityTypeDTO(entityType));
        }