Exemplo n.º 1
0
        public virtual void Modify(ref ValidationErrors errors, Apps.Models.SCV.PT.PT_QTY_MODEL model, params string[] updateProperties)
        {
            Apps.Models.PT_QTY entity = m_Rep.GetById(model.COMPANY);
            if (entity == null)
            {
                errors.Add(Resource.Disable);
                return;
            }
            if (updateProperties.Count() <= 0)
            {
                entity.COMPANY     = model.COMPANY;
                entity.PT          = model.PT;
                entity.ITEM        = model.ITEM;
                entity.CONVERT_QTY = model.CONVERT_QTY;
            }
            else
            {
                Type type  = typeof(Apps.Models.SCV.PT.PT_QTY_MODEL);
                Type typeE = typeof(Apps.Models.PT_QTY);
                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);
        }
Exemplo n.º 2
0
        public virtual void Create(ref ValidationErrors errors, Apps.Models.SCV.PT.PT_QTY_MODEL model)
        {
            Apps.Models.PT_QTY entity = m_Rep.GetById(model.COMPANY);
            if (entity != null)
            {
                errors.Add(Resource.PrimaryRepeat);
                return;
            }
            entity             = new Apps.Models.PT_QTY();
            entity.COMPANY     = model.COMPANY;
            entity.PT          = model.PT;
            entity.ITEM        = model.ITEM;
            entity.CONVERT_QTY = model.CONVERT_QTY;

            m_Rep.Create(entity);
        }
Exemplo n.º 3
0
        public virtual Apps.Models.SCV.PT.PT_QTY_MODEL GetById(string id)
        {
            Apps.Models.PT_QTY entity = m_Rep.GetById(id);
            if (entity != null)
            {
                //PT_QTY entity = m_Rep.GetById(id);
                Apps.Models.SCV.PT.PT_QTY_MODEL model = new Apps.Models.SCV.PT.PT_QTY_MODEL();
                model.COMPANY     = entity.COMPANY;
                model.PT          = entity.PT;
                model.ITEM        = entity.ITEM;
                model.CONVERT_QTY = entity.CONVERT_QTY;

                return(model);
            }
            else
            {
                return(null);
            }
        }