Exemplo n.º 1
0
        public virtual void Modify(ref ValidationErrors errors, Apps.Models.SCV.Sys.ZONE_MODEL model, params string[] updateProperties)
        {
            Apps.Models.ZONE entity = m_Rep.GetById(model.ZONE1);
            if (entity == null)
            {
                errors.Add(Resource.Disable);
                return;
            }
            if (updateProperties.Count() <= 0)
            {
                entity.ZONE1           = model.ZONE1;
                entity.DESCRIPTION     = model.DESCRIPTION;
                entity.ACTIVE          = model.ACTIVE;
                entity.USER_STAMP      = model.USER_STAMP;
                entity.DATE_TIME_STAMP = model.DATE_TIME_STAMP;
            }
            else
            {
                Type type  = typeof(Apps.Models.SCV.Sys.ZONE_MODEL);
                Type typeE = typeof(Apps.Models.ZONE);
                foreach (var item in updateProperties)
                {
                    System.Reflection.PropertyInfo pi  = type.GetProperty(item);
                    System.Reflection.PropertyInfo piE = typeE.GetProperty(item);
                    piE.SetValue(entity, pi.GetValue(model), null);
                }
            }


            m_Rep.Modify(entity, updateProperties);
        }
Exemplo n.º 2
0
        public virtual void Create(ref ValidationErrors errors, Apps.Models.SCV.Sys.ZONE_MODEL model)
        {
            Apps.Models.ZONE entity = m_Rep.GetById(model.ZONE1);
            if (entity != null)
            {
                errors.Add(Resource.PrimaryRepeat);
                return;
            }
            entity                 = new Apps.Models.ZONE();
            entity.ZONE1           = model.ZONE1;
            entity.DESCRIPTION     = model.DESCRIPTION;
            entity.ACTIVE          = model.ACTIVE;
            entity.USER_STAMP      = model.USER_STAMP;
            entity.DATE_TIME_STAMP = model.DATE_TIME_STAMP;

            m_Rep.Create(entity);
        }
Exemplo n.º 3
0
        public virtual Apps.Models.SCV.Sys.ZONE_MODEL GetById(string id)
        {
            Apps.Models.ZONE entity = m_Rep.GetById(id);
            if (entity != null)
            {
                //ZONE entity = m_Rep.GetById(id);
                Apps.Models.SCV.Sys.ZONE_MODEL model = new Apps.Models.SCV.Sys.ZONE_MODEL();
                model.ZONE1           = entity.ZONE1;
                model.DESCRIPTION     = entity.DESCRIPTION;
                model.ACTIVE          = entity.ACTIVE;
                model.USER_STAMP      = entity.USER_STAMP;
                model.DATE_TIME_STAMP = entity.DATE_TIME_STAMP;

                return(model);
            }
            else
            {
                return(null);
            }
        }