public virtual void Modify(ref ValidationErrors errors, Apps.Models.SCV.Sys.APPOINTMENT_MODEL model, params string[] updateProperties) { Apps.Models.APPOINTMENT entity = m_Rep.GetById(model.INTERNAL_APPOINT_NUM); if (entity == null) { errors.Add(Resource.Disable); return; } if (updateProperties.Count() <= 0) { entity.INTERNAL_APPOINT_NUM = model.INTERNAL_APPOINT_NUM; entity.INTERNAL_RECEIPT_NUM = model.INTERNAL_RECEIPT_NUM; entity.DOCK = model.DOCK; entity.START_DATE_TIME = model.START_DATE_TIME; entity.END_DATE_TIME = model.END_DATE_TIME; entity.STATUS = model.STATUS; entity.USER_STAMP = model.USER_STAMP; entity.DATE_TIME_STAMP = model.DATE_TIME_STAMP; } else { Type type = typeof(Apps.Models.SCV.Sys.APPOINTMENT_MODEL); Type typeE = typeof(Apps.Models.APPOINTMENT); 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 void Create(ref ValidationErrors errors, Apps.Models.SCV.Sys.APPOINTMENT_MODEL model) { Apps.Models.APPOINTMENT entity = m_Rep.GetById(model.INTERNAL_APPOINT_NUM); if (entity != null) { errors.Add(Resource.PrimaryRepeat); return; } entity = new Apps.Models.APPOINTMENT(); entity.INTERNAL_APPOINT_NUM = model.INTERNAL_APPOINT_NUM; entity.INTERNAL_RECEIPT_NUM = model.INTERNAL_RECEIPT_NUM; entity.DOCK = model.DOCK; entity.START_DATE_TIME = model.START_DATE_TIME; entity.END_DATE_TIME = model.END_DATE_TIME; entity.STATUS = model.STATUS; entity.USER_STAMP = model.USER_STAMP; entity.DATE_TIME_STAMP = model.DATE_TIME_STAMP; m_Rep.Create(entity); }
public virtual Apps.Models.SCV.Sys.APPOINTMENT_MODEL GetById(string id) { Apps.Models.APPOINTMENT entity = m_Rep.GetById(id); if (entity != null) { //APPOINTMENT entity = m_Rep.GetById(id); Apps.Models.SCV.Sys.APPOINTMENT_MODEL model = new Apps.Models.SCV.Sys.APPOINTMENT_MODEL(); model.INTERNAL_APPOINT_NUM = entity.INTERNAL_APPOINT_NUM; model.INTERNAL_RECEIPT_NUM = entity.INTERNAL_RECEIPT_NUM; model.DOCK = entity.DOCK; model.START_DATE_TIME = entity.START_DATE_TIME; model.END_DATE_TIME = entity.END_DATE_TIME; model.STATUS = entity.STATUS; model.USER_STAMP = entity.USER_STAMP; model.DATE_TIME_STAMP = entity.DATE_TIME_STAMP; return(model); } else { return(null); } }