/// <summary> /// 生成日志信息 /// </summary> /// <param name="zwhyPM">中文会议信息</param> /// <param name="opType">操作类型</param> /// <param name="uname">用户名</param> /// <returns></returns> private OperationLogItem GetOperationLogItem(ZWHY_PM zwhyPM, String opType, String uname) { if (null == zwhyPM) { return null; } OperationLogItem operationLogItem = new OperationLogItem(); //操作类型 operationLogItem.opType = opType; //数据库表 operationLogItem.opTable = "ZWHY_PM"; //全文页数 operationLogItem.opPageCount = zwhyPM.ys; operationLogItem.opObjectID = "中文会议"; // 操作涉及的书刊 operationLogItem.opBookIn = "中文会议"; // 时间 operationLogItem.opDate = DateTime.Now; // 操作员 operationLogItem.opPerson = uname; //记录操作模式,判断是否属于批量操作。取值范围SINGLE/BATCH。 operationLogItem.opMode = "SINGLE"; //操作的内容 String content = "('" + zwhyPM.sybm + "','" + zwhyPM.wjm + "','" + zwhyPM.ywjm + "','" + zwhyPM.zwpm + "','" + zwhyPM.wwpm + "','" + zwhyPM.zz + "','" + zwhyPM.zzdw + "','" + zwhyPM.zz + "','" + zwhyPM.zzdw + "','" + zwhyPM.zwwz + "','" + zwhyPM.wwwz + "','" + zwhyPM.zwztc + "','" + zwhyPM.wwztc + "','" + zwhyPM.ys + "','" + zwhyPM.gtfl + "','" + zwhyPM.gtfl + "','" + zwhyPM.gch + "','" + zwhyPM.gxrq + "','" + zwhyPM.dlr + "','" + zwhyPM.gxx+"')"; operationLogItem.opContent = content; return operationLogItem; }
/// <summary> /// 按文件名更新篇名信息。 /// 文件名为主键。 /// </summary> /// <param name="pm"></param> /// <returns></returns> public bool updateZwhyPMByWJM(ZWHY_PM pm, String uname) { OperationLogItem operationLog = null; operationLog = this.GetOperationLogItem(pm, "UPDATE", uname); bool result; try { sqlMapper.BeginTransaction(); sqlMapper.Update("UpdateZWHY_PM", pm); sqlMapper.CommitTransaction(); this.operationLogDAO.insertLogItem(operationLog); result = true; } catch { sqlMapper.RollBackTransaction(); result = false; } return result; }
/// <summary> /// 从页面中读取片名的信息 /// </summary> /// <returns>返回片名对象</returns> private ZWHY_PM GetZWHY_PM() { User user = (User)Session["login"]; //登陆超时则退到登录页 if (null == user) { Response.Write(" <script> top.location = '" + GlobalResource.LOGIN_PAGE + "' </script> "); return null; } ZWHY_PM zwhyPM = new ZWHY_PM(); //登录人 zwhyPM.dlr = user.name; //索引编码 zwhyPM.sybm = this.sybmTextBox.Text.Trim(); //页数 try { zwhyPM.ys = Int32.Parse(this.ysTextBox.Text.Trim()); } catch (Exception) { } //文件名 zwhyPM.wjm = this.wjmHyperLink.Text.Trim(); //原文件名 zwhyPM.ywjm = this.ywjmHiddenField.Value.Trim(); //中文篇名 zwhyPM.zwpm = this.zwpmTextBox.Text.Trim(); //外文篇名 zwhyPM.wwpm = this.wwpmTextBox.Text.Trim(); //作者 zwhyPM.zz = this.zzTextBox.Text.Trim(); //作者单位 zwhyPM.zzdw = this.zzdwTextBox.Text.Trim(); //中文文摘 zwhyPM.zwwz = this.zwwzTextBox.Text.Trim(); //外文文摘 zwhyPM.wwwz = this.wwwzTextBox.Text.Trim(); //中文主题词 zwhyPM.zwztc = this.zwztcTextBox.Text.Trim(); //外文主题词 zwhyPM.wwztc = this.wwztcTextBox.Text.Trim(); //国图分类 zwhyPM.gtfl = this.gtflTextBox.Text.Trim(); //馆藏号 zwhyPM.gch = this.gchTextBox.Text.Trim(); //更新日期 try { zwhyPM.gxrq = DateTime.Parse(this.gxrqTextBox.Text); } catch (Exception) { zwhyPM.gxrq = DateTime.Now; } return zwhyPM; }
/// <summary> /// 插入中文会议篇名信息。 /// </summary> /// <param name="pm"></param> public void insertZwhyPM(ZWHY_PM pm) { OperationLogItem operationLog = null; operationLog = this.GetOperationLogItem(pm, "INSERT", pm.dlr); if (null != operationLog) { this.operationLogDAO.insertLogItem(operationLog); } sqlMapper.Insert("InsertZWHY_PM", pm); }
protected override PM getPM(OleDbDataReader reader, out String err) { err = String.Empty; ZWHY_PM pm = new ZWHY_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(); //馆藏号如何取得 pm.gxx = ""; //根据分类编码中的关键词查找分类,并生成索引目录 string hymc = reader["会议录名称"].ToString(); ZWHY_SYML zwhySYML = zwhyDAO.getZwhySYMLByZwmc(hymc); if (zwhySYML == null) { //构造索引目录 zwhySYML = new ZWHY_SYML(); zwhySYML.flbm = GetFlbmByKeywords(hymc); if ("".Equals(zwhySYML.flbm)) { zwhySYML.flbm = GetFlbmByFlmc(hymc); } try { zwhySYML.nf = int.Parse(reader["年"].ToString()); } catch { zwhySYML.nf = 2012; } string sybm = zwhyDAO.getMaxZwhySYML(zwhySYML.flbm, zwhySYML.nf.ToString()); if (null == sybm) { sybm = zwhySYML.flbm + "-" + zwhySYML.nf.ToString() + "-000"; } else { string serial = "000"; int number = 0; try { number = int.Parse(sybm.Substring(sybm.Length - 3)) + 1; } catch { } serial += number; sybm = zwhySYML.flbm + "-" + zwhySYML.nf.ToString() + "-" + serial.Substring(serial.Length - 3); } zwhySYML.sybm = sybm; //读取索引字段,并插入到数据表中 zwhySYML.dqhy = ""; zwhySYML.wz = reader["语种"].ToString(); zwhySYML.zwmc = reader["会议录名称"].ToString(); zwhySYML.gch = ""; zwhySYML.wwmc = reader["英文会议录名称"].ToString(); zwhySYML.zbdw = reader["主办单位"].ToString(); zwhySYML.cbdw = ""; zwhySYML.chbdw = reader["出版单位"].ToString(); try { zwhySYML.fbrq = DateTime.Parse(reader["发表时间"].ToString()); } catch { zwhySYML.fbrq = DateTime.Now; } zwhySYML.hydd = reader["会议地点"].ToString(); zwhySYML.gtfl = GetGTFLbyFL(reader["分类号"].ToString()); zwhySYML.jj = ""; zwhySYML.dlrq = DateTime.Now; if (!"".Equals(zwhySYML.flbm)) { try { zwhyDAO.insertZwhySYML(zwhySYML); } catch { //不应该失败 } } } if (!"".Equals(zwhySYML.flbm)) { pm.sybm = zwhySYML.sybm; pm.gch = zwhySYML.gch; if (null == pm.gch) pm.gch = ""; } } pm.fillEmptyStringAsNull(); return pm; }