/// <summary> /// 获取页面中的信息 /// </summary> /// <returns>一个索引目录对象</returns> private WWHY_SYML GetWWHY_SYML() { WWHY_SYML wwhySYML = new WWHY_SYML(); //分类编码 wwhySYML.flbm = this.flbmTextBox.Text.Trim(); //索引编码 wwhySYML.sybm = this.sybmTextBox.Text.Trim(); //文种 wwhySYML.wz = this.wzTextBox.Text.Trim(); //年份 try { wwhySYML.nf = Int32.Parse(this.nfTextBox.Text.Trim()); } catch (Exception) { } //中文名称 wwhySYML.zwmc = this.zwmcTextBox.Text.Trim(); //外文名称 wwhySYML.wwmc = this.wwmcTextBox.Text.Trim(); //主办单位 wwhySYML.zbdw=this.zbdwTextBox.Text.Trim(); //承办单位 wwhySYML.cbdw= this.cbdwTextBox.Text.Trim(); //出版单位 wwhySYML.chbdw=this.chbdwTextBox.Text.Trim(); try { //发布日期 wwhySYML.fbrq = DateTime.Parse(this.fbrqTextBox.Text.Trim()); } catch (Exception) { } //会议地点 wwhySYML.hydd=this.hyddTextBox.Text.Trim(); //简介 wwhySYML.jj=this.jjTextBox.Text.Trim(); //馆藏号 wwhySYML.gch=this.gchTextBox.Text.Trim(); //国图分类 wwhySYML.gtfl = this.gtflTextBox.Text.Trim(); try { //登录日期 wwhySYML.dlrq = DateTime.Parse(this.dlrqTextBox.Text); } catch (Exception) { } return wwhySYML; }
/// <summary> /// 按索引编码更新索引目录信息。 /// 索引编码为主键。 /// </summary> /// <param name="syml"></param> /// <returns></returns> public bool updateWwhySYMLBySYBM(WWHY_SYML syml) { bool result; try { sqlMapper.BeginTransaction(); sqlMapper.Update("UpdateWWHY_SYML", syml); sqlMapper.CommitTransaction(); result = true; } catch { sqlMapper.RollBackTransaction(); result = false; } return result; }
protected override SYML getSyml(OleDbDataReader reader, out string err) { err = String.Empty; WWHY_SYML syml = new WWHY_SYML(); syml.flbm = reader["分类编码"].ToString().Trim(); syml.sybm = reader["索引编码"].ToString().Trim(); syml.wz = reader["文种"].ToString().Trim(); try { syml.nf = int.Parse(reader["年份"].ToString()); } catch (Exception) { syml.nf = 0; err += syml.flbm + ":" + syml.wwmc + ": 年份\"" + reader["年份"] + "\"出错,置为0\n"; } syml.zwmc = reader["中文名称"].ToString().Trim(); syml.wwmc = reader["外文名称"].ToString().Trim(); syml.zbdw = reader["主办单位"].ToString().Trim(); syml.cbdw = reader["承办单位"].ToString().Trim(); syml.chbdw = reader["出版单位"].ToString().Trim(); try { if (String.Empty.Equals(reader["发布日期"].ToString().Trim())) { err += syml.flbm + ":" + syml.wwmc + ":发布日期为空\n"; syml.fbrq = DateTime.MinValue; } else syml.fbrq = DateTime.Parse(reader["发布日期"].ToString().Trim()); } catch { err += syml.flbm + ":" + syml.wwmc + ": 发布日期\"" + reader["发布日期"] + "\"出错\n"; } syml.gtfl = reader["国图分类"].ToString().Trim(); syml.hydd = reader["会议地点"].ToString().Trim(); syml.jj = reader["简介"].ToString().Trim(); syml.gch = reader["馆藏号"].ToString().Trim(); syml.dlrq = DateTime.Now; syml.fillEmptyStringAsNull(); return syml; }
/// <summary> /// 插入外文会议索引目录信息。 /// </summary> /// <param name="syml"></param> public void insertWwhySYML(WWHY_SYML syml) { sqlMapper.Insert("InsertWWHY_SYML", syml); }
protected override PM getPM(OleDbDataReader reader, out String err) { err = String.Empty; WWHY_PM pm = new WWHY_PM(); if (hasFormatTable) { pm.sybm = reader["索引编码"].ToString().Trim(); pm.wjm = reader["文件名"].ToString().Trim(); pm.zwpm = reader["中文篇名"].ToString().Trim(); pm.wwpm = reader["外文篇名"].ToString().Trim(); pm.zz = reader["作者"].ToString().Trim(); pm.zzdw = reader["作者单位"].ToString().Trim(); pm.zwwz = reader["中文文摘"].ToString().Trim(); pm.wwwz = reader["外文文摘"].ToString().Trim(); pm.zwztc = reader["中文主题词"].ToString().Trim(); pm.wwztc = reader["外文主题词"].ToString().Trim(); try { pm.ys = int.Parse(reader["页数"].ToString()); } catch (Exception) { pm.ys = 0; } pm.gtfl = reader["国图分类"].ToString().Trim(); pm.gch = reader["馆藏号"].ToString().Trim(); pm.ywjm = reader["原文件名"].ToString().Trim(); pm.gxx = reader["更新项"].ToString().Trim(); } else { //pm.sybm = reader["索引编码"].ToString(); //pm.wjm = reader["文件名"].ToString(); pm.zwpm = reader["论文题名"].ToString(); pm.wwpm = reader["英文论文题名"].ToString(); pm.zz = reader["论文作者"].ToString(); pm.zzdw = reader["作者机构"].ToString(); pm.zwwz = reader["论文摘要"].ToString(); pm.wwwz = reader["英文论文摘要"].ToString(); pm.zwztc = reader["论文关键词"].ToString(); pm.wwztc = reader["英文论文关键词"].ToString(); pm.gtfl = reader["分类号"].ToString(); pm.ywjm = reader["文件名"].ToString(); //TODO : 馆藏号 //根据分类编码中的关键词查找分类,并生成索引目录 string hymc = reader["会议录名称"].ToString(); WWHY_SYML wwhySYML = wwhyDAO.getWwhySYMLByZwmc(hymc); if (wwhySYML == null) { //构造索引目录 wwhySYML = new WWHY_SYML(); wwhySYML.flbm = GetFlbmByKeywords(hymc); if ("".Equals(wwhySYML.flbm)) { wwhySYML.flbm = GetFlbmByFlmc(hymc); } try { wwhySYML.nf = int.Parse(reader["年"].ToString()); } catch { wwhySYML.nf = 2012; } string sybm = wwhyDAO.getMaxWwhySYML(wwhySYML.flbm, wwhySYML.nf.ToString()); if (null == sybm) { sybm = wwhySYML.flbm + "-" + wwhySYML.nf.ToString() + "-000"; } else { string serial = "000"; int number = 0; try { number = int.Parse(sybm.Substring(sybm.Length - 3)) + 1; } catch { } serial += number; sybm = wwhySYML.flbm + "-" + wwhySYML.nf.ToString() + "-" + serial.Substring(serial.Length - 3); } wwhySYML.sybm = sybm; //读取索引字段,并插入到数据表中 wwhySYML.hydd = reader["会议地点"].ToString(); wwhySYML.wz = reader["语种"].ToString(); wwhySYML.zwmc = reader["会议录名称"].ToString(); wwhySYML.gch = ""; wwhySYML.wwmc = reader["英文会议录名称"].ToString(); wwhySYML.zbdw = reader["主办单位"].ToString(); wwhySYML.cbdw = ""; wwhySYML.chbdw = reader["出版单位"].ToString(); try { wwhySYML.fbrq = DateTime.Parse(reader["发表时间"].ToString()); } catch { wwhySYML.fbrq = DateTime.Now; } wwhySYML.gtfl = GetGTFLbyFL(reader["分类号"].ToString()); wwhySYML.jj = ""; wwhySYML.dlrq = DateTime.Now; if (!"".Equals(wwhySYML.flbm)) { try { wwhyDAO.insertWwhySYML(wwhySYML); } catch { //不应该失败 } } } if (!"".Equals(wwhySYML.flbm)) { pm.sybm = wwhySYML.sybm; pm.gch = wwhySYML.gch; if (null == pm.gch) pm.gch = ""; } } pm.dlr = user.name; pm.fillEmptyStringAsNull(); return pm; }