public virtual Apps.Models.SCV.ALLOCATION.ALLOCATION_RULE_DETAIL_MODEL GetById(string id) { Apps.Models.ALLOCATION_RULE_DETAIL entity = m_Rep.GetById(id); if (entity != null) { //ALLOCATION_RULE_DETAIL entity = m_Rep.GetById(id); Apps.Models.SCV.ALLOCATION.ALLOCATION_RULE_DETAIL_MODEL model = new Apps.Models.SCV.ALLOCATION.ALLOCATION_RULE_DETAIL_MODEL(); model.ALLOCATION_RULE = entity.ALLOCATION_RULE; model.QUANTITY_UM = entity.QUANTITY_UM; model.SEQUENCE = entity.SEQUENCE; model.STRATEGY = entity.STRATEGY; model.LOC_SEL_ID = entity.LOC_SEL_ID; model.LOC_SEL_DESC = entity.LOC_SEL_DESC; model.OBJECT_ID = entity.OBJECT_ID; model.ROLL_IN_NEXT_UM = entity.ROLL_IN_NEXT_UM; model.MAX_ALLOCATE_QTY = entity.MAX_ALLOCATE_QTY; model.MAX_ALLOCATE_QTY_UM = entity.MAX_ALLOCATE_QTY_UM; return(model); } else { return(null); } }
public virtual void Create(ref ValidationErrors errors, Apps.Models.SCV.ALLOCATION.ALLOCATION_RULE_DETAIL_MODEL model) { Apps.Models.ALLOCATION_RULE_DETAIL entity = m_Rep.GetById(model.ALLOCATION_RULE); if (entity != null) { errors.Add(Resource.PrimaryRepeat); return; } entity = new Apps.Models.ALLOCATION_RULE_DETAIL(); entity.ALLOCATION_RULE = model.ALLOCATION_RULE; entity.QUANTITY_UM = model.QUANTITY_UM; entity.SEQUENCE = model.SEQUENCE; entity.STRATEGY = model.STRATEGY; entity.LOC_SEL_ID = model.LOC_SEL_ID; entity.LOC_SEL_DESC = model.LOC_SEL_DESC; entity.OBJECT_ID = model.OBJECT_ID; entity.ROLL_IN_NEXT_UM = model.ROLL_IN_NEXT_UM; entity.MAX_ALLOCATE_QTY = model.MAX_ALLOCATE_QTY; entity.MAX_ALLOCATE_QTY_UM = model.MAX_ALLOCATE_QTY_UM; m_Rep.Create(entity); }
public virtual void Modify(ref ValidationErrors errors, Apps.Models.SCV.ALLOCATION.ALLOCATION_RULE_DETAIL_MODEL model, params string[] updateProperties) { Apps.Models.ALLOCATION_RULE_DETAIL entity = m_Rep.GetById(model.ALLOCATION_RULE); if (entity == null) { errors.Add(Resource.Disable); return; } if (updateProperties.Count() <= 0) { entity.ALLOCATION_RULE = model.ALLOCATION_RULE; entity.QUANTITY_UM = model.QUANTITY_UM; entity.SEQUENCE = model.SEQUENCE; entity.STRATEGY = model.STRATEGY; entity.LOC_SEL_ID = model.LOC_SEL_ID; entity.LOC_SEL_DESC = model.LOC_SEL_DESC; entity.OBJECT_ID = model.OBJECT_ID; entity.ROLL_IN_NEXT_UM = model.ROLL_IN_NEXT_UM; entity.MAX_ALLOCATE_QTY = model.MAX_ALLOCATE_QTY; entity.MAX_ALLOCATE_QTY_UM = model.MAX_ALLOCATE_QTY_UM; } else { Type type = typeof(Apps.Models.SCV.ALLOCATION.ALLOCATION_RULE_DETAIL_MODEL); Type typeE = typeof(Apps.Models.ALLOCATION_RULE_DETAIL); 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); }