public virtual Apps.Models.SCV.LOCATION.LOCATION_CARRIER_MODEL GetById(string id) { Apps.Models.LOCATION_CARRIER entity = m_Rep.GetById(id); if (entity != null) { //LOCATION_CARRIER entity = m_Rep.GetById(id); Apps.Models.SCV.LOCATION.LOCATION_CARRIER_MODEL model = new Apps.Models.SCV.LOCATION.LOCATION_CARRIER_MODEL(); model.ID = entity.ID; model.PROVINCES = entity.PROVINCES; model.CARRIER = entity.CARRIER; model.IDENTIFIER = entity.IDENTIFIER; 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; return(model); } else { return(null); } }
public virtual void Create(ref ValidationErrors errors, Apps.Models.SCV.LOCATION.LOCATION_CARRIER_MODEL model) { Apps.Models.LOCATION_CARRIER entity = m_Rep.GetById(model.ID); if (entity != null) { errors.Add(Resource.PrimaryRepeat); return; } entity = new Apps.Models.LOCATION_CARRIER(); entity.ID = model.ID; entity.PROVINCES = model.PROVINCES; entity.CARRIER = model.CARRIER; entity.IDENTIFIER = model.IDENTIFIER; 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; m_Rep.Create(entity); }
public virtual void Modify(ref ValidationErrors errors, Apps.Models.SCV.LOCATION.LOCATION_CARRIER_MODEL model, params string[] updateProperties) { Apps.Models.LOCATION_CARRIER entity = m_Rep.GetById(model.ID); if (entity == null) { errors.Add(Resource.Disable); return; } if (updateProperties.Count() <= 0) { entity.ID = model.ID; entity.PROVINCES = model.PROVINCES; entity.CARRIER = model.CARRIER; entity.IDENTIFIER = model.IDENTIFIER; 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; } else { Type type = typeof(Apps.Models.SCV.LOCATION.LOCATION_CARRIER_MODEL); Type typeE = typeof(Apps.Models.LOCATION_CARRIER); 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); }