public virtual void Modify(ref ValidationErrors errors, Apps.Models.SCV.Sys.COMPANY_MODEL model, params string[] updateProperties)
        {
            Apps.Models.COMPANY entity = m_Rep.GetById(model.COMPANY1);
            if (entity == null)
            {
                errors.Add(Resource.Disable);
                return;
            }
            if (updateProperties.Count() <= 0)
            {
                entity.COMPANY1           = model.COMPANY1;
                entity.NAME               = model.NAME;
                entity.ACTIVE             = model.ACTIVE;
                entity.USER_STAMP         = model.USER_STAMP;
                entity.DATE_TIME_STAMP    = model.DATE_TIME_STAMP;
                entity.INTERNAL_NUM       = model.INTERNAL_NUM;
                entity.ATTENTION_TO       = model.ATTENTION_TO;
                entity.ADDRESS1           = model.ADDRESS1;
                entity.ADDRESS2           = model.ADDRESS2;
                entity.DISTRICT           = model.DISTRICT;
                entity.CITY               = model.CITY;
                entity.STATE              = model.STATE;
                entity.COUNTRY            = model.COUNTRY;
                entity.POSTAL_CODE        = model.POSTAL_CODE;
                entity.PHONE_NUM          = model.PHONE_NUM;
                entity.FAX_NUM            = model.FAX_NUM;
                entity.MOBILE             = model.MOBILE;
                entity.EMAIL_ADDRESS      = model.EMAIL_ADDRESS;
                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.SHIPMENT_ID_PREFIX = model.SHIPMENT_ID_PREFIX;
                entity.RECEIPT_ID_PREFIX  = model.RECEIPT_ID_PREFIX;
                entity.NAME_EN            = model.NAME_EN;
            }
            else
            {
                Type type  = typeof(Apps.Models.SCV.Sys.COMPANY_MODEL);
                Type typeE = typeof(Apps.Models.COMPANY);
                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);
        }
        public virtual Apps.Models.SCV.Sys.COMPANY_MODEL GetById(string id)
        {
            Apps.Models.COMPANY entity = m_Rep.GetById(id);
            if (entity != null)
            {
                //COMPANY entity = m_Rep.GetById(id);
                Apps.Models.SCV.Sys.COMPANY_MODEL model = new Apps.Models.SCV.Sys.COMPANY_MODEL();
                model.COMPANY1           = entity.COMPANY1;
                model.NAME               = entity.NAME;
                model.ACTIVE             = entity.ACTIVE;
                model.USER_STAMP         = entity.USER_STAMP;
                model.DATE_TIME_STAMP    = entity.DATE_TIME_STAMP;
                model.INTERNAL_NUM       = entity.INTERNAL_NUM;
                model.ATTENTION_TO       = entity.ATTENTION_TO;
                model.ADDRESS1           = entity.ADDRESS1;
                model.ADDRESS2           = entity.ADDRESS2;
                model.DISTRICT           = entity.DISTRICT;
                model.CITY               = entity.CITY;
                model.STATE              = entity.STATE;
                model.COUNTRY            = entity.COUNTRY;
                model.POSTAL_CODE        = entity.POSTAL_CODE;
                model.PHONE_NUM          = entity.PHONE_NUM;
                model.FAX_NUM            = entity.FAX_NUM;
                model.MOBILE             = entity.MOBILE;
                model.EMAIL_ADDRESS      = entity.EMAIL_ADDRESS;
                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.SHIPMENT_ID_PREFIX = entity.SHIPMENT_ID_PREFIX;
                model.RECEIPT_ID_PREFIX  = entity.RECEIPT_ID_PREFIX;
                model.NAME_EN            = entity.NAME_EN;

                return(model);
            }
            else
            {
                return(null);
            }
        }
        public virtual void Create(ref ValidationErrors errors, Apps.Models.SCV.Sys.COMPANY_MODEL model)
        {
            Apps.Models.COMPANY entity = m_Rep.GetById(model.COMPANY1);
            if (entity != null)
            {
                errors.Add(Resource.PrimaryRepeat);
                return;
            }
            entity                    = new Apps.Models.COMPANY();
            entity.COMPANY1           = model.COMPANY1;
            entity.NAME               = model.NAME;
            entity.ACTIVE             = model.ACTIVE;
            entity.USER_STAMP         = model.USER_STAMP;
            entity.DATE_TIME_STAMP    = model.DATE_TIME_STAMP;
            entity.INTERNAL_NUM       = model.INTERNAL_NUM;
            entity.ATTENTION_TO       = model.ATTENTION_TO;
            entity.ADDRESS1           = model.ADDRESS1;
            entity.ADDRESS2           = model.ADDRESS2;
            entity.DISTRICT           = model.DISTRICT;
            entity.CITY               = model.CITY;
            entity.STATE              = model.STATE;
            entity.COUNTRY            = model.COUNTRY;
            entity.POSTAL_CODE        = model.POSTAL_CODE;
            entity.PHONE_NUM          = model.PHONE_NUM;
            entity.FAX_NUM            = model.FAX_NUM;
            entity.MOBILE             = model.MOBILE;
            entity.EMAIL_ADDRESS      = model.EMAIL_ADDRESS;
            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.SHIPMENT_ID_PREFIX = model.SHIPMENT_ID_PREFIX;
            entity.RECEIPT_ID_PREFIX  = model.RECEIPT_ID_PREFIX;
            entity.NAME_EN            = model.NAME_EN;

            m_Rep.Create(entity);
        }