예제 #1
0
        public Entity Add(Entity entity)
        {
            CompanyRecruit companyRecurit = entity as CompanyRecruit;
            string         sql            = "insert CompanyRecurit(CompanyId,UniversityId,Year)values(@CompanyId,@UniversityId,@Year);select @RecuritId = @@IDentity ";
            SqlParameter   prmCompanyId   = new SqlParameter("@CompanyId", SqlDbType.Int)
            {
                Value = companyRecurit.CompanyId
            };
            SqlParameter prmUniversityId = new SqlParameter("@UniversityId", SqlDbType.Int)
            {
                Value = companyRecurit.UniversityId
            };
            SqlParameter prmYear = new SqlParameter("@Year", SqlDbType.Int)
            {
                Value = companyRecurit.Year
            };
            SqlParameter prmCompanyRecuritId = new SqlParameter("@RecuritId", SqlDbType.Int)
            {
                Direction = ParameterDirection.Output
            };

            ExecuteNoQuery(sql, prmCompanyId, prmUniversityId, prmYear, prmCompanyRecuritId);
            companyRecurit.RecruitId = (int)prmCompanyRecuritId.Value;
            return(entity);
        }
예제 #2
0
        private Entity GetOne(SqlDataReader reader)
        {
            if (!reader.HasRows)
            {
                SetError("招聘信息不存在");
                return(null);
            }
            CompanyRecruit recurit = new CompanyRecruit();

            recurit.RecruitId    = reader.GetInt32(0);
            recurit.CompanyId    = reader.GetInt32(1);
            recurit.UniversityId = reader.GetInt32(2);
            recurit.Year         = reader.GetInt32(3);
            return(recurit);
        }
예제 #3
0
        public Entity Update(Entity entity)
        {
            CompanyRecruit companyRecurit = entity as CompanyRecruit;
            string         sql            = "update CompanyRecurit set CompanyId = @CompanyId,UniversityId = @UniversityId,Year = @Year where RecuritId = @RecuritId ";
            SqlParameter   prmCompanyId   = new SqlParameter("@CompanyId", SqlDbType.Int)
            {
                Value = companyRecurit.CompanyId
            };
            SqlParameter prmUniversityId = new SqlParameter("@UniversityId", SqlDbType.Int)
            {
                Value = companyRecurit.UniversityId
            };
            SqlParameter prmYear = new SqlParameter("@Year", SqlDbType.Int)
            {
                Value = companyRecurit.Year
            };
            SqlParameter prmCompanyRecuritId = new SqlParameter("@RecuritId", SqlDbType.Int)
            {
                Value = companyRecurit.RecruitId
            };

            ExecuteNoQuery(sql, prmCompanyId, prmUniversityId, prmYear, prmCompanyRecuritId);
            return(entity);
        }