/// <summary> /// 获取自评分数 /// </summary> /// <param name="intentionID">评审单号</param> public FrameReviewBLL(string FrameReviewID) { if (string.IsNullOrEmpty(FrameReviewID)) { FrameReviewID = "-1";//这样取出的就是一个空的视图 } FrameReviewEntity1 = new V_FrameReviewEntity(); FrameReviewEntity1.ResetForSearch(); FrameReviewEntity1.FrameReviewID = FrameReviewID; FrameReviewEntity1.GetTable(true); FrameReviewerShowEntity = new FrameReviewerEntity(); FrameReviewerShowEntity.ResetForSearch(); FrameReviewerShowEntity.FrameReviewID = FrameReviewID; FrameReviewerShowEntity.Reviewer = FrameReviewEntity1.CreateMan; FrameReviewerShowEntity.GetTable(true); FrameReviewScoreEntity = new V_FrameReviewScoreShowEntity(); FrameReviewScoreEntity.PageSize = 0;//设置返回数据,即集合变量的大小,为0则放回全部数据 FrameReviewScoreEntity.ResetForSearch(); FrameReviewScoreEntity.FrameReviewID = FrameReviewID; //FrameReviewScoreEntity.GetTable(true); FrameReviewScoreEntity.OrderFields = "StandardType,SequenceID"; FrameReviewScoreList = FrameReviewScoreEntity.ToList <V_FrameReviewScoreShowEntity>(); }
/// <summary> /// 用于获取评审人评分数据 /// </summary> /// <param name="FrameReviewID">框架评审单号</param> /// <param name="Reviewer">评审人工号</param> public FrameReviewBLL(string FrameReviewID, string Reviewer) { string flagReviewer = null; flagReviewer = Reviewer; FrameReviewEntity1 = new V_FrameReviewEntity(); FrameReviewEntity1.ResetForSearch(); FrameReviewEntity1.FrameReviewID = FrameReviewID; FrameReviewEntity1.GetTable(true); FrameReviewerShowEntity = new FrameReviewerEntity(); FrameReviewerShowEntity.ResetForSearch(); FrameReviewerShowEntity.FrameReviewID = FrameReviewID; FrameReviewerShowEntity.Reviewer = Reviewer; FrameReviewerShowEntity.GetTable(true); FrameReviewScoreEntity = new V_FrameReviewScoreShowEntity(); FrameReviewScoreEntity.PageSize = 0;//设置返回数据,即集合变量的大小,为0则放回全部数据 FrameReviewScoreEntity.ResetForSearch(); FrameReviewScoreEntity.FrameReviewID = FrameReviewID; FrameReviewScoreEntity.OrderFields = "StandardType,SequenceID"; FrameReviewScoreList = FrameReviewScoreEntity.ToList <V_FrameReviewScoreShowEntity>(); foreach (var s in FrameReviewScoreList) { if (string.IsNullOrEmpty(s.Reviewer)) { Isexist = 0;//插入 break; } else if (s.Reviewer == flagReviewer) { Reviewer = flagReviewer; Isexist = 1;//更新 break; } else { Reviewer = s.Reviewer; Isexist = 2;//插入,评委第一次评分 } } //其实这里可以用一个foreach来遍历标准表,依次插数据到实体类中然后插入 if (Isexist != 0) { FrameReviewScoreEntity = new V_FrameReviewScoreShowEntity(); FrameReviewScoreEntity.PageSize = 0; FrameReviewScoreEntity.ResetForSearch(); if (string.IsNullOrEmpty(FrameReviewID) || string.IsNullOrEmpty(Reviewer)) { FrameReviewID = "-1"; Reviewer = "-1"; } FrameReviewScoreEntity.FrameReviewID = FrameReviewID; FrameReviewScoreEntity.Reviewer = Reviewer; FrameReviewScoreList = FrameReviewScoreEntity.ToList <V_FrameReviewScoreShowEntity>(); if (Isexist == 2 && Reviewer != flagReviewer) { if (FrameReviewEntity1.FrameReviewers.Contains(flagReviewer)) { foreach (var i in FrameReviewScoreList)//第一次评分时消除历史数据 { i.reviewerReview = null; } } else { //其他人员查看 V_FrameReviewEntity FrameReviewEntity = new V_FrameReviewEntity(); FrameReviewEntity.ResetForSearch(); FrameReviewEntity.FrameReviewID = FrameReviewID; FrameReviewEntity.GetTable(true); decimal?devDay = FrameReviewEntity.DevelopDays; decimal?passRate = FrameReviewEntity.PassingRate; SqlDataBase db = new SqlDataBase(); //妙,这里取最小值作为分数,避免了相加的麻烦,good for you DataTable dt = db.GetTable(" SELECT A.Reviewerreview FROM(SELECT StandardType,SequenceID,MIN(reviewerReview) reviewerReview FROM dbo.V_FrameReviewScore " + " WHERE ISNULL(Reviewer, '') <> '' AND FrameReviewID = '" + FrameReviewID + "' GROUP BY StandardType, SequenceID) A ORDER BY A.StandardType,A.SequenceID"); int flag = 0; foreach (var i in FrameReviewScoreList)//替换数据为综合数据 { i.reviewerReview = (int)dt.Rows[flag]["reviewerReview"]; flag++; } } } } }