protected override PM getPM(OleDbDataReader reader, out String err) { err = String.Empty; BDBK_PM pm = new BDBK_PM(); if (hasFormatTable) { pm.flbm = reader["分类编码"].ToString().Trim(); pm.sybm = reader["索引编码"].ToString().Trim(); pm.oldWjm = pm.wjm = reader["文件名"].ToString().Trim(); pm.bt = reader["标题"].ToString().Trim(); pm.zz = reader["作者"].ToString().Trim(); try { pm.nf = int.Parse(reader["年份"].ToString().Trim()); } catch (Exception) { pm.nf = 0; } try { pm.yf = int.Parse(reader["月份"].ToString().Trim()); } catch (Exception) { pm.yf = 1; } try { if (String.Empty.Equals(reader["日期"].ToString().Trim())) { pm.rq = DateTime.Parse(pm.nf.ToString() + "/" + pm.yf.ToString() + "/1"); } else pm.rq = DateTime.Parse(reader["日期"].ToString().Trim()); } catch { err += "日期\"" + reader["日期"] + "\"出错" + pmKeyInfo(pm); } pm.bh = reader["版号"].ToString().Trim(); pm.lm = reader["栏目"].ToString().Trim(); pm.ywjm = reader["原文件名"].ToString().Trim(); pm.qw = reader["全文"].ToString().Trim(); } else { //pm.bt = reader["题名"].ToString().Trim(); pm.bt = reader["正标题"].ToString().Trim() + reader["副标题"].ToString().Trim(); pm.bh = reader["版号"].ToString().Trim(); pm.lm = reader["栏目"].ToString().Trim(); pm.ywjm = reader["文件名"].ToString().Trim(); pm.zz = reader["作者名称"].ToString().Trim(); try { pm.nf = int.Parse(reader["年"].ToString().Trim()); } catch { pm.nf = 0; } try { if (!String.Empty.Equals(reader["日期"].ToString().Trim())) { pm.rq = DateTime.Parse(reader["日期"].ToString().Trim()); pm.yf = pm.rq.Month; } } catch { err += "日期出错\"" + reader["日期"].ToString().Trim(); } String bzzwm = reader["报纸中文名"].ToString().Trim(); foreach (BDBK_FL fl in bdbkFL) { if (null != fl.flmc && fl.flmc.Equals(bzzwm)) { pm.flbm = fl.flbm; break; } } if (null == pm.flbm || "".Equals(pm.flbm)) { pm.flbm = ""; pm.sybm = ""; //err += " 分类编码未能找到 \"" + bzzwm + "\""; pm.isValid = false; } else { pm.sybm = pm.flbm + String.Format("{0:4D}", pm.nf) + String.Format("{0:2D}", pm.yf); } pm.qw = "-1"; if (!"".Equals(err)) err += pmKeyInfo(pm); } pm.dlr = user.name; pm.fillEmptyStringAsNull(); return pm; }
/// <summary> /// 生成日志信息 /// </summary> /// <param name="zwqkPM">经济报刊刊信息</param> /// <param name="opType">操作类型</param> /// <param name="uname">用户名</param> /// <returns></returns> private OperationLogItem GetOperationLogItem(BDBK_PM bdbkPM, String opType, String uname) { if (null == bdbkPM) { return null; } OperationLogItem operationLogItem = new OperationLogItem(); //操作类型 operationLogItem.opType = opType; //数据库表 operationLogItem.opTable = "BDBK_PM"; //全文页数 try { //operationLogItem.opPageCount = Int32.Parse(bdbkPM.ys); operationLogItem.opPageCount = 0; } catch (Exception) { } operationLogItem.opObjectID = "经济报刊"; // 操作涉及的书刊 operationLogItem.opBookIn = "经济报刊"; // 时间 operationLogItem.opDate = DateTime.Now; // 操作员 operationLogItem.opPerson = uname; //记录操作模式,判断是否属于批量操作。取值范围SINGLE/BATCH。 operationLogItem.opMode = "SINGLE"; //操作的内容 String content = "('" + bdbkPM.flbm + "','" + bdbkPM.sybm + "','" + bdbkPM.wjm + "','" + bdbkPM.bt + "','" + bdbkPM.zz + "','" + bdbkPM.rq + "','" + bdbkPM.bh + "','" + bdbkPM.lm + "','" + bdbkPM.ywjm + "','" + bdbkPM.nf + "','" + bdbkPM.yf + "','" + bdbkPM.qw + "','" + bdbkPM.dlr + "','" + bdbkPM.gxrq + "')"; operationLogItem.opContent = content; return operationLogItem; }
/// <summary> /// 更新一条篇名信息 /// </summary> /// <param name="bdbk_pm">要更新的篇名信息</param> /// <param name="uname">操作用户名</param> /// <returns></returns> public Boolean UpdateBDBK_PM(BDBK_PM bdbk_pm, String uname) { Boolean flag = true; int back=sqlMapper.Update("UpdateBDBK_PM", bdbk_pm); if (back <= 0) { flag = false; } if (flag) { OperationLogItem operationLog = this.GetOperationLogItem(bdbk_pm, "UPDATE", uname); this.operationLogDAO.insertLogItem(operationLog); } return flag; }
/// <summary> /// 插入一条篇名信息 /// </summary> /// <param name="bdbk_pm">篇名信息</param> /// <returns></returns> public Boolean InsertBDBK_PM(BDBK_PM bdbk_pm) { Boolean flag = true; OperationLogItem operationLog = this.GetOperationLogItem(bdbk_pm, "INSERT", null); sqlMapper.Insert("InsertBDBK_PM", bdbk_pm); this.operationLogDAO.insertLogItem(operationLog); return flag; }
/// <summary> /// 获取用户填写的国研报告篇名信息 /// </summary> /// <returns></returns> private BDBK_PM GetBDBKPM() { BDBK_PM bdbkPM = new BDBK_PM(); //索引编码 bdbkPM.sybm = this.sybmTextBox.Text; //分类编码 bdbkPM.flbm = this.flbmTextBox.Text; //文件名 bdbkPM.wjm = this.wjmTextBox.Text; //原文件名 bdbkPM.ywjm = this.ywjmFileUpload.FileName; //标题 bdbkPM.bt = this.btTextBox.Text.Trim(); //作者 bdbkPM.zz = this.zzTextBox.Text.Trim(); //日期 bdbkPM.rq = DateTime.Parse(this.rqTextBox.Text); //版号 bdbkPM.bh = this.bhTextBox.Text.Trim(); //栏目 bdbkPM.lm = this.lmTextBox.Text.Trim(); //年份 bdbkPM.nf = Int32.Parse(this.nfTextBox.Text); //月份 bdbkPM.yf = Int32.Parse(this.qhTextBox.Text); //更新日期 try { bdbkPM.gxrq = DateTime.Parse(this.gxrqTextBox.Text.Trim()); } catch { bdbkPM.gxrq = DateTime.Now; } //登录人 bdbkPM.dlr = this.dlrTextBox.Text; //全文 bdbkPM.qw = "-1"; return bdbkPM; }
/// <summary> /// 插入一条篇名信息 /// </summary> /// <param name="bdbk_pm">篇名信息</param> /// <returns></returns> public Boolean InsertBDBK_PM(BDBK_PM bdbk_pm) { Boolean flag = true; OperationLogItem operationLog = this.GetOperationLogItem(bdbk_pm, "INSERT", null); try { sqlMapper.Insert("InsertBDBK_PM", bdbk_pm); this.operationLogDAO.insertLogItem(operationLog); } catch (Exception) { flag = false; } return flag; }