protected void BindData() { int totalcount = 0; string strWhere = ""; string strSql = @" SELECT jc_LibraryExportLog.ID, jc_LibraryExportLog.SubjectName, jc_Library.LibraryName, jc_Library.SubjectNo, jc_Library.LibraryNo, jc_LibraryExportLog.CreateTime FROM dbo.jc_LibraryExportLog, dbo.jc_Library WHERE dbo.jc_LibraryExportLog.LibraryNo = dbo.jc_Library.LibraryNo "; if (ddl_subject.SelectedValue != "" && ddl_subject.SelectedValue != "0") { strWhere += " and jc_Library.SubjectNo='" + ddl_subject.SelectedValue + "' "; } if (ddl_Library.SelectedValue != "" && ddl_Library.SelectedValue != "0") { strWhere += " and dbo.jc_Library.LibraryNo=" + ddl_Library.SelectedValue; } jc_Public jcPublic = new jc_Public(); rptLibary.DataSource = jcPublic.GetList(strSql + strWhere, "CreateTime", AspNetPager1.CurrentPageIndex, AspNetPager1.PageSize, out totalcount); rptLibary.DataBind(); }
protected void Page_Load(object sender, EventArgs e) { jc_Public jcPublic = new jc_Public(); jc_System jcSystem = new jc_System(); if (!Page.IsPostBack) { var str = jcSystem.getLoginUser(); lbl_LoginUser.Text = jcPublic.GetTrueName(str); this.imgLogo.ImageUrl = weburl + "Theme/" + sysTheme + "/images/webLogo.gif"; Page.ClientScript.RegisterStartupScript(GetType(), "startscript", "<script type=\"text/javascript\" defer=\"defer\">$('[name=mutative]').show();</script>"); BindJSKP(); } }
public void ProcessRequest(HttpContext context) { evalItem evalItem = new evalItem(); JsonModel jsonModel = new JsonModel(); PagedDataModelNew<evalItem> jsonPagedDataModel = new PagedDataModelNew<evalItem>(); jc_Public jcPublic = new jc_Public(); jc_EvaluateCourse jcEvaluateCourseBF=new jc_EvaluateCourse(); int totalcount = 0; var evalCourseId = context.Request.QueryString["evalCourseId"]; var PageIndex = context.Request.QueryString["PageIndex"]; var PageSize = context.Request.QueryString["PageSize"]; if (string.IsNullOrEmpty(evalCourseId) || string.IsNullOrEmpty(PageIndex) || string.IsNullOrEmpty(PageSize)) { jsonModel.Status = "0"; jsonModel.Message = "缺少必要参数!"; } else { jsonPagedDataModel.EvaluateCourse=jcEvaluateCourseBF.GetModel(int.Parse(evalCourseId)); string strWhere = "and c.evalCourseId=" + evalCourseId ; string strSql = @" SELECT c.evalCourseId, c.evalSurveryId, c.evalCourseName, s.evalSurveryName, m.evalItemName, d.evalItemName as evalItemCategory, m.evalItemId FROM jc_EvaluateCourse c, jc_EvaluateSurvey s, jc_EvaluateSurveyItem i, jc_EvaluateItem m, jc_EvaluateItem d WHERE c.evalSurveryId = s.evalSurveryId AND s.evalSurveryId = i.evalSurveryId AND i.evalItemId = m.evalItemId AND m.evalParentItemId=d.evalItemId "; jsonPagedDataModel.PagedData = evalItem.GetEvalItemList(jcPublic.GetList(strSql + strWhere, "evalItemId", int.Parse(PageIndex), int.Parse(PageSize), out totalcount).Tables[0]); jsonPagedDataModel.PageCount = totalcount / int.Parse(PageSize); jsonPagedDataModel.PageIndex = int.Parse(PageIndex); jsonPagedDataModel.RowCount = totalcount; jsonModel.Data = jsonPagedDataModel; jsonModel.Status = "1"; jsonModel.Message = "查询成功!"; } var js = new JavaScriptSerializer(); context.Response.Write(js.Serialize(jsonModel)); }
public void BindJSKP() { int totalcount = 0; string strWhere = "and u.evalUserId= (select id from jc_User where UserIdCard='" + HttpContext.Current.Session["UserIdCard"].ToString() + "') and u.evalStatus=" + ddl_Type.SelectedValue; string strSql = @" SELECT u.evalUserId, c.evalCourseName, c.evalCourseTeacher,c.evalCourseContent, c.evalCourseDate,u.evalStatus,c.evalCourseId, c.evalSurveryId,u.evalCourseUserId FROM jc_EvaluateCourseUser u, jc_EvaluateCourse c WHERE u.evalCourseId = c.evalCourseId "; jc_Public jcPublic = new jc_Public(); rpjskp.DataSource = jcPublic.GetList(strSql + strWhere, "evalUserId", AspNetPager1.CurrentPageIndex, AspNetPager1.PageSize, out totalcount); rpjskp.DataBind(); lbl_Count.Text = totalcount.ToString(); }
public void BindData(string courseDate, string courseDate2, string courseTeacher, string courseContents, string surveryId) { int totalcount = 0; string strSql = @" SELECT u.evalUserId, c.evalCourseName, c.evalCourseTeacher,c.evalCourseContent, c.evalCourseDate,u.evalStatus,c.evalCourseId, c.evalSurveryId,u.evalCourseUserId FROM jc_EvaluateCourseUser u, jc_EvaluateCourse c WHERE u.evalCourseId = c.evalCourseId and u.evalStatus=1 "; if (!string.IsNullOrEmpty(courseTeacher)) { strSql += " and c.evalCourseTeacher like '" + courseTeacher + "'"; } if (!string.IsNullOrEmpty(courseDate)) { strSql += "and c.evalCourseDate>='" + courseDate + "'"; } if (!string.IsNullOrEmpty(courseDate2)) { strSql += "and c.evalCourseDate<='" + courseDate2 + "'"; } if (!string.IsNullOrEmpty(courseContents)) { strSql += " and c.evalCourseTeacher like '%" + courseContents + "%'"; } if (surveryId != "-1") { strSql += " and c.evalSurveryId = " + surveryId + ""; } jc_Public jcPublic = new jc_Public(); rptEvalList.DataSource = jcPublic.GetList(strSql, "evalCourseName", AspNetPager1.CurrentPageIndex, AspNetPager1.PageSize, out totalcount); lblevalCount.Text = totalcount.ToString(); rptEvalList.DataBind(); AspNetPager1.RecordCount = totalcount; if (totalcount > AspNetPager1.PageSize) { Pan_Page.Visible = true; } }
public void BindJSKPItem() { var evalCourseId = Request.QueryString["evalCourseId"]; var strSql = @" SELECT c.evalCourseId , c.evalSurveryId , c.evalCourseName , s.evalSurveryName , m.evalItemName , m.evalItemId FROM jc_EvaluateCourse c , jc_EvaluateSurvey s , jc_EvaluateSurveyItem i , jc_EvaluateItem m WHERE c.evalSurveryId = s.evalSurveryId AND s.evalSurveryId = i.evalSurveryId AND i.evalItemId = m.evalItemId AND c.evalCourseId=" + evalCourseId; var jcPublic = new jc_Public(); rpjskp.DataSource = jcPublic.GetList(strSql, "evalItemId", 1, int.MaxValue, out totalcount); rpjskp.DataBind(); }
public void ProcessRequest(HttpContext context) { evalCourse evalCourse = new evalCourse(); JsonModel jsonModel = new JsonModel(); PagedDataModel<evalCourse> jsonPagedDataModel = new PagedDataModel<evalCourse>(); jc_Public jcPublic = new jc_Public(); int totalcount = 0; var userId = context.Request.QueryString["userId"]; var evalStatus = context.Request.QueryString["evalStatus"]; var PageIndex = context.Request.QueryString["PageIndex"]; var PageSize = context.Request.QueryString["PageSize"]; if (string.IsNullOrEmpty(userId) || string.IsNullOrEmpty(evalStatus) || string.IsNullOrEmpty(PageIndex) || string.IsNullOrEmpty(PageSize)) { jsonModel.Status = "0"; jsonModel.Message = "缺少必要参数!"; } else { string strWhere = "and u.evalUserId=" + userId + " and u.evalStatus=" + evalStatus; string strSql = @" SELECT u.evalUserId, c.evalCourseName, c.evalCourseTeacher, c.evalCourseDate,u.evalStatus,c.evalCourseId, c.evalSurveryId FROM jc_EvaluateCourseUser u, jc_EvaluateCourse c WHERE u.evalCourseId = c.evalCourseId "; jsonPagedDataModel.PagedData = evalCourse.GetevalCourseList(jcPublic.GetList(strSql + strWhere, "evalUserId", int.Parse(PageIndex), int.Parse(PageSize), out totalcount).Tables[0]); jsonPagedDataModel.PageCount = totalcount / int.Parse(PageIndex); jsonPagedDataModel.PageIndex = int.Parse(PageIndex); jsonPagedDataModel.RowCount = totalcount; jsonModel.Data = jsonPagedDataModel; jsonModel.Status = "1"; jsonModel.Message = "查询成功!"; } var js = new JavaScriptSerializer(); context.Response.Write(js.Serialize(jsonModel)); }
protected void btnExportAll_Click(object sender, EventArgs e) { int totalcount = 0; string strSql = @" SELECT u.evalUserId, c.evalCourseName, c.evalCourseTeacher,c.evalCourseContent, c.evalCourseDate,u.evalStatus,c.evalCourseId, c.evalSurveryId,u.evalCourseUserId FROM jc_EvaluateCourseUser u, jc_EvaluateCourse c WHERE u.evalCourseId = c.evalCourseId and u.evalStatus=1 "; if (!string.IsNullOrEmpty(txtCourseDate.Text)) { strSql += " and c.evalCourseTeacher like '" + txtCourseDate.Text + "'"; } if (!string.IsNullOrEmpty(txtCourseDate.Text)) { strSql += "and c.evalCourseDate>='" + txtCourseDate.Text + "'"; } if (!string.IsNullOrEmpty(txtCourseDate2.Text)) { strSql += "and c.evalCourseDate<='" + txtCourseDate2.Text + "'"; } if (!string.IsNullOrEmpty(txtCourseTeacher.Text)) { strSql += " and c.evalCourseTeacher like '%" + txtCourseTeacher.Text + "%'"; } if (ddlSurvery.SelectedValue != "-1") { strSql += " and c.evalSurveryId = " + ddlSurvery.SelectedValue + ""; } jc_Public jcPublic = new jc_Public(); DataTable dt = jcPublic.GetList(strSql, "evalCourseName", 1, int.MaxValue, out totalcount).Tables[0]; StringBuilder sb = new StringBuilder(); for (int i = 0; i < dt.Rows.Count; i++) { HtmlDocument doc = new HtmlDocument(); doc.LoadHtml(GetPrintContents(dt.Rows[i]["evalUserId"].ToString(), dt.Rows[i]["evalCourseUserId"].ToString(), dt.Rows[i]["evalCourseId"].ToString())); sb.Append(doc.DocumentNode.SelectSingleNode("//div[@class='maincontant']").InnerHtml); if (i < dt.Rows.Count - 1) { sb.Append("<br clear=all style='page-break-before:always' mce_style='page-break-before:always'>"); } } string path = Server.MapPath("ExportTemplate.txt"); string strtemplate = File.ReadAllText(path, Encoding.Default); string result = strtemplate.Replace("@", sb.ToString()); var str = "Export_" + DateTime.Now.ToString("yyyy-MM-dd_HHmmss") + ".doc"; HttpContext.Current.Response.Charset = "GB2312"; HttpContext.Current.Response.ContentEncoding = Encoding.GetEncoding("gb2312"); //注意编码 HttpContext.Current.Response.AppendHeader("Content-Disposition", "attachment;filename=" + HttpUtility.UrlEncode(str, Encoding.UTF8)); HttpContext.Current.Response.ContentType = "application/application/ms-word"; HttpContext.Current.Response.Write(result.ToString()); HttpContext.Current.Response.Flush(); HttpContext.Current.Response.End(); }