Пример #1
0
        public virtual void Modify(ref ValidationErrors errors, Apps.Models.SCV.LOCATION.LOCATION_SELECTION_MODEL model, params string[] updateProperties)
        {
            Apps.Models.LOCATION_SELECTION 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.LOC_SEL_ID    = model.LOC_SEL_ID;
                entity.LOC_SEL_DESC  = model.LOC_SEL_DESC;
                entity.SQL_STATEMENT = model.SQL_STATEMENT;
                entity.LOC_SEL_TYPE  = model.LOC_SEL_TYPE;
            }
            else
            {
                Type type  = typeof(Apps.Models.SCV.LOCATION.LOCATION_SELECTION_MODEL);
                Type typeE = typeof(Apps.Models.LOCATION_SELECTION);
                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);
        }
Пример #2
0
        public virtual void Create(ref ValidationErrors errors, Apps.Models.SCV.LOCATION.LOCATION_SELECTION_MODEL model)
        {
            Apps.Models.LOCATION_SELECTION entity = m_Rep.GetById(model.OBJECT_ID);
            if (entity != null)
            {
                errors.Add(Resource.PrimaryRepeat);
                return;
            }
            entity               = new Apps.Models.LOCATION_SELECTION();
            entity.OBJECT_ID     = model.OBJECT_ID;
            entity.LOC_SEL_ID    = model.LOC_SEL_ID;
            entity.LOC_SEL_DESC  = model.LOC_SEL_DESC;
            entity.SQL_STATEMENT = model.SQL_STATEMENT;
            entity.LOC_SEL_TYPE  = model.LOC_SEL_TYPE;

            m_Rep.Create(entity);
        }
Пример #3
0
        public virtual Apps.Models.SCV.LOCATION.LOCATION_SELECTION_MODEL GetById(string id)
        {
            Apps.Models.LOCATION_SELECTION entity = m_Rep.GetById(id);
            if (entity != null)
            {
                //LOCATION_SELECTION entity = m_Rep.GetById(id);
                Apps.Models.SCV.LOCATION.LOCATION_SELECTION_MODEL model = new Apps.Models.SCV.LOCATION.LOCATION_SELECTION_MODEL();
                model.OBJECT_ID     = entity.OBJECT_ID;
                model.LOC_SEL_ID    = entity.LOC_SEL_ID;
                model.LOC_SEL_DESC  = entity.LOC_SEL_DESC;
                model.SQL_STATEMENT = entity.SQL_STATEMENT;
                model.LOC_SEL_TYPE  = entity.LOC_SEL_TYPE;

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