protected void Page_Load(object sender, EventArgs e) { if (Context.Session["user"] == null) { Response.Redirect("~/Web/Login/Default.aspx"); } String UserID = Context.Session["user"].ToString(); Judge = BLL.JudgeInfoModel.FindByInt(UserID, "UserId")[0]; MatchJudgeList = BLL.MatchJuryRelation.FindJudgeMatch(Judge.Id.ToString()); if (!string.IsNullOrEmpty(Request["page"])) { current_page = Convert.ToInt32(Request["page"].ToString()); } PageSum = MatchJudgeList.Count; page_count = (int)Math.Ceiling(PageSum / (double)page_size); if (current_page <= 0) { current_page = 1; } if (current_page > page_count) { current_page = page_count; } }
/// <summary> /// 获取一页记录 /// </summary> /// <param name="Page"></param> /// <param name="PageSize"></param> /// <returns></returns> public static List <Models.DB.JudgeInfoModel> SelectOnePage(int Page, int PageSize) { List <Models.DB.JudgeInfoModel> Judges = new List <Models.DB.JudgeInfoModel>(); Models.DB.JudgeInfoModel Judge = new Models.DB.JudgeInfoModel(); System.Data.DataTable dt = DAL.Select.GetSome("Tb_JudgeInfoModel", PageSize, Page, "Id", ""); if (dt.Rows.Count > 0) { for (int i = 0; i < dt.Rows.Count; i++) { Judge = new Models.DB.JudgeInfoModel(); Judge.WorkUnits = dt.Rows[i]["WorkUnits"].ToString(); Judge.Address = dt.Rows[i]["Address"].ToString(); Judge.Background = dt.Rows[i]["Background"].ToString(); Judge.CampusId = dt.Rows[i]["CampusId"].ToString(); Judge.College = dt.Rows[i]["College"].ToString(); Judge.JobId = dt.Rows[i]["JobId"].ToString(); Judge.Mail = dt.Rows[i]["Mail"].ToString(); Judge.Phone = dt.Rows[i]["Phone"].ToString(); Judge.RealName = dt.Rows[i]["RealName"].ToString(); Judge.Research = dt.Rows[i]["Research"].ToString(); Judge.Sex = dt.Rows[i]["Sex"].ToString(); Judge.Title = dt.Rows[i]["Title"].ToString(); Judge.UserId = Convert.ToInt32(dt.Rows[i]["UserId"]); Judge.Id = Convert.ToInt32(dt.Rows[i]["Id"]); Judges.Add(Judge); } } return(Judges); }
public static int UpdateJudgeInfoModel(string Id, string Name, string Address, string WorkUnits, string Title, string College, string Mail, string Phone, string Sex, string Background, string Research, string JobId, string CampusId, string UserId) { int id; int userId; #region 检查输入 if (string.IsNullOrEmpty(Id) || string.IsNullOrEmpty(Name) || string.IsNullOrEmpty(JobId) || string.IsNullOrEmpty(CampusId) || string.IsNullOrEmpty(College) || string.IsNullOrEmpty(Sex) || string.IsNullOrEmpty(UserId)) { return(0); } try { id = Convert.ToInt32(Id); userId = Convert.ToInt32(UserId); } catch { return(0); } if (Name.Length >= 255 || JobId.Length >= 255 || CampusId.Length >= 255 || College.Length >= 255 || Sex.Length >= 255) { return(0); } #endregion #region 封装数据 Models.DB.JudgeInfoModel Judge = new Models.DB.JudgeInfoModel(); Judge.Address = Address; Judge.Background = Background; Judge.CampusId = CampusId; Judge.College = College; Judge.JobId = JobId; Judge.Mail = Mail; Judge.Phone = Phone; Judge.RealName = Name; Judge.Research = Research; Judge.Sex = Sex; Judge.Title = Title; Judge.UserId = userId; Judge.WorkUnits = WorkUnits; Judge.Id = id; return(DAL.Update.ChangeSome(Judge, "Id")); #endregion }
private void initData() { int Id = 0; if (Request["judge"] != null) { try { Id = Convert.ToInt32(Request["judge"]); Judge = BLL.JudgeInfoModel.SelectOne(Id); return; } catch { } } Response.Redirect("../Judge"); }
private void initData() { if (Session["user"] == null || Session["role"] == 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 { Response.Redirect(ResolveUrl("~/Web/Login/Default.aspx")); } }
protected void Page_Load(object sender, EventArgs e) { accessControl(); if (Request["edit"] == null) { Response.Redirect("Default.aspx"); return; } try { int Id = Convert.ToInt32(Request["edit"]); Judge = BLL.JudgeInfoModel.SelectOne(Id); user = BLL.User.SelectUserOne(Judge.UserId); } catch { Response.Redirect("Default.aspx"); } }
public static List <Models.DB.JudgeInfoModel> FindByInt(String Value, String ValueName) { #region 输入合法性检查 int valueInt; try { valueInt = Convert.ToInt32(Value); } catch { return(null); } #endregion List <Models.DB.JudgeInfoModel> list = new List <Models.DB.JudgeInfoModel>(); DataTable dt = DAL.Select.QueryOne(valueInt, "Tb_JudgeInfoModel", ValueName); for (int i = 0; i < dt.Rows.Count; ++i) { Models.DB.JudgeInfoModel Judge = new Models.DB.JudgeInfoModel(); Judge.WorkUnits = dt.Rows[i]["WorkUnits"].ToString(); Judge.Address = dt.Rows[i]["Address"].ToString(); Judge.Background = dt.Rows[i]["Background"].ToString(); Judge.CampusId = dt.Rows[i]["CampusId"].ToString(); Judge.College = dt.Rows[i]["College"].ToString(); Judge.JobId = dt.Rows[i]["JobId"].ToString(); Judge.Mail = dt.Rows[i]["Mail"].ToString(); Judge.Phone = dt.Rows[i]["Phone"].ToString(); Judge.RealName = dt.Rows[i]["RealName"].ToString(); Judge.Research = dt.Rows[i]["Research"].ToString(); Judge.Sex = dt.Rows[i]["Sex"].ToString(); Judge.Title = dt.Rows[i]["Title"].ToString(); Judge.UserId = Convert.ToInt32(dt.Rows[i]["UserId"]); Judge.Id = Convert.ToInt32(dt.Rows[i]["Id"]); list.Add(Judge); } return(list); }
/// <summary> /// 插入一条记录 /// </summary> public static int CreateJudgeInfoModel(string Name, string Address, string WorkUnits, string Title, string College, string Mail, string Phone, string Sex, string Background, string Research, string JobId, string CampusId, int UserId) { #region 检查输入 if (string.IsNullOrEmpty(Name) || string.IsNullOrEmpty(Address) || string.IsNullOrEmpty(WorkUnits) || string.IsNullOrEmpty(Title) || string.IsNullOrEmpty(Background) || string.IsNullOrEmpty(Research) || string.IsNullOrEmpty(JobId) || string.IsNullOrEmpty(CampusId) || string.IsNullOrEmpty(College) || string.IsNullOrEmpty(Mail) || string.IsNullOrEmpty(Phone) || string.IsNullOrEmpty(Sex)) { return(0); } if (Name.Length >= 255 || Address.Length >= 255 || WorkUnits.Length >= 255 || Title.Length >= 255 || Background.Length >= 255 || Phone.Length >= 255 || Research.Length >= 255 || JobId.Length >= 255 || CampusId.Length >= 255 || College.Length >= 255 || Mail.Length >= 255 || Sex.Length >= 255) { return(0); } #endregion #region 封装数据 Models.DB.JudgeInfoModel Judge = new Models.DB.JudgeInfoModel(); Judge.Address = Address; Judge.Background = Background; Judge.CampusId = CampusId; Judge.College = College; Judge.JobId = JobId; Judge.Mail = Mail; Judge.Phone = Phone; Judge.RealName = Name; Judge.Research = Research; Judge.Sex = Sex; Judge.Title = Title; Judge.UserId = UserId; Judge.WorkUnits = WorkUnits; return(DAL.Create.CreateOne(Judge)); #endregion }
public static List <Models.DB.JudgeInfoModel> SelectJudges(int MatchId) { List <Models.DB.JudgeInfoModel> Judges = new List <Models.DB.JudgeInfoModel>(); Models.DB.JudgeInfoModel Judge = new Models.DB.JudgeInfoModel(); Models.DB.MatchJuryRelation MatchJuryRelation = new Models.DB.MatchJuryRelation(); MatchJuryRelation.MatchId = MatchId; System.Data.DataTable dt = DAL.Select.GetList(MatchJuryRelation, "MatchId"); System.Data.DataTable dtJudge; if (dt.Rows.Count > 0) { for (int i = 0; i < dt.Rows.Count; i++) { int Id = Convert.ToInt32(dt.Rows[i]["JudgeId"]); dtJudge = DAL.Select.GetOne("Tb_JudgeInfoModel", Id); if (dtJudge.Rows.Count > 0) { Judge = new Models.DB.JudgeInfoModel(); Judge.WorkUnits = dtJudge.Rows[0]["WorkUnits"].ToString(); Judge.Address = dtJudge.Rows[0]["Address"].ToString(); Judge.Background = dtJudge.Rows[0]["Background"].ToString(); Judge.CampusId = dtJudge.Rows[0]["CampusId"].ToString(); Judge.College = dtJudge.Rows[0]["College"].ToString(); Judge.JobId = dtJudge.Rows[0]["JobId"].ToString(); Judge.Mail = dtJudge.Rows[0]["Mail"].ToString(); Judge.Phone = dtJudge.Rows[0]["Phone"].ToString(); Judge.RealName = dtJudge.Rows[0]["RealName"].ToString(); Judge.Research = dtJudge.Rows[0]["Research"].ToString(); Judge.Sex = dtJudge.Rows[0]["Sex"].ToString(); Judge.Title = dtJudge.Rows[0]["Title"].ToString(); Judge.UserId = Convert.ToInt32(dtJudge.Rows[0]["UserId"]); Judge.Id = Convert.ToInt32(dtJudge.Rows[0]["Id"]); Judges.Add(Judge); } } } return(Judges); }
public static Models.DB.JudgeInfoModel SelectOne(int id) { Models.DB.JudgeInfoModel Judge = null; System.Data.DataTable dt = DAL.Select.GetOne("Tb_JudgeInfoModel", id); if (dt.Rows.Count > 0) { Judge = new Models.DB.JudgeInfoModel(); Judge.WorkUnits = dt.Rows[0]["WorkUnits"].ToString(); Judge.Address = dt.Rows[0]["Address"].ToString(); Judge.Background = dt.Rows[0]["Background"].ToString(); Judge.CampusId = dt.Rows[0]["CampusId"].ToString(); Judge.College = dt.Rows[0]["College"].ToString(); Judge.JobId = dt.Rows[0]["JobId"].ToString(); Judge.Mail = dt.Rows[0]["Mail"].ToString(); Judge.Phone = dt.Rows[0]["Phone"].ToString(); Judge.RealName = dt.Rows[0]["RealName"].ToString(); Judge.Research = dt.Rows[0]["Research"].ToString(); Judge.Sex = dt.Rows[0]["Sex"].ToString(); Judge.Title = dt.Rows[0]["Title"].ToString(); Judge.UserId = Convert.ToInt32(dt.Rows[0]["UserId"]); Judge.Id = Convert.ToInt32(dt.Rows[0]["Id"]); } return(Judge); }
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; } }