예제 #1
0
        /// <summary>
        /// 根据ID查找评审意见
        /// </summary>
        /// <param name="id">要查找的评审意见ID</param>
        /// <returns>返回找到的评审意见对象</returns>
        public static AssessOpinion GetAssessOpinionById(int id)
        {
            AssessOpinion assessOption = new AssessOpinion();  //实例化一个新的查询结果

            DBVisit.ObjDBAccess.CommandStr = @"select AssessOpinion_State,AssessOpinion_SendID,
                                               AssessOpinion_Result,AssessOpinion_Article,
                                               AssessOpinion_Message,AssessOpinion_Remark,
                                               AssessOpinion_ArticleStateID
                                               from AssessOpinion where AssessOpinion_ID=@id";
            SqlParameter sqlPm = new SqlParameter("@id", id);

            DBVisit.ObjDBAccess.CmdParas.Add(sqlPm);
            DataSet ds = new DataSet();

            ds = DBVisit.ObjDBAccess.ExecuteSelectSqlCommand(); //调用DBhelp执行查询方法 返回一个DataSet对象
            assessOption.ID = id;                               //跟相应的属性赋值
            assessOption.AssessStateInfo  = AssessStateService.GetAssessStateById(int.Parse(ds.Tables[0].Rows[0]["AssessOpinion_State"].ToString()));
            assessOption.AssessResultInfo = AssessResultService.GetAssessResultById(int.Parse(ds.Tables[0].Rows[0]["AssessOpinion_Result"].ToString()));
            assessOption.Article          = Convert.ToInt32(ds.Tables[0].Rows[0]["AssessOpinion_Article"]);
            assessOption.Message          = Convert.ToString(ds.Tables[0].Rows[0]["AssessOpinion_Message"]);
            assessOption.Remark           = Convert.ToString(ds.Tables[0].Rows[0]["AssessOpinion_Remark"]);
            assessOption.SendID           = Convert.ToInt32(ds.Tables[0].Rows[0]["AssessOpinion_SendID"]);
            assessOption.ArticleStateID   = Convert.ToInt32(ds.Tables[0].Rows[0]["AssessOpinion_ArticleStateID"]);
            return(assessOption);  //返回找到的结果
        }
예제 #2
0
        /// <summary>
        /// 查询所有的评审意见返回List
        /// </summary>
        /// <returns>返回类型List</returns>
        public static List <AssessOpinion> GetAllAssessOpinion()
        {
            List <AssessOpinion> list = new List <AssessOpinion>();

            DBVisit.ObjDBAccess.CommandStr = @"select AssessOpinion_ID,AssessOpinion_State,AssessOpinion_SendID,
                                                AssessOpinion_Result,AssessOpinion_Article,AssessOpinion_Message,
                                                AssessOpinion_Remark,AssessOpinion_ArticleStateID from AssessOpinion  ";
            DataTable dt = DBVisit.ObjDBAccess.ExecuteSelectSqlCommand().Tables [0];

            foreach (DataRow dr in dt.Rows)
            {
                AssessOpinion ass = new AssessOpinion();
                ass.ID = Convert.ToInt32(dr["AssessOpinion_ID"]);
                ass.AssessStateInfo  = AssessStateService.GetAssessStateById(Convert.ToInt32(dr["AssessOpinion_State"]));
                ass.AssessResultInfo = AssessResultService.GetAssessResultById(Convert.ToInt32(dr["AssessOpinion_Result"]));
                ass.SendID           = Convert.ToInt32(dr["AssessOpinion_SendID"]);
                ass.Article          = Convert.ToInt32(dr["AssessOpinion_Article"]);
                ass.Remark           = Convert.ToString(dr["AssessOpinion_Remark"]);
                ass.Message          = Convert.ToString(dr["AssessOpinion_Message"]);
                ass.ArticleStateID   = Convert.ToInt32(dr["AssessOpinion_ArticleStateID"]);
                list.Add(ass);
            }
            return(list);
        }