private void initData()
 {
     if (String.IsNullOrEmpty(Request["ProjectID"]) || String.IsNullOrEmpty(Request["MID"]))
     {
         Response.Redirect("Default.aspx");
     }
     ProjectID   = Request["ProjectID"].ToString();
     MatchID     = Request["MID"].ToString();
     Match       = BLL.Match.SelectOne(Convert.ToInt32(MatchID));
     Innovations = BLL.InnovationProjectModel.FindByInt(ProjectID, "Id");
     if (Innovations.Count > 0)
     {
         Innovation = Innovations[0];
     }
     else
     {
         Innovation = new Models.DB.InnovationProjectModel();
     }
     Declarant   = BLL.InnovationDeclarantInfo.SelectOne(ProjectID);
     TeamMembers = BLL.InnovationTeamMember.SelectByProjectId(ProjectID);
     Tutors      = BLL.Tutors.SelectByProjectId(ProjectID);
     Works       = BLL.InnovationWorksInfo.FindByInt(ProjectID, "ProjectID");
     if (Works.Count > 0)
     {
         WorkInfo = Works[0];
     }
     else
     {
         WorkInfo = new Models.DB.InnovationWorksInfo();
     }
     Student = BLL.StudentInfoModel.SelectOneByUserId(Innovation.UserID.ToString());
 }
        public static int Create(String MatchID, String Statu, String UserID, String Date, String StartTime, String EndTime)
        {
            #region 检查输入的合法性
            if (string.IsNullOrEmpty(Statu))
            {
                return(0);
            }
            int      matchid, userid;
            DateTime date, starttime, endtime;
            try
            {
                matchid   = Convert.ToInt32(MatchID);
                userid    = Convert.ToInt32(UserID);
                date      = Convert.ToDateTime(Date);
                starttime = Convert.ToDateTime(StartTime);
                endtime   = Convert.ToDateTime(EndTime);
            }
            catch
            {
                return(0);
            }
            #endregion

            #region 把数据组装成一个对象
            Models.DB.InnovationProjectModel model = new Models.DB.InnovationProjectModel();
            model.MatchID         = matchid;
            model.UserID          = userid;
            model.Statu           = Statu;
            model.DeclarationDate = date;
            model.StartTime       = starttime;
            model.EndTime         = endtime;
            #endregion

            return(DAL.Create.CreateOneReturnID(model));
        }
        public static List <Models.DB.InnovationProjectModel> SelectOnePage(int current_page, int page_size, string MatchId)
        {
            List <Models.DB.InnovationProjectModel> Projects = new List <Models.DB.InnovationProjectModel>();
            int matchId = 0;

            if (string.IsNullOrEmpty(MatchId))
            {
                return(Projects);
            }
            try
            {
                matchId = Convert.ToInt32(MatchId);
            }
            catch
            {
                return(Projects);
            }
            Models.DB.InnovationProjectModel Project = new Models.DB.InnovationProjectModel();
            Project.MatchID = matchId;
            Project.Statu   = "提交";
            string[] targets         = { "MatchID", "Statu" };
            System.Data.DataTable dt = DAL.Select.GetSome(Project, targets, page_size, current_page, "UserID", "asc");
            if (dt.Rows.Count > 0)
            {
                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    Models.DB.InnovationProjectModel e = new Models.DB.InnovationProjectModel();
                    e.Id                = Convert.ToInt32(dt.Rows[i]["ID"]);
                    e.Statu             = dt.Rows[i]["Statu"].ToString();
                    e.Name              = dt.Rows[i]["Name"].ToString();
                    e.MatchID           = Convert.ToInt32(dt.Rows[i]["MatchID"]);
                    e.DeclarationDate   = Convert.ToDateTime(dt.Rows[i]["DeclarationDate"]);
                    e.EndTime           = Convert.ToDateTime(dt.Rows[i]["EndTime"]);
                    e.StartTime         = Convert.ToDateTime(dt.Rows[i]["StartTime"]);
                    e.DeclarationType   = dt.Rows[i]["DeclarationType"].ToString();
                    e.InterimReport     = dt.Rows[i]["InterimReport"].ToString();
                    e.Managementbasis   = dt.Rows[i]["Managementbasis"].ToString();
                    e.PdfUrl            = dt.Rows[i]["PdfUrl"].ToString();
                    e.Remark            = dt.Rows[i]["Remark"].ToString();
                    e.SubmitAchievement = dt.Rows[i]["SubmitAchievement"].ToString();
                    e.UserID            = Convert.ToInt32(dt.Rows[i]["UserID"]);
                    Projects.Add(e);
                }
            }
            return(Projects);
        }
        public static int Updata(String ProjectID, String ProjectName, String DeclarationType, String StartTime, String EndTime, String InterimReport, String SubmitAchievement, String Managementbasis, String DeclarationDate, String MatchID, String UserID)
        {
            #region 输入合法性检测
            if (string.IsNullOrEmpty(DeclarationType) || string.IsNullOrEmpty(ProjectName))
            {
                return(0);
            }
            DateTime date, start, end;
            int      matchid;
            int      userid;
            try
            {
                date    = Convert.ToDateTime(DeclarationDate);
                start   = Convert.ToDateTime(StartTime);
                end     = Convert.ToDateTime(EndTime);
                matchid = Convert.ToInt32(MatchID);
                userid  = Convert.ToInt32(UserID);
            }
            catch
            {
                return(0);
            }
            #endregion

            #region 把数据组装成一个对象
            Models.DB.InnovationProjectModel model = new Models.DB.InnovationProjectModel();
            model.Name              = ProjectName;
            model.DeclarationDate   = date;
            model.DeclarationType   = DeclarationType;
            model.StartTime         = start;
            model.EndTime           = end;
            model.InterimReport     = InterimReport;
            model.Managementbasis   = Managementbasis;
            model.SubmitAchievement = SubmitAchievement;
            model.UserID            = userid;
            model.MatchID           = matchid;
            model.Id = Convert.ToInt32(ProjectID);
            if (model.Name == null)
            {
                model.Name = "未填写作品名称";
            }
            return(DAL.Update.ChangeSome(model, "Id"));

            #endregion
        }
        /// <summary>
        /// 更新Url
        /// </summary>
        /// <param name="Project"></param>
        /// <param name="FileOne"></param>
        public static int UpdataUrl(string ProjectID, string UrlPDF, string UrlWORD)
        {
            if (string.IsNullOrEmpty(ProjectID) || string.IsNullOrEmpty(UrlPDF) || string.IsNullOrEmpty(UrlWORD))
            {
                return(0);
            }

            List <Models.DB.InnovationProjectModel> Projects = FindByInt(ProjectID, "ID");

            if (Projects.Count > 0)
            {
                Models.DB.InnovationProjectModel Project = Projects[0];
                Project.PdfUrl     = UrlPDF;
                Project.ProjectDoc = UrlWORD;
                return(DAL.Update.ChangeSome(Project, "Id"));
            }
            return(0);
        }
        public static double CountByMatchId(string MatchId)
        {
            int matchId = 0;

            if (string.IsNullOrEmpty(MatchId))
            {
                return(0);
            }
            try
            {
                matchId = Convert.ToInt32(MatchId);
            }
            catch
            {
                return(0);
            }
            Models.DB.InnovationProjectModel Project = new Models.DB.InnovationProjectModel();
            Project.MatchID = matchId;
            return(DAL.Select.GetCount(Project, "MatchID"));
        }
        /// <summary>
        /// 单一条件查询Int型
        /// </summary>
        /// <param name="Value"></param>
        /// <param name="ValueName"></param>
        /// <returns></returns>
        public static List <Models.DB.InnovationProjectModel> FindByInt(String Value, String ValueName)
        {
            #region 输入合法性检查
            int valueInt;
            try
            {
                valueInt = Convert.ToInt32(Value);
            }
            catch
            {
                return(null);
            }
            #endregion

            List <Models.DB.InnovationProjectModel> list = new List <Models.DB.InnovationProjectModel>();


            DataTable dt = DAL.Select.QueryOne(valueInt, "Tb_InnovationProjectModel", ValueName);

            for (int i = 0; i < dt.Rows.Count; ++i)
            {
                Models.DB.InnovationProjectModel e = new Models.DB.InnovationProjectModel();
                e.Id                = Convert.ToInt32(dt.Rows[i]["ID"]);
                e.Statu             = dt.Rows[i]["Statu"].ToString();
                e.Name              = dt.Rows[i]["Name"].ToString();
                e.MatchID           = Convert.ToInt32(dt.Rows[i]["MatchID"]);
                e.DeclarationDate   = Convert.ToDateTime(dt.Rows[i]["DeclarationDate"]);
                e.EndTime           = Convert.ToDateTime(dt.Rows[i]["EndTime"]);
                e.StartTime         = Convert.ToDateTime(dt.Rows[i]["StartTime"]);
                e.DeclarationType   = dt.Rows[i]["DeclarationType"].ToString();
                e.InterimReport     = dt.Rows[i]["InterimReport"].ToString();
                e.Managementbasis   = dt.Rows[i]["Managementbasis"].ToString();
                e.PdfUrl            = dt.Rows[i]["PdfUrl"].ToString();
                e.Remark            = dt.Rows[i]["Remark"].ToString();
                e.SubmitAchievement = dt.Rows[i]["SubmitAchievement"].ToString();
                e.UserID            = Convert.ToInt32(dt.Rows[i]["UserID"]);
                e.ProjectDoc        = dt.Rows[i]["ProjectDoc"].ToString();
                list.Add(e);
            }
            return(list);
        }
Example #8
0
        private bool initData(string ProjectId)
        {
            List <Models.DB.InnovationProjectModel> Projects = BLL.InnovationProjectModel.FindByInt(ProjectId, "Id");

            if (Projects.Count <= 0)
            {
                return(false);
            }
            Project = Projects[0];
            Match   = BLL.Match.SelectOne(Project.MatchID);
            List <Models.DB.InnovationWorksInfo> WorksInfos = BLL.InnovationWorksInfo.FindByInt(ProjectId, "ProjectId");

            if (WorksInfos.Count > 0)
            {
                WorksInfo = WorksInfos[0];
            }
            TeamMembers = BLL.InnovationTeamMember.SelectByProjectId(ProjectId);
            Declarant   = BLL.InnovationDeclarantInfo.SelectOne(ProjectId);
            Tutors      = BLL.Tutors.SelectByProjectId(ProjectId);
            Student     = BLL.StudentInfoModel.SelectOneByUserId(Project.UserID + "");
            return(true);
        }
Example #9
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;
            }
        }
Example #10
0
        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "text/plain";
            string dowhat = context.Request["dowhat"];

            if (dowhat == null)
            {
                dowhat = "";
            }

            #region 确认提交
            if (dowhat == "SubmitProject")
            {
                String type      = context.Request["Type"].ToString();
                String ProjectID = context.Request["ProjectID"].ToString();



                if (type == "CupProjectModel")
                {
                    Models.DB.CupProjectModel Project = BLL.CupProjectModel.FindByInt(ProjectID, "ID")[0];
                    Models.DB.Match           Match   = BLL.Match.SelectOne(Convert.ToInt32(Project.MatchID));
                    if (Match == null)
                    {
                        return;
                    }
                    else if (System.DateTime.Compare(System.DateTime.Now, Match.DeclarantDeadLine) > 0)
                    {
                        context.Response.Write("deadline");
                        context.Response.End();
                        return;
                    }
                    if (Project.Statu == "提交")
                    {
                        context.Response.Write("Submited");
                        context.Response.End();
                        return;
                    }

                    if (BLL.CupProjectModel.UpdateStatus("提交", ProjectID) > 0)
                    {
                        context.Response.Write("success");
                    }
                    else
                    {
                        context.Response.Write("failed");
                    }
                    context.Response.End();
                    return;
                }
                else if (type == "InnovationProjectModel")
                {
                    Models.DB.InnovationProjectModel Project = BLL.InnovationProjectModel.FindByInt(ProjectID, "Id")[0];
                    Models.DB.Match Match = BLL.Match.SelectOne(Convert.ToInt32(Project.MatchID));
                    if (Match == null)
                    {
                        return;
                    }
                    else if (System.DateTime.Compare(System.DateTime.Now, Match.DeclarantDeadLine) > 0)
                    {
                        context.Response.Write("deadline");
                        context.Response.End();
                        return;
                    }
                    if (Project.Statu == "提交")
                    {
                        context.Response.Write("Submited");
                        context.Response.End();
                        return;
                    }
                    if (BLL.InnovationProjectModel.UpdateStatus("提交", ProjectID) > 0)
                    {
                        context.Response.Write("success");
                    }
                    else
                    {
                        context.Response.Write("failed");
                    }
                    context.Response.End();
                    return;
                }
            }
            #endregion


            #region  除项目
            if (dowhat == "DeleteProject")
            {
                String type      = context.Request["Type"].ToString();
                String ProjectID = context.Request["ProjectID"].ToString();

                if (type == "CupProjectModel")
                {
                    Models.DB.CupProjectModel Project = BLL.CupProjectModel.FindByInt(ProjectID, "ID")[0];
                    if (Project.Statu == "提交")
                    {
                        context.Response.Write("Submited");
                        context.Response.End();
                        return;
                    }
                    if (BLL.Delete.Word("Tb_CupProjectModel", ProjectID) > 0)
                    {
                        BLL.Delete.WordList(ProjectID, "Tb_CupProjectModel");
                        context.Response.Write("success");
                    }
                    else
                    {
                        context.Response.Write("failed");
                    }
                    context.Response.End();
                    return;
                }
                else if (type == "InnovationProjectModel")
                {
                    Models.DB.InnovationProjectModel Project = BLL.InnovationProjectModel.FindByInt(ProjectID, "Id")[0];
                    if (Project.Statu == "提交")
                    {
                        context.Response.Write("Submited");
                        context.Response.End();
                        return;
                    }
                    if (BLL.Delete.Word("Tb_InnovationProjectModel", ProjectID) > 0)
                    {
                        BLL.Delete.WordList(ProjectID, "Tb_InnovationProjectModel");
                        context.Response.Write("success");
                    }
                    else
                    {
                        context.Response.Write("failed");
                    }
                    context.Response.End();
                    return;
                }
            }
            #endregion
        }