public static Models.DB.ProjectScore FindOne(String ProjectID, String MatchModelID, String JudgeID)
        {
            int projectid, matchmodelid, judgeid;

            try
            {
                projectid    = Convert.ToInt32(ProjectID);
                matchmodelid = Convert.ToInt32(MatchModelID);
                judgeid      = Convert.ToInt32(JudgeID);
            }
            catch
            {
                return(null);
            }
            Models.DB.ProjectScore model = new Models.DB.ProjectScore();
            DataTable dt = DAL.Select.FindProjectScore(projectid, matchmodelid, judgeid);

            if (dt.Rows.Count > 0)
            {
                model              = new Models.DB.ProjectScore();
                model.Score        = Convert.ToInt32(dt.Rows[0]["Score"]);
                model.ProjectID    = Convert.ToInt32(dt.Rows[0]["ProjectID"]);
                model.MatchModelID = Convert.ToInt32(dt.Rows[0]["MatchModelID"]);
                model.JudgeID      = Convert.ToInt32(dt.Rows[0]["JudgeID"]);
                model.ID           = Convert.ToInt32(dt.Rows[0]["ID"]);
                model.Remark       = dt.Rows[0]["Remark"].ToString();
                return(model);
            }

            return(null);
        }
        public static int Update(String ID, String ProjectID, String Score, String JudgeID, String Remark, String MatchModelID)
        {
            int projectid, score, judgeid, matchmodelid, id;

            try
            {
                id           = Convert.ToInt32(ID);
                projectid    = Convert.ToInt32(ProjectID);
                score        = Convert.ToInt32(Score);
                judgeid      = Convert.ToInt32(JudgeID);
                matchmodelid = Convert.ToInt32(MatchModelID);
            }
            catch
            {
                return(0);
            }
            Models.DB.ProjectScore model = new Models.DB.ProjectScore();
            model.JudgeID      = judgeid;
            model.MatchModelID = matchmodelid;
            model.ProjectID    = projectid;
            model.Remark       = Remark;
            model.Score        = score;
            model.ID           = id;
            return(DAL.Update.ChangeSome(model, "ID"));
        }
        public static List <Models.DB.ProjectScore> FindProjectScore(String ProjectID, String MatchModelID)
        {
            int projectid, matchmodelid;

            try
            {
                projectid    = Convert.ToInt32(ProjectID);
                matchmodelid = Convert.ToInt32(MatchModelID);
            }
            catch
            {
                return(null);
            }
            List <Models.DB.ProjectScore> list = new List <Models.DB.ProjectScore>();

            Models.DB.ProjectScore model;
            DataTable dt = DAL.Select.FindProjectScore(projectid, matchmodelid);

            foreach (DataRow row in dt.Rows)
            {
                model              = new Models.DB.ProjectScore();
                model.Score        = Convert.ToInt32(row["Score"]);
                model.ProjectID    = Convert.ToInt32(row["ProjectID"]);
                model.MatchModelID = Convert.ToInt32(row["MatchModelID"]);
                model.JudgeID      = Convert.ToInt32(row["JudgeID"]);
                model.ID           = Convert.ToInt32(row["ID"]);
                model.Remark       = row["Remark"].ToString();
                list.Add(model);
            }
            return(list);
        }
        public static int CreateOne(String ProjectID, String Score, String JudgeID, String Remark, String MatchModelID)
        {
            int projectid, score, judgeid, matchmodelid;

            try
            {
                projectid    = Convert.ToInt32(ProjectID);
                score        = Convert.ToInt32(Score);
                judgeid      = Convert.ToInt32(JudgeID);
                matchmodelid = Convert.ToInt32(MatchModelID);
            }
            catch
            {
                return(0);
            }
            Models.DB.ProjectScore model = new Models.DB.ProjectScore();
            model.JudgeID      = judgeid;
            model.MatchModelID = matchmodelid;
            model.ProjectID    = projectid;
            model.Remark       = Remark;
            model.Score        = score;
            return(DAL.Create.CreateOne(model));
        }
Exemple #5
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (String.IsNullOrEmpty(Request["MatchID"]) || String.IsNullOrEmpty(Request["Index"]) || String.IsNullOrEmpty(Request["currentPage"]))
            {
                Response.Redirect("../Project/Default.aspx?MatchID=" + MatchID);
            }
            currentPage = 1;
            try
            {
                currentPage = Convert.ToInt32(Request["currentPage"]);
                index       = Convert.ToInt32(Request["Index"]);
            }
            catch
            {
                Response.Redirect("../Project/Default.aspx?MatchID=" + MatchID);
            }
            MatchID = Request["MatchID"];
            Match   = BLL.Match.SelectOne(Convert.ToInt32(MatchID));



            /*************根据模型*************************/
            if (Match.MatchModel == 1)
            {
                Projects = BLL.CupProjectModel.FindByInt(MatchID, "MatchID");
                for (int i = 0; i < Projects.Count; i++)
                {
                    CheckRecrod = BLL.CheckRecord.FindOne(Projects[i].ID.ToString(), Match.MatchModel.ToString());
                    if (CheckRecrod == null || CheckRecrod.AfterStatus != "初审通过")
                    {
                        Projects.RemoveAt(i);
                        i--;
                        continue;
                    }
                }
                ProjectCount = Projects.Count;
                try{
                    Project = Projects[Math.Max((currentPage - 1) * 10, 0) + (index - 1)];
                }
                catch
                {
                    Project = new Models.DB.CupProjectModel();
                }
                ProjectID = Project.ID.ToString();
                if (Project.PdfUrl != "")
                {
                    String swf = Project.PdfUrl.Substring(0, Project.PdfUrl.LastIndexOf('.'));
                    if (Utility.PDF2Swf.DoPDF2Swf(Server.MapPath(Project.PdfUrl), Server.MapPath(swf + ".swf")))
                    {
                        FilePath = ResolveUrl(swf + ".swf");
                        showPdf  = true;
                    }
                    else
                    {
                        Response.Write("<script language=\"javascript\" type=\"text/javascript\">");
                        Response.Write("alert(\"无法找到源文件\");");
                        Response.Write("</script>");
                        showPdf = false;
                        //     Response.Redirect("../Project/Default.aspx");
                    }
                }
                else
                {
                    showPdf = false;
                }
            }
            else if (Match.MatchModel == 2)
            {
                Innovations = BLL.InnovationProjectModel.FindByInt(MatchID, "MatchID");
                for (int i = 0; i < Innovations.Count; i++)
                {
                    CheckRecrod = BLL.CheckRecord.FindOne(Innovations[i].Id.ToString(), Match.MatchModel.ToString());
                    if (CheckRecrod == null || CheckRecrod.AfterStatus != "初审通过")
                    {
                        Innovations.RemoveAt(i);
                        i--;
                        continue;
                    }
                }
                ProjectCount = Innovations.Count;
                try
                {
                    Innovation = Innovations[Math.Max((currentPage - 1) * 10, 0) + (index - 1)];
                }
                catch
                {
                    Innovation = new Models.DB.InnovationProjectModel();
                }
                ProjectID = Innovation.Id.ToString();
                if (Innovation.PdfUrl != "")
                {
                    String swf = Innovation.ProjectDoc.Substring(0, Innovation.ProjectDoc.LastIndexOf('.'));
                    if (Utility.PDF2Swf.DoPDF2Swf(Server.MapPath(Innovation.ProjectDoc), Server.MapPath(swf + ".swf")))
                    {
                        FilePath = ResolveUrl(swf + ".swf");
                        showPdf  = true;
                    }
                    else
                    {
                        Response.Write("<script language=\"javascript\" type=\"text/javascript\">");
                        Response.Write("alert(\"无法找到源文件\");");
                        Response.Write("</script>");
                        showPdf = false;
                        //     Response.Redirect("../Project/Default.aspx");
                    }
                }
                else
                {
                    showPdf = false;
                }
            }
            /**************************************/



            if (Session["user"] == null)
            {
                Response.Redirect(ResolveUrl("~/Web/Login/Default.aspx"));
            }
            UserID    = Session["user"].ToString();
            JudgeList = BLL.JudgeInfoModel.FindByInt(UserID, "UserID");
            if (JudgeList.Count > 0)
            {
                Judge = JudgeList[0];
            }
            else
            {
                Judge = new Models.DB.JudgeInfoModel();
            }

            Score = BLL.ProjectScore.FindOne(ProjectID, Match.MatchModel.ToString(), Judge.Id.ToString());
            if (Score == null)
            {
                HasRecord = false;
                Score     = new Models.DB.ProjectScore();
            }
            else
            {
                HasRecord = true;
            }
        }