コード例 #1
0
        public virtual YZJ_InfoModel GetById(string id)
        {
            if (IsExists(id))
            {
                YZJ_Info      entity = m_Rep.GetById(id);
                YZJ_InfoModel model  = new YZJ_InfoModel();
                model.id                = entity.id;
                model.available         = entity.available;
                model.StdRollId         = entity.StdRollId;
                model.StdId             = entity.StdId;
                model.StdName           = entity.StdName;
                model.StdSex            = entity.StdSex;
                model.RepeatNo          = entity.RepeatNo;
                model.Entrance_Year     = entity.Entrance_Year;
                model.ClassNo           = entity.ClassNo;
                model.InResidence       = entity.InResidence;
                model.DormitoryBuilding = entity.DormitoryBuilding;
                model.DormitoryNo       = entity.DormitoryNo;
                model.AddProvince       = entity.AddProvince;
                model.AddCity           = entity.AddCity;
                model.AddArea           = entity.AddArea;
                model.AddStreet         = entity.AddStreet;
                model.AddDetail         = entity.AddDetail;

                return(model);
            }
            else
            {
                return(null);
            }
        }
コード例 #2
0
        public virtual bool Create(YZJ_InfoModel model)
        {
            try
            {
                YZJ_Info entity = m_Rep.GetById(model.id);
                if (entity != null)
                {
                    return(false);
                }
                entity                   = new YZJ_Info();
                entity.id                = model.id;
                entity.available         = model.available;
                entity.StdRollId         = model.StdRollId;
                entity.StdId             = model.StdId;
                entity.StdName           = model.StdName;
                entity.StdSex            = model.StdSex;
                entity.RepeatNo          = model.RepeatNo;
                entity.Entrance_Year     = model.Entrance_Year;
                entity.ClassNo           = model.ClassNo;
                entity.InResidence       = model.InResidence;
                entity.DormitoryBuilding = model.DormitoryBuilding;
                entity.DormitoryNo       = model.DormitoryNo;
                entity.AddProvince       = model.AddProvince;
                entity.AddCity           = model.AddCity;
                entity.AddArea           = model.AddArea;
                entity.AddStreet         = model.AddStreet;
                entity.AddDetail         = model.AddDetail;


                if (m_Rep.Create(entity))
                {
                    return(true);
                }
                else
                {
                    return(false);
                }
            }
            catch (Exception ex)
            {
                return(false);
            }
        }