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