public static int Update(String AfterStatus, String Checker, String MatchModelID, String ProjectID, String Reason, String BeforeStatus, String ID) { #region 输入合法性检测 if (String.IsNullOrEmpty(AfterStatus) || String.IsNullOrEmpty(Checker) || String.IsNullOrEmpty(BeforeStatus)) { return(0); } int projectid, matchmodelid, id; try { id = Convert.ToInt32(ID); projectid = Convert.ToInt32(ProjectID); matchmodelid = Convert.ToInt32(MatchModelID); } catch { return(0); } #endregion #region 组装类 Models.DB.CheckRecord model = new Models.DB.CheckRecord(); model.AfterStatus = AfterStatus; model.BeforeStatus = BeforeStatus;; model.Checker = Checker; model.MatchModelID = matchmodelid; model.ProjectID = projectid; model.Reason = Reason; model.Time = System.DateTime.Now; model.Id = id; #endregion return(DAL.Update.ChangeSome(model, "Id")); }
public static int Create(String AfterStatus, String Checker, String MatchModelID, String ProjectID, String Reason) { #region 输入合法性检测 if (String.IsNullOrEmpty(AfterStatus) || String.IsNullOrEmpty(Checker)) { return(0); } int projectid, matchmodelid; try { projectid = Convert.ToInt32(ProjectID); matchmodelid = Convert.ToInt32(MatchModelID); } catch { return(0); } #endregion #region 组装类 Models.DB.CheckRecord model = new Models.DB.CheckRecord(); model.AfterStatus = AfterStatus; model.BeforeStatus = "提交"; model.Checker = Checker; model.MatchModelID = matchmodelid; model.ProjectID = projectid; model.Reason = Reason; model.Time = System.DateTime.Now; #endregion return(DAL.Create.CreateOne(model)); }
public static Models.DB.CheckRecord FindOne(String ProjectID, String MatchModelID) { #region 输入合法性检测 int projectid, matchmodelid; try { projectid = Convert.ToInt32(ProjectID); matchmodelid = Convert.ToInt32(MatchModelID); } catch { return(null); } #endregion #region 把数组组装成对象 DataTable dt = DAL.Select.FindCheckRecord(projectid, matchmodelid); if (dt.Rows.Count > 0) { Models.DB.CheckRecord model = new Models.DB.CheckRecord(); model.AfterStatus = dt.Rows[0]["AfterStatus"].ToString(); model.BeforeStatus = dt.Rows[0]["BeforeStatus"].ToString(); model.Checker = dt.Rows[0]["Checker"].ToString(); model.Id = Convert.ToInt32(dt.Rows[0]["Id"]); model.MatchModelID = Convert.ToInt32(dt.Rows[0]["MatchModelID"]); model.ProjectID = Convert.ToInt32(dt.Rows[0]["ProjectID"]); model.Reason = dt.Rows[0]["Reason"].ToString(); model.Time = Convert.ToDateTime(dt.Rows[0]["Time"]); return(model); } return(null); #endregion }
public void ProcessRequest(HttpContext context) { context.Response.ContentType = "text/plain"; string dowhat = context.Request["dowhat"]; #region 审核记录 if (dowhat == "CheckRecrod") { if (context.Session["user"] == null) { context.Response.Redirect("~/Web/Login/Default.aspx"); } String UserID = context.Session["user"].ToString(); String Checker = BLL.AdminModel.SelectAdminModelByUserID(UserID).Name; String ProjectID = context.Request["ProjectID"]; String MatchModelID = context.Request["MatchModelID"]; String AfterStatus = context.Request["Pass"]; String Reason = context.Request["Reason"]; Models.DB.CheckRecord model = BLL.CheckRecord.FindOne(ProjectID, MatchModelID); if (model == null) { if (BLL.CheckRecord.Create(AfterStatus, Checker, MatchModelID, ProjectID, Reason) > 0) { context.Response.Write("success"); } else { context.Response.Write("failed"); } context.Response.End(); return; } else { if (BLL.CheckRecord.Update(AfterStatus, Checker, MatchModelID, ProjectID, Reason, model.AfterStatus, model.Id.ToString()) > 0) { context.Response.Write("success"); } else { context.Response.Write("failed"); } context.Response.End(); return; } } #endregion }
protected void Page_Load(object sender, EventArgs e) { if (String.IsNullOrEmpty(Request["ProjectID"]) || String.IsNullOrEmpty(Request["type"])) { Response.Redirect("~/Web/Login/Default.aspx"); } String ModelType = Request["type"].ToString(); ProjectID = Request["ProjectID"].ToString(); if (ModelType == "CupProjectModel") { CupList = BLL.CupProjectModel.FindByInt(ProjectID, "ID"); if (CupList.Count <= 0) { Response.Redirect("../MyWorks/Default.aspx"); } ProjectName = CupList[0].Name; MatchModelID = "1"; } else if (ModelType == "InnovationProjectModel") { InnovationList = BLL.InnovationProjectModel.FindByInt(ProjectID.ToString(), "ID"); if (InnovationList.Count <= 0) { Response.Redirect("../MyWorks/Default.aspx"); } ProjectName = InnovationList[0].Name; MatchModelID = "2"; } CheckRecord = BLL.CheckRecord.FindOne(ProjectID, MatchModelID); if (CheckRecord == null) { CheckRecord = new Models.DB.CheckRecord(); CheckRecord.Time = System.DateTime.Now; CheckRecord.Reason = "无"; CheckRecord.Checker = "无"; CheckRecord.BeforeStatus = "无"; CheckRecord.AfterStatus = "无"; } }
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; } }
private void initData() { if (string.IsNullOrEmpty(Request["MatchID"])) { Response.Redirect("../Match/Default.aspx"); } MatchID = Request["MatchID"]; if (!string.IsNullOrEmpty(Request["page"])) { current_page = Convert.ToInt32(Request["page"].ToString()); } int matchid = 0; try { matchid = Convert.ToInt32(MatchID); } catch { Response.Redirect("../Match/Default.aspx"); } Match = BLL.Match.SelectOne(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; } TeamMemberCount.Add((int)BLL.CupTeamMemberInfo.CountByProjectID(Projects[i].ID + "")); Declarants.Add(BLL.CupDeclarantInfo.SelectOne(Projects[i].ID + "")); Students.Add(BLL.StudentInfoModel.SelectOneByUserId(Projects[i].UserID + "")); Recommenders.Add(BLL.RecommendInfo.SelectByProjectId(Projects[i].ID + "")); } page_count = (int)Math.Ceiling(Projects.Count / (double)page_size); // 获取总页数 if (current_page > page_count) { current_page = page_count; } if (current_page <= 0) { current_page = 1; } } 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; } TeamMemberCount.Add((int)BLL.InnovationTeamMember.CountByProjectID(Innovations[i].Id.ToString())); InovationDeclarants.Add(BLL.InnovationDeclarantInfo.SelectOne(Innovations[i].Id.ToString())); Students.Add(BLL.StudentInfoModel.SelectOneByUserId(Innovations[i].UserID.ToString())); Tutors.Add(BLL.Tutors.SelectByProjectId(Innovations[i].Id.ToString())); list = BLL.InnovationWorksInfo.FindByInt(Innovations[i].Id.ToString(), "ProjectID"); if (list.Count > 0) { InnovationWork = list[0]; } else { InnovationWork = new Models.DB.InnovationWorksInfo(); } } page_count = (int)Math.Ceiling(Innovations.Count / (double)page_size); if (current_page > page_count) { current_page = page_count; } if (current_page <= 0) { current_page = 1; } } }