public TechnicalReviewBLL(string TechnicalReviewID) { if (string.IsNullOrEmpty(TechnicalReviewID)) { TechnicalReviewID = "-1";//这样取出的就是一个空的视图 } TechnicalReviewPrimaryEntity = new V_TechnicalReviewPrimaryEntity(); TechnicalReviewPrimaryEntity.ResetForSearch(); TechnicalReviewPrimaryEntity.TechnicalReviewID = TechnicalReviewID; TechnicalReviewPrimaryEntity.GetTable(true); TechnicalReviewScoreDetailsEntity = new V_TechnicalReviewScoreDetailsEntity(); TechnicalReviewScoreDetailsEntity.PageSize = 0;//设置返回数据,即集合变量的大小,为0则放回全部数据 TechnicalReviewScoreDetailsEntity.ResetForSearch(); TechnicalReviewScoreDetailsEntity.TechnicalReviewID = TechnicalReviewID; TechnicalReviewScoreDetailsEntity.OrderFields = "StandardType,SequenceID"; TechnicalReviewScoreDetailsList = TechnicalReviewScoreDetailsEntity.ToList <V_TechnicalReviewScoreDetailsEntity>(); TechnicalReviewProgressEntity = new TechnicalReviewProgressEntity(); TechnicalReviewProgressEntity.PageSize = 0; TechnicalReviewProgressEntity.ResetForSearch(); TechnicalReviewProgressEntity.TechnicalReviewID = TechnicalReviewID; TechnicalReviewProgressEntity.OrderFields = "ID"; TechnicalReviewProgressEntityList = TechnicalReviewProgressEntity.ToList <TechnicalReviewProgressEntity>(); if (TechnicalReviewProgressEntityList.Count() <= 0) { TechnicalReviewProgressEntity.TechnicalReviewID = ""; TechnicalReviewProgressEntityList.Add(TechnicalReviewProgressEntity); } TReviewProposalSingle = new TReviewProposalEntity(); TReviewProposalSingle.PageSize = 0; TReviewProposalSingle.ResetForSearch(); TReviewProposalSingle.TechnicalReviewID = TechnicalReviewID; TReviewProposalSingleList = TReviewProposalSingle.ToList <TReviewProposalEntity>(); if (TReviewProposalSingleList.Count() <= 0) { TReviewProposalSingle.TechnicalReviewID = ""; TReviewProposalSingle.ProposalID = ""; TReviewProposalSingleList.Add(TReviewProposalSingle); } }
public TechnicalReviewBLL(string TechnicalReviewID, string Reviewer) { if (string.IsNullOrEmpty(TechnicalReviewID)) { TechnicalReviewID = "-1";//这样取出的就是一个空的视图 } this.Reviewer = Reviewer; this.Isexist = 0; string flagReviewer = Reviewer; //技术评审主表实体 TechnicalReviewPrimaryEntity = new V_TechnicalReviewPrimaryEntity(); TechnicalReviewPrimaryEntity.ResetForSearch(); TechnicalReviewPrimaryEntity.TechnicalReviewID = TechnicalReviewID; TechnicalReviewPrimaryEntity.GetTable(true); //月度计划表实体实体 TechnicalReviewProgressEntity = new TechnicalReviewProgressEntity(); TechnicalReviewProgressEntity.PageSize = 0; TechnicalReviewProgressEntity.ResetForSearch(); TechnicalReviewProgressEntity.TechnicalReviewID = TechnicalReviewID; TechnicalReviewProgressEntity.OrderFields = "ID"; TechnicalReviewProgressEntityList = TechnicalReviewProgressEntity.ToList <TechnicalReviewProgressEntity>(); //评分明细实体 TechnicalReviewScoreDetailsEntity = new V_TechnicalReviewScoreDetailsEntity(); TechnicalReviewScoreDetailsEntity.PageSize = 0;//设置返回数据,即集合变量的大小,为0则放回全部数据 TechnicalReviewScoreDetailsEntity.ResetForSearch(); TechnicalReviewScoreDetailsEntity.TechnicalReviewID = TechnicalReviewID; TechnicalReviewScoreDetailsEntity.OrderFields = "StandardType,SequenceID"; TechnicalReviewScoreDetailsList = TechnicalReviewScoreDetailsEntity.ToList <V_TechnicalReviewScoreDetailsEntity>(); TechnicalReviewerScoreEntity = new V_TechnicalReviewerScoreEntity(); TechnicalReviewerScoreEntity.ResetForSearch(); TechnicalReviewerScoreEntity.TechnicalReviewID = TechnicalReviewID; TechnicalReviewerScoreEntity.Reviewer = Reviewer; TechnicalReviewerScoreEntity.GetTable(true); TReviewProposalSingle = new TReviewProposalEntity(); TReviewProposalSingle.PageSize = 0; TReviewProposalSingle.ResetForSearch(); TReviewProposalSingle.TechnicalReviewID = TechnicalReviewID; TReviewProposalSingleList = TReviewProposalSingle.ToList <TReviewProposalEntity>(); foreach (var s in TechnicalReviewScoreDetailsList) { if (string.IsNullOrEmpty(s.ReviewerCode)) { Isexist = 0;//插入 break; } else if (s.ReviewerCode == flagReviewer) { Reviewer = flagReviewer; Isexist = 1;//更新 break; } else { Reviewer = s.ReviewerCode; Isexist = 2;//插入。评委第一次评分,旁观者啥也不做 //更新时根据标识判断更新还是插入 } } if (Isexist == 0) { } else { TechnicalReviewScoreDetailsEntity = new V_TechnicalReviewScoreDetailsEntity(); try { TechnicalReviewScoreDetailsEntity.PageSize = 0;//设置返回数据,即集合变量的大小,为0则放回全部数据 TechnicalReviewScoreDetailsEntity.ResetForSearch(); } catch { } TechnicalReviewScoreDetailsEntity.TechnicalReviewID = TechnicalReviewID; TechnicalReviewScoreDetailsEntity.ReviewerCode = Reviewer; TechnicalReviewScoreDetailsEntity.OrderFields = "StandardType,SequenceID"; TechnicalReviewScoreDetailsList = TechnicalReviewScoreDetailsEntity.ToList <V_TechnicalReviewScoreDetailsEntity>(); if (Isexist == 2 && Reviewer != flagReviewer) { if (TechnicalReviewPrimaryEntity.ReviewerList.Contains(flagReviewer)) { foreach (var i in TechnicalReviewScoreDetailsList) {//第一次评分时消除历史数据 i.CheckQuantity = null; i.QualifiedQuantity = null; i.ReviewerScore = null; } } else { //其他人员查看 int flag = 0; SqlDataBase db = new SqlDataBase(); DataTable dt = db.GetTable("SELECT * FROM (SELECT SequenceID,ISNULL(SUM(CheckQuantity),-1) CheckQuantity " + ",ISNULL(SUM(QualifiedQuantity),-1) QualifiedQuantity,ISNULL(CAST(CONVERT(DECIMAL,SUM(QualifiedQuantity))*100/SUM(CheckQuantity)AS numeric(5,2)),100) ReviewerScore" + " FROM dbo.V_TechnicalReviewScoreDetails WHERE TechnicalReviewID = '" + TechnicalReviewID + "' GROUP BY SequenceID) A ORDER BY A.SequenceID"); int?checkQuantity = null; int?qualifiedQuantity = null; foreach (var i in TechnicalReviewScoreDetailsList) { checkQuantity = (int)dt.Rows[flag]["CheckQuantity"]; qualifiedQuantity = (int)dt.Rows[flag]["QualifiedQuantity"]; if (checkQuantity == -1) { i.CheckQuantity = null; } else { i.CheckQuantity = checkQuantity; } if (qualifiedQuantity == -1) { i.QualifiedQuantity = null; } else { i.QualifiedQuantity = qualifiedQuantity; } i.ReviewerScore = (decimal)dt.Rows[flag]["ReviewerScore"]; flag++; } } } else if (Isexist == 2 && Reviewer == flagReviewer)//废弃 { } } }