Esempio n. 1
0
        public virtual Apps.Models.SCV.RULE.RULE_ASSIGNMENT_HEADER_MODEL GetById(string id)
        {
            Apps.Models.RULE_ASSIGNMENT_HEADER entity = m_Rep.GetById(id);
            if (entity != null)
            {
                //RULE_ASSIGNMENT_HEADER entity = m_Rep.GetById(id);
                Apps.Models.SCV.RULE.RULE_ASSIGNMENT_HEADER_MODEL model = new Apps.Models.SCV.RULE.RULE_ASSIGNMENT_HEADER_MODEL();
                model.INTERNAL_NUM     = entity.INTERNAL_NUM;
                model.RULE_ASSIGN_NAME = entity.RULE_ASSIGN_NAME;
                model.RULE_ASSIGN_TYPE = entity.RULE_ASSIGN_TYPE;
                model.WAREHOUSE        = entity.WAREHOUSE;
                model.USER_STAMP       = entity.USER_STAMP;
                model.DATE_TIME_STAMP  = entity.DATE_TIME_STAMP;
                model.ALWASY_OVERRIDE  = entity.ALWASY_OVERRIDE;
                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.USER_DEF5        = entity.USER_DEF5;
                model.USER_DEF6        = entity.USER_DEF6;
                model.USER_DEF7        = entity.USER_DEF7;
                model.USER_DEF8        = entity.USER_DEF8;

                return(model);
            }
            else
            {
                return(null);
            }
        }
Esempio n. 2
0
        public virtual void Create(ref ValidationErrors errors, Apps.Models.SCV.RULE.RULE_ASSIGNMENT_HEADER_MODEL model)
        {
            Apps.Models.RULE_ASSIGNMENT_HEADER entity = m_Rep.GetById(model.INTERNAL_NUM);
            if (entity != null)
            {
                errors.Add(Resource.PrimaryRepeat);
                return;
            }
            entity = new Apps.Models.RULE_ASSIGNMENT_HEADER();
            entity.INTERNAL_NUM     = model.INTERNAL_NUM;
            entity.RULE_ASSIGN_NAME = model.RULE_ASSIGN_NAME;
            entity.RULE_ASSIGN_TYPE = model.RULE_ASSIGN_TYPE;
            entity.WAREHOUSE        = model.WAREHOUSE;
            entity.USER_STAMP       = model.USER_STAMP;
            entity.DATE_TIME_STAMP  = model.DATE_TIME_STAMP;
            entity.ALWASY_OVERRIDE  = model.ALWASY_OVERRIDE;
            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.USER_DEF5        = model.USER_DEF5;
            entity.USER_DEF6        = model.USER_DEF6;
            entity.USER_DEF7        = model.USER_DEF7;
            entity.USER_DEF8        = model.USER_DEF8;

            m_Rep.Create(entity);
        }
Esempio n. 3
0
        public virtual void Modify(ref ValidationErrors errors, Apps.Models.SCV.RULE.RULE_ASSIGNMENT_HEADER_MODEL model, params string[] updateProperties)
        {
            Apps.Models.RULE_ASSIGNMENT_HEADER entity = m_Rep.GetById(model.INTERNAL_NUM);
            if (entity == null)
            {
                errors.Add(Resource.Disable);
                return;
            }
            if (updateProperties.Count() <= 0)
            {
                entity.INTERNAL_NUM     = model.INTERNAL_NUM;
                entity.RULE_ASSIGN_NAME = model.RULE_ASSIGN_NAME;
                entity.RULE_ASSIGN_TYPE = model.RULE_ASSIGN_TYPE;
                entity.WAREHOUSE        = model.WAREHOUSE;
                entity.USER_STAMP       = model.USER_STAMP;
                entity.DATE_TIME_STAMP  = model.DATE_TIME_STAMP;
                entity.ALWASY_OVERRIDE  = model.ALWASY_OVERRIDE;
                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.USER_DEF5        = model.USER_DEF5;
                entity.USER_DEF6        = model.USER_DEF6;
                entity.USER_DEF7        = model.USER_DEF7;
                entity.USER_DEF8        = model.USER_DEF8;
            }
            else
            {
                Type type  = typeof(Apps.Models.SCV.RULE.RULE_ASSIGNMENT_HEADER_MODEL);
                Type typeE = typeof(Apps.Models.RULE_ASSIGNMENT_HEADER);
                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);
        }