Exemplo n.º 1
0
        public static int Save(int entityId, EntityType entityTypeToSave)
        {
            BrokenRuleCollection saveBrokenRules = new BrokenRuleCollection();

            if (entityId <= 0)
            {
                saveBrokenRules.Add("Entity", "Invalid Id for Entity Relationship");
            }

            //make sure email type is in correct format
            // ValidateEmail(emailToSave, ref saveBrokenRules);

            //email type is required
            if (string.IsNullOrEmpty(entityTypeToSave.EntityTypeName))
            {
                saveBrokenRules.Add("Entity Type Name", "Name is required.");
            }

            if (saveBrokenRules.Count() > 0)
            {
                throw new BLLException("There was an error saving Email", saveBrokenRules);
            }
            else
            {
                // Validation successful - call data access layer to save
                return(EntityTypeDAL.Save(entityId, entityTypeToSave));
            }
        }
Exemplo n.º 2
0
        private void BindEntityType()
        {
            int entityTypeId = Request.QueryString["EntityTypeId"].ToInt();

            if (entityTypeId > 0)
            {
                EntityType entityTypeLookup = EntityTypeDAL.GetItem(entityTypeId);

                if (entityTypeLookup != null)
                {
                    lblEntityTypeId.Text   = entityTypeLookup.EntityTypeId.ToString();
                    lblEntityId.Text       = entityTypeLookup.EntityId.ToString();
                    lblEntityTypeName.Text = entityTypeLookup.EntityTypeName;
                    lblDisplayName.Text    = entityTypeLookup.DisplayName;
                    lblDescription.Text    = entityTypeLookup.Description;
                }

                else
                {
                    lblMessage.Text = "EntityType could not be found.";
                }
            }
            else
            {
                lblMessage.Text = "Invalid ID. EntityType record could not be found.";
            }
        }
Exemplo n.º 3
0
        private void BindEntityTypeList()
        {
            EntityTypeCollection entityTypeList = new EntityTypeCollection();

            entityTypeList = EntityTypeDAL.GetCollection();
            rptEntityTypeList.DataSource = entityTypeList;
            rptEntityTypeList.DataBind();
        }
Exemplo n.º 4
0
 public static bool Delete(int entityTypeId)
 {
     if (entityTypeId > 0)
     {
         return(EntityTypeDAL.Delete(entityTypeId));
     }
     else
     {
         throw new BLLException("Delete Failed. Entity Type Id is invalid." + entityTypeId.ToString());
     }
 }
Exemplo n.º 5
0
        public static EntityType GetItem(int entityTypeId)
        {
            BrokenRuleCollection saveBrokenRules = new BrokenRuleCollection();

            if (entityTypeId <= 0)
            {
                saveBrokenRules.Add("Entity Type", "Invalid Id" + entityTypeId.ToString());

                throw new BLLException("There was an error saving Email", saveBrokenRules);
            }
            EntityType item = EntityTypeDAL.GetItem(entityTypeId);

            if (item == null)
            {
                saveBrokenRules.Add("EntityType", "Could not retrieve record with ID:" + entityTypeId.ToString());
                // Validation successful - call data access layer to save
                throw new BLLException("Error : No record found ", saveBrokenRules);
            }
            else
            {
                return(item);
            }
        }
Exemplo n.º 6
0
        private void BindEntityType()
        {
            int entityTypeId = Request.QueryString["EntityTypeId"].ToInt();

            if (entityTypeId > 0)
            {
                EntityType entityTypeLookup = EntityTypeDAL.GetItem(entityTypeId);

                if (entityTypeLookup != null)
                {
                    lblEntityTypeId.Text   = entityTypeLookup.EntityTypeId.ToString();
                    lblEntityId.Text       = entityTypeLookup.EntityId.ToString();
                    lblEntityTypeName.Text = entityTypeLookup.EntityTypeName.ToString();
                }
                else
                {
                    lblMessage.Text = "Instructor could not be found.";
                }
            }
            else
            {
                lblMessage.Text = "Invalid Id. Instructor record could not be found.";
            }
        }
Exemplo n.º 7
0
        public static EntityTypeCollection GetCollection(int entityId)
        {
            EntityTypeCollection entityTypeCollection = EntityTypeDAL.GetCollection(entityId);

            return(entityTypeCollection);
        }
Exemplo n.º 8
0
        public static EntityTypeCollection GetCollection(EntityEnum entityName)
        {
            EntityTypeCollection collection = EntityTypeDAL.GetCollection(entityName);

            return(collection);
        }