Exemplo n.º 1
0
        public virtual Apps.Models.SCV.USER.USER_ADDRESS_CARRIER_AUTH_MODEL GetById(string id)
        {
            Apps.Models.USER_ADDRESS_CARRIER_AUTH entity = m_Rep.GetById(id);
            if (entity != null)
            {
                //USER_ADDRESS_CARRIER_AUTH entity = m_Rep.GetById(id);
                Apps.Models.SCV.USER.USER_ADDRESS_CARRIER_AUTH_MODEL model = new Apps.Models.SCV.USER.USER_ADDRESS_CARRIER_AUTH_MODEL();
                model.USER_ID    = entity.USER_ID;
                model.PROVINCE   = entity.PROVINCE;
                model.CITY       = entity.CITY;
                model.DISCRICT   = entity.DISCRICT;
                model.CARRIER    = entity.CARRIER;
                model.IsProvided = entity.IsProvided;
                model.IsDelivery = entity.IsDelivery;
                model.NDelivery  = entity.NDelivery;
                model.YDelivery  = entity.YDelivery;
                model.Crossing   = entity.Crossing;

                return(model);
            }
            else
            {
                return(null);
            }
        }
Exemplo n.º 2
0
        public virtual void Create(ref ValidationErrors errors, Apps.Models.SCV.USER.USER_ADDRESS_CARRIER_AUTH_MODEL model)
        {
            Apps.Models.USER_ADDRESS_CARRIER_AUTH entity = m_Rep.GetById(model.USER_ID);
            if (entity != null)
            {
                errors.Add(Resource.PrimaryRepeat);
                return;
            }
            entity            = new Apps.Models.USER_ADDRESS_CARRIER_AUTH();
            entity.USER_ID    = model.USER_ID;
            entity.PROVINCE   = model.PROVINCE;
            entity.CITY       = model.CITY;
            entity.DISCRICT   = model.DISCRICT;
            entity.CARRIER    = model.CARRIER;
            entity.IsProvided = model.IsProvided;
            entity.IsDelivery = model.IsDelivery;
            entity.NDelivery  = model.NDelivery;
            entity.YDelivery  = model.YDelivery;
            entity.Crossing   = model.Crossing;

            m_Rep.Create(entity);
        }
Exemplo n.º 3
0
        public virtual void Modify(ref ValidationErrors errors, Apps.Models.SCV.USER.USER_ADDRESS_CARRIER_AUTH_MODEL model, params string[] updateProperties)
        {
            Apps.Models.USER_ADDRESS_CARRIER_AUTH entity = m_Rep.GetById(model.USER_ID);
            if (entity == null)
            {
                errors.Add(Resource.Disable);
                return;
            }
            if (updateProperties.Count() <= 0)
            {
                entity.USER_ID    = model.USER_ID;
                entity.PROVINCE   = model.PROVINCE;
                entity.CITY       = model.CITY;
                entity.DISCRICT   = model.DISCRICT;
                entity.CARRIER    = model.CARRIER;
                entity.IsProvided = model.IsProvided;
                entity.IsDelivery = model.IsDelivery;
                entity.NDelivery  = model.NDelivery;
                entity.YDelivery  = model.YDelivery;
                entity.Crossing   = model.Crossing;
            }
            else
            {
                Type type  = typeof(Apps.Models.SCV.USER.USER_ADDRESS_CARRIER_AUTH_MODEL);
                Type typeE = typeof(Apps.Models.USER_ADDRESS_CARRIER_AUTH);
                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);
        }