Esempio n. 1
0
        public virtual Apps.Models.SCV.Sys.VIEWER_MODEL GetById(string id)
        {
            Apps.Models.VIEWER entity = m_Rep.GetById(id);
            if (entity != null)
            {
                //VIEWER entity = m_Rep.GetById(id);
                Apps.Models.SCV.Sys.VIEWER_MODEL model = new Apps.Models.SCV.Sys.VIEWER_MODEL();
                model.OBJECT_ID       = entity.OBJECT_ID;
                model.FORM_ID         = entity.FORM_ID;
                model.DESCRIPTION     = entity.DESCRIPTION;
                model.GROUP           = entity.GROUP;
                model.URL             = entity.URL;
                model.USER_DEF1       = entity.USER_DEF1;
                model.USER_DEF2       = entity.USER_DEF2;
                model.USER_DEF3       = entity.USER_DEF3;
                model.USER_DEF4       = entity.USER_DEF4;
                model.USER_DEF5       = entity.USER_DEF5;
                model.USER_DEF6       = entity.USER_DEF6;
                model.USER_DEF7       = entity.USER_DEF7;
                model.USER_DEF8       = entity.USER_DEF8;
                model.SYSTEM_CREATED  = entity.SYSTEM_CREATED;
                model.USER_STAMP      = entity.USER_STAMP;
                model.DATE_TIME_STAMP = entity.DATE_TIME_STAMP;
                model.ACTIVE          = entity.ACTIVE;

                return(model);
            }
            else
            {
                return(null);
            }
        }
Esempio n. 2
0
        public virtual void Create(ref ValidationErrors errors, Apps.Models.SCV.Sys.VIEWER_MODEL model)
        {
            Apps.Models.VIEWER entity = m_Rep.GetById(model.OBJECT_ID);
            if (entity != null)
            {
                errors.Add(Resource.PrimaryRepeat);
                return;
            }
            entity                 = new Apps.Models.VIEWER();
            entity.OBJECT_ID       = model.OBJECT_ID;
            entity.FORM_ID         = model.FORM_ID;
            entity.DESCRIPTION     = model.DESCRIPTION;
            entity.GROUP           = model.GROUP;
            entity.URL             = model.URL;
            entity.USER_DEF1       = model.USER_DEF1;
            entity.USER_DEF2       = model.USER_DEF2;
            entity.USER_DEF3       = model.USER_DEF3;
            entity.USER_DEF4       = model.USER_DEF4;
            entity.USER_DEF5       = model.USER_DEF5;
            entity.USER_DEF6       = model.USER_DEF6;
            entity.USER_DEF7       = model.USER_DEF7;
            entity.USER_DEF8       = model.USER_DEF8;
            entity.SYSTEM_CREATED  = model.SYSTEM_CREATED;
            entity.USER_STAMP      = model.USER_STAMP;
            entity.DATE_TIME_STAMP = model.DATE_TIME_STAMP;
            entity.ACTIVE          = model.ACTIVE;

            m_Rep.Create(entity);
        }
Esempio n. 3
0
        public virtual void Modify(ref ValidationErrors errors, Apps.Models.SCV.Sys.VIEWER_MODEL model, params string[] updateProperties)
        {
            Apps.Models.VIEWER entity = m_Rep.GetById(model.OBJECT_ID);
            if (entity == null)
            {
                errors.Add(Resource.Disable);
                return;
            }
            if (updateProperties.Count() <= 0)
            {
                entity.OBJECT_ID       = model.OBJECT_ID;
                entity.FORM_ID         = model.FORM_ID;
                entity.DESCRIPTION     = model.DESCRIPTION;
                entity.GROUP           = model.GROUP;
                entity.URL             = model.URL;
                entity.USER_DEF1       = model.USER_DEF1;
                entity.USER_DEF2       = model.USER_DEF2;
                entity.USER_DEF3       = model.USER_DEF3;
                entity.USER_DEF4       = model.USER_DEF4;
                entity.USER_DEF5       = model.USER_DEF5;
                entity.USER_DEF6       = model.USER_DEF6;
                entity.USER_DEF7       = model.USER_DEF7;
                entity.USER_DEF8       = model.USER_DEF8;
                entity.SYSTEM_CREATED  = model.SYSTEM_CREATED;
                entity.USER_STAMP      = model.USER_STAMP;
                entity.DATE_TIME_STAMP = model.DATE_TIME_STAMP;
                entity.ACTIVE          = model.ACTIVE;
            }
            else
            {
                Type type  = typeof(Apps.Models.SCV.Sys.VIEWER_MODEL);
                Type typeE = typeof(Apps.Models.VIEWER);
                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);
        }