Esempio n. 1
0
        public virtual Apps.Models.SCV.Sys.MESSAGE_MODEL GetById(string id)
        {
            Apps.Models.MESSAGE entity = m_Rep.GetById(id);
            if (entity != null)
            {
                //MESSAGE entity = m_Rep.GetById(id);
                Apps.Models.SCV.Sys.MESSAGE_MODEL model = new Apps.Models.SCV.Sys.MESSAGE_MODEL();
                model.MESSAGE_ID      = entity.MESSAGE_ID;
                model.MESSAGE_TYPE    = entity.MESSAGE_TYPE;
                model.SUB_TYPE        = entity.SUB_TYPE;
                model.PRIORITY        = entity.PRIORITY;
                model.SRC_END_POINT   = entity.SRC_END_POINT;
                model.DST_END_POINT   = entity.DST_END_POINT;
                model.STATUS          = entity.STATUS;
                model.DATE_TIME_STAMP = entity.DATE_TIME_STAMP;
                model.PROCESS_STAMP   = entity.PROCESS_STAMP;
                model.ACTIVE          = entity.ACTIVE;
                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.MESSAGE_BODY    = entity.MESSAGE_BODY;

                return(model);
            }
            else
            {
                return(null);
            }
        }
Esempio n. 2
0
        public virtual void Create(ref ValidationErrors errors, Apps.Models.SCV.Sys.MESSAGE_MODEL model)
        {
            Apps.Models.MESSAGE entity = m_Rep.GetById(model.MESSAGE_ID);
            if (entity != null)
            {
                errors.Add(Resource.PrimaryRepeat);
                return;
            }
            entity                 = new Apps.Models.MESSAGE();
            entity.MESSAGE_ID      = model.MESSAGE_ID;
            entity.MESSAGE_TYPE    = model.MESSAGE_TYPE;
            entity.SUB_TYPE        = model.SUB_TYPE;
            entity.PRIORITY        = model.PRIORITY;
            entity.SRC_END_POINT   = model.SRC_END_POINT;
            entity.DST_END_POINT   = model.DST_END_POINT;
            entity.STATUS          = model.STATUS;
            entity.DATE_TIME_STAMP = model.DATE_TIME_STAMP;
            entity.PROCESS_STAMP   = model.PROCESS_STAMP;
            entity.ACTIVE          = model.ACTIVE;
            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.MESSAGE_BODY    = model.MESSAGE_BODY;

            m_Rep.Create(entity);
        }
Esempio n. 3
0
        public virtual void Modify(ref ValidationErrors errors, Apps.Models.SCV.Sys.MESSAGE_MODEL model, params string[] updateProperties)
        {
            Apps.Models.MESSAGE entity = m_Rep.GetById(model.MESSAGE_ID);
            if (entity == null)
            {
                errors.Add(Resource.Disable);
                return;
            }
            if (updateProperties.Count() <= 0)
            {
                entity.MESSAGE_ID      = model.MESSAGE_ID;
                entity.MESSAGE_TYPE    = model.MESSAGE_TYPE;
                entity.SUB_TYPE        = model.SUB_TYPE;
                entity.PRIORITY        = model.PRIORITY;
                entity.SRC_END_POINT   = model.SRC_END_POINT;
                entity.DST_END_POINT   = model.DST_END_POINT;
                entity.STATUS          = model.STATUS;
                entity.DATE_TIME_STAMP = model.DATE_TIME_STAMP;
                entity.PROCESS_STAMP   = model.PROCESS_STAMP;
                entity.ACTIVE          = model.ACTIVE;
                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.MESSAGE_BODY    = model.MESSAGE_BODY;
            }
            else
            {
                Type type  = typeof(Apps.Models.SCV.Sys.MESSAGE_MODEL);
                Type typeE = typeof(Apps.Models.MESSAGE);
                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);
        }