public virtual Apps.Models.SCV.PROCESS.PROCESS_HISTORY_MODEL GetById(string id) { Apps.Models.PROCESS_HISTORY entity = m_Rep.GetById(id); if (entity != null) { //PROCESS_HISTORY entity = m_Rep.GetById(id); Apps.Models.SCV.PROCESS.PROCESS_HISTORY_MODEL model = new Apps.Models.SCV.PROCESS.PROCESS_HISTORY_MODEL(); model.INTERNAL_ID = entity.INTERNAL_ID; model.WAREHOUSE = entity.WAREHOUSE; model.PROCESS_TYPE = entity.PROCESS_TYPE; model.CONDITION = entity.CONDITION; model.IDENTIFIER1 = entity.IDENTIFIER1; model.IDENTIFIER2 = entity.IDENTIFIER2; model.IDENTIFIER3 = entity.IDENTIFIER3; model.IDENTIFIER4 = entity.IDENTIFIER4; model.IDENTIFIER5 = entity.IDENTIFIER5; model.IDENTIFIER6 = entity.IDENTIFIER6; model.IDENTIFIER7 = entity.IDENTIFIER7; model.IDENTIFIER8 = entity.IDENTIFIER8; model.MESSAGE = entity.MESSAGE; 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.PROCESS.PROCESS_HISTORY_MODEL model) { Apps.Models.PROCESS_HISTORY entity = m_Rep.GetById(model.INTERNAL_ID); if (entity != null) { errors.Add(Resource.PrimaryRepeat); return; } entity = new Apps.Models.PROCESS_HISTORY(); entity.INTERNAL_ID = model.INTERNAL_ID; entity.WAREHOUSE = model.WAREHOUSE; entity.PROCESS_TYPE = model.PROCESS_TYPE; entity.CONDITION = model.CONDITION; entity.IDENTIFIER1 = model.IDENTIFIER1; entity.IDENTIFIER2 = model.IDENTIFIER2; entity.IDENTIFIER3 = model.IDENTIFIER3; entity.IDENTIFIER4 = model.IDENTIFIER4; entity.IDENTIFIER5 = model.IDENTIFIER5; entity.IDENTIFIER6 = model.IDENTIFIER6; entity.IDENTIFIER7 = model.IDENTIFIER7; entity.IDENTIFIER8 = model.IDENTIFIER8; entity.MESSAGE = model.MESSAGE; 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.PROCESS.PROCESS_HISTORY_MODEL model, params string[] updateProperties) { Apps.Models.PROCESS_HISTORY entity = m_Rep.GetById(model.INTERNAL_ID); if (entity == null) { errors.Add(Resource.Disable); return; } if (updateProperties.Count() <= 0) { entity.INTERNAL_ID = model.INTERNAL_ID; entity.WAREHOUSE = model.WAREHOUSE; entity.PROCESS_TYPE = model.PROCESS_TYPE; entity.CONDITION = model.CONDITION; entity.IDENTIFIER1 = model.IDENTIFIER1; entity.IDENTIFIER2 = model.IDENTIFIER2; entity.IDENTIFIER3 = model.IDENTIFIER3; entity.IDENTIFIER4 = model.IDENTIFIER4; entity.IDENTIFIER5 = model.IDENTIFIER5; entity.IDENTIFIER6 = model.IDENTIFIER6; entity.IDENTIFIER7 = model.IDENTIFIER7; entity.IDENTIFIER8 = model.IDENTIFIER8; entity.MESSAGE = model.MESSAGE; entity.USER_STAMP = model.USER_STAMP; entity.DATE_TIME_STAMP = model.DATE_TIME_STAMP; } else { Type type = typeof(Apps.Models.SCV.PROCESS.PROCESS_HISTORY_MODEL); Type typeE = typeof(Apps.Models.PROCESS_HISTORY); 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); }