/// <summary> /// 获取用户填写的综合报刊篇名信息 /// </summary> /// <returns></returns> private ZHBK_PM GetZHBKPM() { ZHBK_PM zhbkPM = new ZHBK_PM(); //索引编码 zhbkPM.sybm = this.sybmTextBox.Text; //分类编码 zhbkPM.flbm = this.flbmTextBox.Text; //文件名 zhbkPM.wjm = this.wjmHyperLink.Text; //原文件名 zhbkPM.ywjm = this.ywjmFileUpload.FileName; //标题 zhbkPM.bt = this.btTextBox.Text.Trim(); //作者 zhbkPM.zz = this.zzTextBox.Text.Trim(); //日期 zhbkPM.rq = DateTime.Parse(this.rqTextBox.Text); //版号 zhbkPM.bh = this.bhTextBox.Text.Trim(); //栏目 zhbkPM.lm = this.lmTextBox.Text.Trim(); //年份 zhbkPM.nf = Int32.Parse(this.nfTextBox.Text); //月份 zhbkPM.yf = Int32.Parse(this.qhTextBox.Text); //更新日期 try { zhbkPM.gxrq = DateTime.Parse(this.gxrqTextBox.Text.Trim()); } catch { zhbkPM.gxrq = DateTime.Parse(this.rqTextBox.Text); } //登录人 zhbkPM.dlr = this.dlrTextBox.Text; //全文 zhbkPM.qw = "-1"; return zhbkPM; }
protected override PM getPM(OleDbDataReader reader, out String err) { err = String.Empty; ZHBK_PM pm = new ZHBK_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["日期"] + "\"出错\n"; } 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.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 (ZHBK_FL fl in zhbkFL) { 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"; } pm.dlr = user.name; pm.fillEmptyStringAsNull(); if (!String.Empty.Equals(err)) err += pmKeyInfo(pm); return pm; }
/// <summary> /// 生成日志信息 /// </summary> /// <param name="zhbkPM">综合报刊刊信息</param> /// <param name="opType">操作类型</param> /// <param name="uname">用户名</param> /// <returns></returns> private OperationLogItem GetOperationLogItem(ZHBK_PM zhbkPM, String opType, String uname) { if (null == zhbkPM) { return null; } OperationLogItem operationLogItem = new OperationLogItem(); //操作类型 operationLogItem.opType = opType; //数据库表 operationLogItem.opTable = "ZHBK_PM"; //全文页数 try { //operationLogItem.opPageCount = Int32.Parse(jjbkPM.ys); operationLogItem.opPageCount = 0; } catch (Exception) { } operationLogItem.opObjectID = "综合报刊"; // 操作涉及的书刊 operationLogItem.opBookIn = "综合报刊"; // 时间 operationLogItem.opDate = DateTime.Now; // 操作员 operationLogItem.opPerson = uname; //记录操作模式,判断是否属于批量操作。取值范围SINGLE/BATCH。 operationLogItem.opMode = "SINGLE"; //操作的内容 String content = "('" + zhbkPM.flbm + "','" + zhbkPM.sybm + "','" + zhbkPM.wjm + "','" + zhbkPM.bt + "','" + zhbkPM.zz + "','" + zhbkPM.rq + "','" + zhbkPM.bh + "','" + zhbkPM.lm + "','" + zhbkPM.ywjm + "','" + zhbkPM.nf + "','" + zhbkPM.yf + "','" + zhbkPM.qw + "','" + zhbkPM.dlr + "','" + zhbkPM.gxrq + "')"; operationLogItem.opContent = content; return operationLogItem; }
/// <summary> /// 更新一条篇名信息 /// </summary> /// <param name="zhbk_pm">要更新的篇名信息</param> /// <param name="uname">操作用户名</param> /// <returns></returns> public Boolean UpdateZHBK_PM(ZHBK_PM zhbk_pm, String uname) { Boolean flag = true; int back=sqlMapper.Update("UpdateZHBK_PM", zhbk_pm); if (back <= 0) { flag = false; } if (flag) { OperationLogItem operationLog = this.GetOperationLogItem(zhbk_pm, "UPDATE", uname); this.operationLogDAO.insertLogItem(operationLog); } return flag; }
/// <summary> /// 插入一条篇名信息 /// </summary> /// <param name="zhbk_pm">篇名信息</param> /// <returns></returns> public Boolean InsertZHBK_PM(ZHBK_PM zhbk_pm) { Boolean flag = true; OperationLogItem operationLog = this.GetOperationLogItem(zhbk_pm, "INSERT", null); sqlMapper.Insert("InsertZHBK_PM", zhbk_pm); this.operationLogDAO.insertLogItem(operationLog); return flag; }
/// <summary> /// 插入一条篇名信息 /// </summary> /// <param name="zhbk_pm">篇名信息</param> /// <returns></returns> public Boolean InsertZHBK_PM(ZHBK_PM zhbk_pm) { Boolean flag = true; OperationLogItem operationLog = this.GetOperationLogItem(zhbk_pm, "INSERT", null); try { sqlMapper.Insert("InsertZHBK_PM", zhbk_pm); this.operationLogDAO.insertLogItem(operationLog); } catch (Exception) { flag = false; } return flag; }