protected void btAttributeTypeOK_Click(object sender, EventArgs e)
    {
        var attributeTypeID = DataConverter.ToNullableGuid(hdAttributeTypeID.Value);

        if (attributeTypeID.IsNullOrEmpty())
        {
            var item = new UM_AttributeType
            {
                ID          = Guid.NewGuid(),
                DateCreated = DateTime.Now,
                Name        = tbAttributeType.Text,
                ProjectID   = null
            };

            DataContext.UM_AttributeTypes.InsertOnSubmit(item);
        }
        else
        {
            var item = (from n in DataContext.UM_AttributeTypes
                        where n.ID == attributeTypeID
                        select n).First();

            item.Name = tbAttributeType.Text;
        }

        DataContext.SubmitChanges();

        FillAttributesTree();
    }
Ejemplo n.º 2
0
        public static UM_AttributeType ToEntity(this AttributeTypeContract contract)
        {
            if (contract == null)
            {
                return(null);
            }

            var entity = new UM_AttributeType();

            entity.DateChanged = contract.DateChanged;
            entity.DateCreated = contract.DateCreated;
            entity.DateDeleted = contract.DateDeleted;
            entity.ID          = contract.ID;
            entity.Name        = contract.Name;
            entity.ProjectID   = contract.ProjectID;

            return(entity);
        }
Ejemplo n.º 3
0
        public static AttributeTypeContract ToContract(this UM_AttributeType entity)
        {
            if (entity == null)
            {
                return(null);
            }

            var contract = new AttributeTypeContract();

            contract.DateChanged = entity.DateChanged;
            contract.DateCreated = entity.DateCreated;
            contract.DateDeleted = entity.DateDeleted;
            contract.ID          = entity.ID;
            contract.Name        = entity.Name;
            contract.ProjectID   = entity.ProjectID;

            return(contract);
        }