public virtual Apps.Models.SCV.DYNAMIC.DYNAMIC_CALLING_HEADER_MODEL GetById(string id)
        {
            Apps.Models.DYNAMIC_CALLING_HEADER entity = m_Rep.GetById(id);
            if (entity != null)
            {
                //DYNAMIC_CALLING_HEADER entity = m_Rep.GetById(id);
                Apps.Models.SCV.DYNAMIC.DYNAMIC_CALLING_HEADER_MODEL model = new Apps.Models.SCV.DYNAMIC.DYNAMIC_CALLING_HEADER_MODEL();
                model.INTERNAL_NUM    = entity.INTERNAL_NUM;
                model.RECORD_TYPE     = entity.RECORD_TYPE;
                model.DESCRIPTION     = entity.DESCRIPTION;
                model.SYSTEM_CREATED  = entity.SYSTEM_CREATED;
                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_STAMP      = entity.USER_STAMP;
                model.PROCESS_STAMP   = entity.PROCESS_STAMP;
                model.DATE_TIME_STAMP = entity.DATE_TIME_STAMP;

                return(model);
            }
            else
            {
                return(null);
            }
        }
        public virtual void Create(ref ValidationErrors errors, Apps.Models.SCV.DYNAMIC.DYNAMIC_CALLING_HEADER_MODEL model)
        {
            Apps.Models.DYNAMIC_CALLING_HEADER entity = m_Rep.GetById(model.INTERNAL_NUM);
            if (entity != null)
            {
                errors.Add(Resource.PrimaryRepeat);
                return;
            }
            entity = new Apps.Models.DYNAMIC_CALLING_HEADER();
            entity.INTERNAL_NUM    = model.INTERNAL_NUM;
            entity.RECORD_TYPE     = model.RECORD_TYPE;
            entity.DESCRIPTION     = model.DESCRIPTION;
            entity.SYSTEM_CREATED  = model.SYSTEM_CREATED;
            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_STAMP      = model.USER_STAMP;
            entity.PROCESS_STAMP   = model.PROCESS_STAMP;
            entity.DATE_TIME_STAMP = model.DATE_TIME_STAMP;

            m_Rep.Create(entity);
        }
        public virtual void Modify(ref ValidationErrors errors, Apps.Models.SCV.DYNAMIC.DYNAMIC_CALLING_HEADER_MODEL model, params string[] updateProperties)
        {
            Apps.Models.DYNAMIC_CALLING_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.RECORD_TYPE     = model.RECORD_TYPE;
                entity.DESCRIPTION     = model.DESCRIPTION;
                entity.SYSTEM_CREATED  = model.SYSTEM_CREATED;
                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_STAMP      = model.USER_STAMP;
                entity.PROCESS_STAMP   = model.PROCESS_STAMP;
                entity.DATE_TIME_STAMP = model.DATE_TIME_STAMP;
            }
            else
            {
                Type type  = typeof(Apps.Models.SCV.DYNAMIC.DYNAMIC_CALLING_HEADER_MODEL);
                Type typeE = typeof(Apps.Models.DYNAMIC_CALLING_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);
        }