Beispiel #1
0
        public virtual void Create(ref ValidationErrors errors, Apps.Models.SCV.Sys.COMPANYSTATE_MODEL model)
        {
            Apps.Models.COMPANYSTATE entity = m_Rep.GetById(model.COMPANY);
            if (entity != null)
            {
                errors.Add(Resource.PrimaryRepeat);
                return;
            }
            entity            = new Apps.Models.COMPANYSTATE();
            entity.COMPANY    = model.COMPANY;
            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;
            entity.USER_DEF9  = model.USER_DEF9;
            entity.USER_DEF10 = model.USER_DEF10;
            entity.USER_DEF11 = model.USER_DEF11;
            entity.USER_DEF12 = model.USER_DEF12;
            entity.USER_DEF13 = model.USER_DEF13;
            entity.USER_DEF14 = model.USER_DEF14;
            entity.USER_DEF15 = model.USER_DEF15;
            entity.USER_DEF16 = model.USER_DEF16;
            entity.USER_DEF17 = model.USER_DEF17;
            entity.USER_DEF18 = model.USER_DEF18;
            entity.USER_DEF19 = model.USER_DEF19;
            entity.USER_DEF20 = model.USER_DEF20;

            m_Rep.Create(entity);
        }
Beispiel #2
0
        public virtual void Modify(ref ValidationErrors errors, Apps.Models.SCV.Sys.COMPANYSTATE_MODEL model, params string[] updateProperties)
        {
            Apps.Models.COMPANYSTATE entity = m_Rep.GetById(model.COMPANY);
            if (entity == null)
            {
                errors.Add(Resource.Disable);
                return;
            }
            if (updateProperties.Count() <= 0)
            {
                entity.COMPANY    = model.COMPANY;
                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;
                entity.USER_DEF9  = model.USER_DEF9;
                entity.USER_DEF10 = model.USER_DEF10;
                entity.USER_DEF11 = model.USER_DEF11;
                entity.USER_DEF12 = model.USER_DEF12;
                entity.USER_DEF13 = model.USER_DEF13;
                entity.USER_DEF14 = model.USER_DEF14;
                entity.USER_DEF15 = model.USER_DEF15;
                entity.USER_DEF16 = model.USER_DEF16;
                entity.USER_DEF17 = model.USER_DEF17;
                entity.USER_DEF18 = model.USER_DEF18;
                entity.USER_DEF19 = model.USER_DEF19;
                entity.USER_DEF20 = model.USER_DEF20;
            }
            else
            {
                Type type  = typeof(Apps.Models.SCV.Sys.COMPANYSTATE_MODEL);
                Type typeE = typeof(Apps.Models.COMPANYSTATE);
                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);
        }
Beispiel #3
0
        public virtual Apps.Models.SCV.Sys.COMPANYSTATE_MODEL GetById(string id)
        {
            Apps.Models.COMPANYSTATE entity = m_Rep.GetById(id);
            if (entity != null)
            {
                //COMPANYSTATE entity = m_Rep.GetById(id);
                Apps.Models.SCV.Sys.COMPANYSTATE_MODEL model = new Apps.Models.SCV.Sys.COMPANYSTATE_MODEL();
                model.COMPANY    = entity.COMPANY;
                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;
                model.USER_DEF9  = entity.USER_DEF9;
                model.USER_DEF10 = entity.USER_DEF10;
                model.USER_DEF11 = entity.USER_DEF11;
                model.USER_DEF12 = entity.USER_DEF12;
                model.USER_DEF13 = entity.USER_DEF13;
                model.USER_DEF14 = entity.USER_DEF14;
                model.USER_DEF15 = entity.USER_DEF15;
                model.USER_DEF16 = entity.USER_DEF16;
                model.USER_DEF17 = entity.USER_DEF17;
                model.USER_DEF18 = entity.USER_DEF18;
                model.USER_DEF19 = entity.USER_DEF19;
                model.USER_DEF20 = entity.USER_DEF20;

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