public virtual Apps.Models.Sys.SysUserModel GetById(string id)
        {
            SysUser entity = m_Rep.GetById(id);

            if (entity != null)
            {
                //SysUser entity = m_Rep.GetById(id);
                Apps.Models.Sys.SysUserModel model = new Apps.Models.Sys.SysUserModel();
                model.Id       = entity.Id;
                model.UserName = entity.UserName;
                model.Password = entity.Password;
                model.PasswordExpirationTime = entity.PasswordExpirationTime;
                model.TrueName     = entity.TrueName;
                model.Card         = entity.Card;
                model.MobileNumber = entity.MobileNumber;
                model.PhoneNumber  = entity.PhoneNumber;
                model.QQ           = entity.QQ;
                model.EmailAddress = entity.EmailAddress;
                model.OtherContact = entity.OtherContact;
                model.Province     = entity.Province;
                model.City         = entity.City;
                model.Village      = entity.Village;
                model.Address      = entity.Address;
                model.State        = entity.State;
                model.CreateTime   = entity.CreateTime;
                model.CreatePerson = entity.CreatePerson;
                model.Sex          = entity.Sex;
                model.Birthday     = entity.Birthday;
                model.JoinDate     = entity.JoinDate;
                model.Marital      = entity.Marital;
                model.Political    = entity.Political;
                model.Nationality  = entity.Nationality;
                model.Native       = entity.Native;
                model.School       = entity.School;
                model.Professional = entity.Professional;
                model.Degree       = entity.Degree;
                model.DepId        = entity.DepId;
                model.PosId        = entity.PosId;
                model.Expertise    = entity.Expertise;
                model.Photo        = entity.Photo;
                model.Attach       = entity.Attach;
                model.Lead         = entity.Lead;
                model.LeadName     = entity.LeadName;

                return(model);
            }
            else
            {
                return(null);
            }
        }
        public virtual void Create(ref ValidationErrors errors, Apps.Models.Sys.SysUserModel model)
        {
            SysUser entity = m_Rep.GetById(model.Id);

            if (entity != null)
            {
                errors.Add(Resource.PrimaryRepeat);
                return;
            }
            entity          = new SysUser();
            entity.Id       = model.Id;
            entity.UserName = model.UserName;
            entity.Password = model.Password;
            entity.PasswordExpirationTime = model.PasswordExpirationTime;
            entity.TrueName     = model.TrueName;
            entity.Card         = model.Card;
            entity.MobileNumber = model.MobileNumber;
            entity.PhoneNumber  = model.PhoneNumber;
            entity.QQ           = model.QQ;
            entity.EmailAddress = model.EmailAddress;
            entity.OtherContact = model.OtherContact;
            entity.Province     = model.Province;
            entity.City         = model.City;
            entity.Village      = model.Village;
            entity.Address      = model.Address;
            entity.State        = model.State;
            entity.CreateTime   = model.CreateTime;
            entity.CreatePerson = model.CreatePerson;
            entity.Sex          = model.Sex;
            entity.Birthday     = model.Birthday;
            entity.JoinDate     = model.JoinDate;
            entity.Marital      = model.Marital;
            entity.Political    = model.Political;
            entity.Nationality  = model.Nationality;
            entity.Native       = model.Native;
            entity.School       = model.School;
            entity.Professional = model.Professional;
            entity.Degree       = model.Degree;
            entity.DepId        = model.DepId;
            entity.PosId        = model.PosId;
            entity.Expertise    = model.Expertise;
            entity.Photo        = model.Photo;
            entity.Attach       = model.Attach;
            entity.Lead         = model.Lead;
            entity.LeadName     = model.LeadName;

            m_Rep.Create(entity);
        }
        public virtual void Modify(ref ValidationErrors errors, Apps.Models.Sys.SysUserModel model, params string[] updateProperties)
        {
            SysUser entity = m_Rep.GetById(model.Id);

            if (entity == null)
            {
                errors.Add(Resource.Disable);
                return;
            }
            if (updateProperties.Count() <= 0)
            {
                entity.Id       = model.Id;
                entity.UserName = model.UserName;
                entity.Password = model.Password;
                entity.PasswordExpirationTime = model.PasswordExpirationTime;
                entity.TrueName     = model.TrueName;
                entity.Card         = model.Card;
                entity.MobileNumber = model.MobileNumber;
                entity.PhoneNumber  = model.PhoneNumber;
                entity.QQ           = model.QQ;
                entity.EmailAddress = model.EmailAddress;
                entity.OtherContact = model.OtherContact;
                entity.Province     = model.Province;
                entity.City         = model.City;
                entity.Village      = model.Village;
                entity.Address      = model.Address;
                entity.State        = model.State;
                entity.CreateTime   = model.CreateTime;
                entity.CreatePerson = model.CreatePerson;
                entity.Sex          = model.Sex;
                entity.Birthday     = model.Birthday;
                entity.JoinDate     = model.JoinDate;
                entity.Marital      = model.Marital;
                entity.Political    = model.Political;
                entity.Nationality  = model.Nationality;
                entity.Native       = model.Native;
                entity.School       = model.School;
                entity.Professional = model.Professional;
                entity.Degree       = model.Degree;
                entity.DepId        = model.DepId;
                entity.PosId        = model.PosId;
                entity.Expertise    = model.Expertise;
                entity.Photo        = model.Photo;
                entity.Attach       = model.Attach;
                entity.Lead         = model.Lead;
                entity.LeadName     = model.LeadName;
            }
            else
            {
                Type type  = typeof(Apps.Models.Sys.SysUserModel);
                Type typeE = typeof(Apps.Models.SysUser);
                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);
        }