public int getPaperCount(PaperList paperList) { StringBuilder sbSI = new StringBuilder(); sbSI.AppendFormat("select paper.* ,menu.MenuName from paper LEFT JOIN menu ON paper.Type=menu.Id Where 1=1 "); if (!string.IsNullOrEmpty(paperList.Number)) { sbSI.AppendFormat("AND VERSION LIKE '%{0}%'", paperList.Number); } if (!string.IsNullOrEmpty(paperList.Title)) { sbSI.AppendFormat("AND TITLE LIKE '%{0}%'", paperList.Title); } if (paperList.Type != 0) { sbSI.AppendFormat("AND paper.TYPE = '{0}'", paperList.Type); } if (paperList.StTime > DateTime.MinValue && paperList.EdTime > DateTime.MinValue) { sbSI.AppendFormat("AND CreateDate BETWEEN '{0}' AND '{1}'", paperList.StTime, paperList.EdTime); } DataTable dtBusiness = DBHelper.SearchSql(sbSI.ToString()); return(dtBusiness.Rows.Count); }
private void GetMail() { string receiverid = Request.Cookies["id"].Value.ToString(); string mailtype = "正式论文"; Fannie.Mail ml = new Fannie.Mail(); DataTable dt = new DataTable(); DataSet ds = ml.GetMail("2", receiverid, mailtype); DataColumn dc = new DataColumn(); dc.ColumnName = "DataNo"; ds.Tables[0].Columns.Add(dc); for (int i = 0; i < ds.Tables[0].Rows.Count; i++) { ds.Tables[0].Rows[i]["DataNo"] = (i + 1).ToString(); } PaperList.DataKeyNames = new string[] { "MailNo" }; PaperList.DataSource = ds; PaperList.DataBind(); dt = ds.Tables[0]; if (dt.Rows.Count == 0) { Label1.Visible = true; } else { Label1.Visible = false; } }
public PaperInfoList getPaperList(PaperList paperList) { PaperInfoList paperInfoList = new PaperInfoList(); DataTable dt = adminDAL.getPaperList(paperList); paperInfoList.rows = dt.toList <PaperInfo>(); paperInfoList.total = adminDAL.getPaperCount(paperList); return(paperInfoList); }
public ActionResult SearchPaper(PaperList paperList) { paperList.page = int.Parse(Request["page"]); paperList.rows = int.Parse(Request["rows"]); AdminBLL adminBLL = new AdminBLL(); PaperInfoList paperInfoList = adminBLL.getPaperList(paperList); return(Json(paperInfoList, JsonRequestBehavior.AllowGet)); }
private PaperList FilterPaperList(PaperList paperlist, List <List <string> > filters) { foreach (Paper paper in paperlist.paperlist) { List <string> institutes = new List <string>(); for (int index = 0; index < paper.Institutes.Count; index++) { for (int iindex = 0; iindex < filters.Count; iindex++) { if (StringUtil.Contains(paper.Institutes[index], filters[iindex])) { institutes.Add(paper.Institutes[index]); } } } paper.Institutes = institutes; } return(paperlist); }
private void btnSaveData_Click(object sender, EventArgs e) { if (dgvInstituteDataTable.Rows.Count == 0) { MessageBox.Show("数据为空,无效操作"); return; } string filter = txtFilterInstitute.Text.Trim(); List <List <string> > filters = new List <List <string> >(); if (cbxFilterInstitute.Checked) { filters = InitalFilter(filter); } DialogResult dialogresult = fbdOutputData.ShowDialog(); if (dialogresult == DialogResult.OK) { #region 初始化InstituteMatch InstiuteMatch institute = new InstiuteMatch(); string subjectfilter = txtSubjectFilter.Text.Trim(); foreach (DataGridViewRow row in dgvInstituteDataTable.Rows) { string value = row.Cells[2].Value != null ? row.Cells[2].Value.ToString() : ""; if (value.Length > 0) { //根据subjectfilter来选择需要导出的学科 string[] temps = value.ToString().Split(';'); foreach (var item in temps) { if (item == subjectfilter) { institute.Add((string)row.Cells[0].Value, (string)row.Cells[1].Value); break; } } } } #endregion PaperList paperlist = new PaperList(institute); foreach (var file in memoryFilenames) { paperlist.Clear(); paperlist.ReadFile(file, fileformat); if (filters != null && filters.Count > 0) { paperlist = FilterPaperList(paperlist, filters); } paperlist.MatchPaperList(); if (paperlist.paperlist.Count == 0) { AddLog("无匹配数据:" + file); } else { //将输出的数据量也保存在文件名中 string filename = fbdOutputData.SelectedPath + "\\" + GetOutputFilename("_" + paperlist.paperlist.Count.ToString() + "_", file); using (System.IO.StreamWriter writer = new System.IO.StreamWriter(filename)) { writer.Write(paperlist.ToString()); writer.Flush(); writer.Close(); AddLog("数据导出[" + paperlist.paperlist.Count.ToString() + "]:" + filename); } } } MessageBox.Show("数据保存成功"); } }