protected void btnSub_Click(object sender, EventArgs e) { int id = Convert.ToInt32(Request.QueryString["id"].ToString()); string title = txtTitle.Text; string summary = txtSummary.Text; string body = UeditorHelper.Change(myEditor11.InnerHtml); if (title.Length == 0) { Response.Write("<script>alert('标题不能为空!');</script>"); } else if (summary.Length == 0) { Response.Write("<script>alert('内容摘要不能为空!');</script>"); } else if (body.Length == 0) { Response.Write("<script>alert('文章内容不能为空!');</script>"); } else { using (var db = new TeachingCenterEntities()) { var src = (from it in db.EducateSource where it.id == id select it).FirstOrDefault(); src.title = title; src.body = body; src.publish_time = pushlishTime.Value; src.summary = summary; db.SaveChanges(); Response.Write("<script>alert('修改成功!');location.href='EduSrcList.aspx';</script>"); } } }
protected void lbtnSubmit_Click(object sender, EventArgs e) { if (UpLoadFile() == false) { Response.Write("<script>alert('请上传项目文件!');</script>"); } else { int project_id = Convert.ToInt32(Request.QueryString["id"]); int stage = Convert.ToInt32(Request.QueryString["stage"]); using (var db = new TeachingCenterEntities()) { var project = (from it in db.ProjectStage where it.project_id == project_id && it.stage == stage select it).FirstOrDefault(); ProjectStage newStage = new ProjectStage(); newStage.project_id = project_id; newStage.project_content = UeditorHelper.Change(myEditor11.InnerHtml); newStage.project_file = "file/" + FileUp.PostedFile.FileName; newStage.stage = stage + 1; newStage.time = DateTime.Now.ToString("yyyy-MM-dd"); newStage.is_pass = -2; db.ProjectStage.Add(newStage); db.SaveChanges(); Response.Write("<script>location.href='MyProject.aspx?pageNumber=1';</script>"); } } }
protected void btnSub_Click(object sender, EventArgs e) { int id = Convert.ToInt32(Request.QueryString["id"].ToString()); string name = txtName.Text; string project_file = UpLoadFile(); string project_content = UeditorHelper.Change(myEditor11.InnerHtml); string time = txtTime.Text; string judge_time = txtJudgeTime.Text; string summary = txtSummary.Text; if (name.Length == 0) { Response.Write("<script>alert('项目类型名称不能为空!');</script>"); } else if (summary.Length == 0) { Response.Write("<script>alert('内容摘要不能为空!');</script>"); } else if (UpLoadFile() == "wrong") { Response.Write("<script>alert('请选择正确的文件!');</script>"); } else if (time == "" || judge_time == "") { Response.Write("<script>alert('截止时间不能为空!');</script>"); } else { using (var db = new TeachingCenterEntities()) { var pro_category = (from it in db.ProjectCategory where it.id == id select it).FirstOrDefault(); pro_category.name = name; if (project_file != "") { pro_category.project_file = "file/" + project_file; } pro_category.project_content = project_content; pro_category.end_time = time; pro_category.publish_time = pushlishTime.Value; pro_category.judge_end_time = judge_time; pro_category.summary = summary; db.SaveChanges(); Server.Transfer("ProCategoryList.aspx"); //Response.Write("<script>alert('修改成功!');location.href='ProCategoryList.aspx';</script>"); } } }
protected void btnSub_Click(object sender, EventArgs e) { string name = txtName.Text; string project_file = UpLoadFile(); string project_content = UeditorHelper.Change(myEditor11.InnerHtml); string time = txtTime.Text; string judge_time = txtJudgeTime.Text; string summary = txtSummary.Text; if (name.Length == 0) { Response.Write("<script>alert('项目类型名称不能为空!');</script>"); } else if (summary.Length == 0) { Response.Write("<script>alert('内容摘要不能为空!');</script>"); } else if (UpLoadFile() == "") { Response.Write("<script>alert('请选择正确的文件!');</script>"); } else if (time == "" || judge_time == "") { Response.Write("<script>alert('截止时间不能为空!');</script>"); } else { using (var db = new TeachingCenterEntities()) { ProjectCategory pro_category = new ProjectCategory(); pro_category.name = name; pro_category.category = getId(dropCategory.SelectedValue); pro_category.project_file = "file/" + project_file; pro_category.project_content = project_content; pro_category.stage = 0; pro_category.end_time = time; pro_category.judge_end_time = judge_time; pro_category.is_deleted = 0; pro_category.publish_time = DateTime.Now.ToString("yyyy-MM-dd"); pro_category.summary = summary; db.ProjectCategory.Add(pro_category); db.SaveChanges(); //Response.Write("<script>alert('提交成功!');location.href='ProCategoryList.aspx';</script>"); Server.Transfer("ProCategoryList.aspx"); } } }
protected void btnSubmit_Click(object sender, EventArgs e) { string name = txtName.Text; int teacher_id = TeacherHelper.getTeacherIDByNumber(Session["TeacherNumber"].ToString()); string fund = txtMoney.Text; Regex numRegex = new Regex(@"^\d+$"); string filePath = FileUp.PostedFile.FileName; if (name.Length == 0) { Response.Write("<script>alert('项目名称不能为空!');</script>"); } else if (fund.Length == 0) { Response.Write("<script>alert('资助金额不能为空!');</script>"); } else if (!numRegex.IsMatch(fund)) { Response.Write("<script>alert('请输入正确的资助金额!');</script>"); } //else if (UpLoadFile() == false) //Response.Write("<script>alert('请上传项目文件!');</script>"); else { using (var db = new TeachingCenterEntities()) { int project_id = Convert.ToInt32(Request.QueryString["id"]); Project project = (from it in db.Project where it.project_id == project_id select it).FirstOrDefault(); project.name = name; project.fund = fund; db.SaveChanges(); ProjectStage project_stage = (from it in db.ProjectStage where it.project_id == project_id orderby it.stage descending select it).FirstOrDefault(); project_stage.project_content = UeditorHelper.Change(myEditor11.InnerHtml); if (UpLoadFile() == true) { project_stage.project_file = "file/" + FileUp.PostedFile.FileName; } db.SaveChanges(); Response.Redirect("MyProject.aspx?pageNumber=1"); } } }
protected void btnSub_Click(object sender, EventArgs e) { string title = txtTitle.Text; string summary = txtSummary.Text; string body = UeditorHelper.Change(myEditor11.InnerHtml); if (title.Length == 0) { Response.Write("<script>alert('标题不能为空!');</script>"); } else if (summary.Length == 0) { Response.Write("<script>alert('内容摘要不能为空!');</script>"); } else if (body.Length == 0) { Response.Write("<script>alert('文章内容不能为空!');</script>"); } else { using (var db = new TeachingCenterEntities()) { EducateSource src = new EducateSource(); src.title = title; string cat = dropCategory.SelectedValue; src.category = getId(cat); src.body = body; src.publisher = "系统管理员"; src.publish_time = DateTime.Now.ToString("yyyy-MM-dd"); src.view_times = 0; src.is_deleted = 0; src.summary = summary; db.EducateSource.Add(src); db.SaveChanges(); Server.Transfer("EduSrcList.aspx"); // Response.Write("<script>alert('提交成功!');location.href='EduSrcList.aspx';</script>"); } } }
protected void btnSubmit_Click(object sender, EventArgs e) { string name = txtName.Text; int teacher_id = TeacherHelper.getTeacherIDByNumber(Session["TeacherNumber"].ToString()); string submit_time = DateTime.Now.ToString("yyyy-MM-dd"); string fund = txtMoney.Text; Regex numRegex = new Regex(@"^\d+$"); string filePath = FileUp.PostedFile.FileName; HtmlInputHidden category = FindControl("Selected") as HtmlInputHidden; if (category.Value == "") { Response.Write("<script>alert('项目类型不能为空!');</script>"); } else if (name.Length == 0) { Response.Write("<script>alert('项目名称不能为空!');</script>"); } else if (fund.Length == 0) { Response.Write("<script>alert('资助金额不能为空!');</script>"); } else if (!numRegex.IsMatch(fund)) { Response.Write("<script>alert('请输入正确的资助金额!');</script>"); } else if (filePath.Length == 0) { Response.Write("<script>alert('申请文档不能为空!');</script>"); } else if (UpLoadFile() == "wrong") { Response.Write("<script>alert('请上传正确的项目文件!');</script>"); } else { using (var db = new TeachingCenterEntities()) { Project project = new Project(); project.name = name; project.category = Convert.ToInt32(category.Value); project.teacher_id = teacher_id; project.submit_time = DateTime.Now.ToString("yyyy-MM-dd"); project.fund = fund; project.is_deleted = 0; db.Project.Add(project); db.SaveChanges(); ProjectStage project_stage = new ProjectStage(); project_stage.project_id = project.project_id; project_stage.project_file = "file/" + UpLoadFile(); project_stage.project_content = UeditorHelper.Change(myEditor11.InnerHtml); project_stage.stage = 0; project_stage.time = DateTime.Now.ToString("yyyy-MM-dd"); project_stage.is_pass = -2; db.ProjectStage.Add(project_stage); db.SaveChanges(); //Server.Transfer("MyProject.aspx?pageNumber=1"); Response.Write("<script>location.href='MyProject.aspx?pageNumber=1';</script>"); } } }