コード例 #1
0
        public List <ProjectPrincipalEntity> GetProjectPrincipal(int projectId)
        {
            List <ProjectPrincipalEntity> list = new List <ProjectPrincipalEntity>();
            StringBuilder sb = new StringBuilder();

            sb.Append("select id,projectid,module,pm,dev,qa from ProjectPrincipal ")
            .AppendFormat(" where ProjectID=@ProjectID ");

            Database db = DatabaseFactory.CreateDatabase();

            using (DbCommand dbCommand = db.GetSqlStringCommand(sb.ToString()))
            {
                db.AddInParameter(dbCommand, "ProjectID", DbType.Int32, projectId);
                using (IDataReader dataReader = db.ExecuteReader(dbCommand))
                {
                    while (dataReader.Read())
                    {
                        list.Add(ProjectPrincipalEntity.ReaderBind(dataReader));
                    }
                }
            }
            return(list);
        }
コード例 #2
0
        public ProjectPrincipalEntity Get(int ID)
        {
            StringBuilder sb = new StringBuilder();

            sb.Append("select * from ProjectPrincipal ")
            .AppendFormat(" where ID={0} ", ID);

            Database db = DatabaseFactory.CreateDatabase();

            using (DbCommand dbCommand = db.GetSqlStringCommand(sb.ToString()))
            {
                using (IDataReader dataReader = db.ExecuteReader(dbCommand))
                {
                    if (dataReader.Read())
                    {
                        return(ProjectPrincipalEntity.ReaderBind(dataReader));
                    }
                    else
                    {
                        return(null);
                    }
                }
            }
        }