public virtual Apps.Models.SCV.SHIPMENT.SHIPMENT_INVOICE_MODEL GetById(string id)
        {
            Apps.Models.SHIPMENT_INVOICE entity = m_Rep.GetById(id);
            if (entity != null)
            {
                //SHIPMENT_INVOICE entity = m_Rep.GetById(id);
                Apps.Models.SCV.SHIPMENT.SHIPMENT_INVOICE_MODEL model = new Apps.Models.SCV.SHIPMENT.SHIPMENT_INVOICE_MODEL();
                model.INTERNAL_INVOICE_ID = entity.INTERNAL_INVOICE_ID;
                model.INVOICE_TYPE        = entity.INVOICE_TYPE;
                model.INVOICE_HEADER      = entity.INVOICE_HEADER;
                model.INVOICE_CONTENT     = entity.INVOICE_CONTENT;
                model.AMOUNT = entity.AMOUNT;
                model.INTERNAL_SHIPMENT_ID = entity.INTERNAL_SHIPMENT_ID;
                model.USER_STAMP           = entity.USER_STAMP;
                model.DATE_TIME_STAMP      = entity.DATE_TIME_STAMP;
                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);
            }
        }
        public virtual void Create(ref ValidationErrors errors, Apps.Models.SCV.SHIPMENT.SHIPMENT_INVOICE_MODEL model)
        {
            Apps.Models.SHIPMENT_INVOICE entity = m_Rep.GetById(model.INTERNAL_INVOICE_ID);
            if (entity != null)
            {
                errors.Add(Resource.PrimaryRepeat);
                return;
            }
            entity = new Apps.Models.SHIPMENT_INVOICE();
            entity.INTERNAL_INVOICE_ID = model.INTERNAL_INVOICE_ID;
            entity.INVOICE_TYPE        = model.INVOICE_TYPE;
            entity.INVOICE_HEADER      = model.INVOICE_HEADER;
            entity.INVOICE_CONTENT     = model.INVOICE_CONTENT;
            entity.AMOUNT = model.AMOUNT;
            entity.INTERNAL_SHIPMENT_ID = model.INTERNAL_SHIPMENT_ID;
            entity.USER_STAMP           = model.USER_STAMP;
            entity.DATE_TIME_STAMP      = model.DATE_TIME_STAMP;
            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);
        }
        public virtual void Modify(ref ValidationErrors errors, Apps.Models.SCV.SHIPMENT.SHIPMENT_INVOICE_MODEL model, params string[] updateProperties)
        {
            Apps.Models.SHIPMENT_INVOICE entity = m_Rep.GetById(model.INTERNAL_INVOICE_ID);
            if (entity == null)
            {
                errors.Add(Resource.Disable);
                return;
            }
            if (updateProperties.Count() <= 0)
            {
                entity.INTERNAL_INVOICE_ID = model.INTERNAL_INVOICE_ID;
                entity.INVOICE_TYPE        = model.INVOICE_TYPE;
                entity.INVOICE_HEADER      = model.INVOICE_HEADER;
                entity.INVOICE_CONTENT     = model.INVOICE_CONTENT;
                entity.AMOUNT = model.AMOUNT;
                entity.INTERNAL_SHIPMENT_ID = model.INTERNAL_SHIPMENT_ID;
                entity.USER_STAMP           = model.USER_STAMP;
                entity.DATE_TIME_STAMP      = model.DATE_TIME_STAMP;
                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.SHIPMENT.SHIPMENT_INVOICE_MODEL);
                Type typeE = typeof(Apps.Models.SHIPMENT_INVOICE);
                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);
        }