public virtual Apps.Models.SCV.Sys.VENDOR_MODEL GetById(string id) { Apps.Models.VENDOR entity = m_Rep.GetById(id); if (entity != null) { //VENDOR entity = m_Rep.GetById(id); Apps.Models.SCV.Sys.VENDOR_MODEL model = new Apps.Models.SCV.Sys.VENDOR_MODEL(); model.INTERNAL_VENDOR_NUM = entity.INTERNAL_VENDOR_NUM; model.VENDOR_ID = entity.VENDOR_ID; model.NAME = entity.NAME; model.ADDRESS1 = entity.ADDRESS1; model.ADDRESS2 = entity.ADDRESS2; model.CITY = entity.CITY; model.STATE = entity.STATE; model.COUNTRY = entity.COUNTRY; model.POSTAL_CODE = entity.POSTAL_CODE; model.PARENT = entity.PARENT; model.ATTENTION_TO = entity.ATTENTION_TO; model.PHONE_NUM = entity.PHONE_NUM; model.FAX_NUM = entity.FAX_NUM; model.EMAIL = entity.EMAIL; model.ACTIVE = entity.ACTIVE; model.CARRIER = entity.CARRIER; model.USER_STAMP = entity.USER_STAMP; model.DATE_TIME_STAMP = entity.DATE_TIME_STAMP; return(model); } else { return(null); } }
public virtual void Create(ref ValidationErrors errors, Apps.Models.SCV.Sys.VENDOR_MODEL model) { Apps.Models.VENDOR entity = m_Rep.GetById(model.INTERNAL_VENDOR_NUM); if (entity != null) { errors.Add(Resource.PrimaryRepeat); return; } entity = new Apps.Models.VENDOR(); entity.INTERNAL_VENDOR_NUM = model.INTERNAL_VENDOR_NUM; entity.VENDOR_ID = model.VENDOR_ID; entity.NAME = model.NAME; entity.ADDRESS1 = model.ADDRESS1; entity.ADDRESS2 = model.ADDRESS2; entity.CITY = model.CITY; entity.STATE = model.STATE; entity.COUNTRY = model.COUNTRY; entity.POSTAL_CODE = model.POSTAL_CODE; entity.PARENT = model.PARENT; entity.ATTENTION_TO = model.ATTENTION_TO; entity.PHONE_NUM = model.PHONE_NUM; entity.FAX_NUM = model.FAX_NUM; entity.EMAIL = model.EMAIL; entity.ACTIVE = model.ACTIVE; entity.CARRIER = model.CARRIER; entity.USER_STAMP = model.USER_STAMP; entity.DATE_TIME_STAMP = model.DATE_TIME_STAMP; m_Rep.Create(entity); }
public virtual void Modify(ref ValidationErrors errors, Apps.Models.SCV.Sys.VENDOR_MODEL model, params string[] updateProperties) { Apps.Models.VENDOR entity = m_Rep.GetById(model.INTERNAL_VENDOR_NUM); if (entity == null) { errors.Add(Resource.Disable); return; } if (updateProperties.Count() <= 0) { entity.INTERNAL_VENDOR_NUM = model.INTERNAL_VENDOR_NUM; entity.VENDOR_ID = model.VENDOR_ID; entity.NAME = model.NAME; entity.ADDRESS1 = model.ADDRESS1; entity.ADDRESS2 = model.ADDRESS2; entity.CITY = model.CITY; entity.STATE = model.STATE; entity.COUNTRY = model.COUNTRY; entity.POSTAL_CODE = model.POSTAL_CODE; entity.PARENT = model.PARENT; entity.ATTENTION_TO = model.ATTENTION_TO; entity.PHONE_NUM = model.PHONE_NUM; entity.FAX_NUM = model.FAX_NUM; entity.EMAIL = model.EMAIL; entity.ACTIVE = model.ACTIVE; entity.CARRIER = model.CARRIER; entity.USER_STAMP = model.USER_STAMP; entity.DATE_TIME_STAMP = model.DATE_TIME_STAMP; } else { Type type = typeof(Apps.Models.SCV.Sys.VENDOR_MODEL); Type typeE = typeof(Apps.Models.VENDOR); 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); }