Ejemplo n.º 1
0
        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);
            }
        }
Ejemplo n.º 2
0
        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)//废弃
                {
                }
            }
        }
Ejemplo n.º 3
0
        /// <summary>
        /// 用于更新自评人评分明细表与主表与月度计划表
        /// </summary>
        /// <returns></returns>
        public bool Update(string billID)
        {
            bool result = false;
            int  index  = 0;

            try
            {
                List <EntityBase> listUpdate = new List <EntityBase>();
                TechnicalReviewPrimaryEntity.GenerateObjectFromRequest("");
                TechnicalReviewPrimaryEntity.IsGenerateObject = true;
                listUpdate.Add(TechnicalReviewPrimaryEntity);


                foreach (var key in HttpContext.Current.Request.Form.AllKeys)
                {
                    //更新月度计划表
                    if (key.StartsWith("atxt") && key.EndsWith("rowNo"))
                    {
                        index = int.Parse(key.Replace("atxt", "").Replace("rowNo", ""));
                        TechnicalReviewProgressEntity TechnicalReviewProgressEntityUD = new TechnicalReviewProgressEntity();
                        TechnicalReviewProgressEntityUD.GenerateObjectFromRequest("atxt" + index);
                        TechnicalReviewProgressEntityUD.TechnicalReviewID = billID;
                        if (!string.IsNullOrEmpty(TechnicalReviewProgressEntityUD.RowState)) //添加时,RowState为空!
                        {                                                                    //编辑
                            if (TechnicalReviewProgressEntityUD.RowState == "delete")        //删除
                            {
                                TechnicalReviewProgressEntityUD.Delete();
                            }
                            else
                            {
                                TechnicalReviewProgressEntityUD.IsGenerateObject = true;
                            }
                        }
                        else
                        {
                            TechnicalReviewProgressEntityUD.IsGenerateObject = false;
                        }

                        if (TechnicalReviewProgressEntityUD.RowState != "delete")
                        {
                            listUpdate.Add(TechnicalReviewProgressEntityUD);
                        }
                    }
                    //更新自评分数
                    if (key.StartsWith("Review") && key.EndsWith("rowNo"))
                    {
                        index = Convert.ToInt16(key.Replace("Review", "").Replace("rowNo", ""));
                        TechnicalSelfScoreDetailsEntity TechnicalSelfScoreDetailsEntity = new TechnicalSelfScoreDetailsEntity();
                        TechnicalSelfScoreDetailsEntity.GenerateObjectFromRequest("self" + index);
                        TechnicalSelfScoreDetailsEntity.TechnicalReviewID = billID;
                        TechnicalSelfScoreDetailsEntity.SelfReviewMan     = TechnicalReviewPrimaryEntity.CreateManCode;
                        if (TechnicalSelfScoreDetailsEntity.SID != null && TechnicalSelfScoreDetailsEntity.SID > 0)
                        {
                            TechnicalSelfScoreDetailsEntity.IsGenerateObject = true;
                        }
                        else
                        {
                            TechnicalSelfScoreDetailsEntity.IsGenerateObject = false;
                        }
                        listUpdate.Add(TechnicalSelfScoreDetailsEntity);
                    }
                    //更新提案表
                    if (key.StartsWith("dtxt") && key.EndsWith("rowNo"))
                    {
                        index = int.Parse(key.Replace("dtxt", "").Replace("rowNo", ""));
                        TReviewProposalEntity TReviewProposalEntityUD = new TReviewProposalEntity();
                        TReviewProposalEntityUD.GenerateObjectFromRequest("dtxt" + index);
                        TReviewProposalEntityUD.TechnicalReviewID = billID;
                        if (!string.IsNullOrEmpty(TReviewProposalEntityUD.RowState)) //添加时,RowState为空!
                        {                                                            //编辑
                            if (TReviewProposalEntityUD.RowState == "delete")        //删除
                            {
                                TReviewProposalEntityUD.Delete();
                            }
                            else
                            {
                                TReviewProposalEntityUD.IsGenerateObject = true;
                            }
                        }
                        else
                        {
                            TReviewProposalEntityUD.IsGenerateObject = false;
                        }

                        if (TReviewProposalEntityUD.RowState != "delete")
                        {
                            listUpdate.Add(TReviewProposalEntityUD);
                        }
                    }
                }

                result = TechnicalReviewPrimaryEntity.db.CommitTran(listUpdate.ToArray());
            }
            catch
            {
                result = false;
            }
            return(result);
        }