/// <summary> /// 更新一条篇名信息 /// </summary> /// <param name="kjbg_pm">要更新的篇名信息</param> /// <param name="uname">操作用户名</param> /// <returns></returns> public Boolean UpdateKJBG_PM(KJBG_PM kjbg_pm, String uname) { Boolean flag = true; int back = sqlMapper.Update("UpdateKJBG_PM", kjbg_pm); if (back <= 0) { flag = false; } if (flag) { OperationLogItem operationLog = this.GetOperationLogItem(kjbg_pm, "UPDATE", uname); this.operationLogDAO.insertLogItem(operationLog); } return flag; }
/// <summary> /// 生成日志信息 /// </summary> /// <param name="kjbgPM">中文篇名信息</param> /// <param name="opType">操作类型</param> /// <param name="uname">用户名</param> /// <returns></returns> private OperationLogItem GetOperationLogItem(KJBG_PM kjbgPM, String opType, String uname) { if (null == kjbgPM) { return null; } OperationLogItem operationLogItem = new OperationLogItem(); //操作类型 operationLogItem.opType = opType; //数据库表 operationLogItem.opTable = "KJBG_PM"; //全文页数 operationLogItem.opPageCount =kjbgPM.ys; operationLogItem.opObjectID = "科技报告"; // 操作涉及的书刊 operationLogItem.opBookIn = "科技报告"; // 时间 operationLogItem.opDate = DateTime.Now; // 操作员 operationLogItem.opPerson = uname; //记录操作模式,判断是否属于批量操作。取值范围SINGLE/BATCH。 operationLogItem.opMode = "SINGLE"; //操作的内容 String content = "('" + kjbgPM.flbm + "','" + kjbgPM.sybm + "','" + kjbgPM.wjm + "','" + kjbgPM.bgbh + "','" + kjbgPM.bgmc + "','" + kjbgPM.bgdw + "','" + kjbgPM.nf + "','" + kjbgPM.zz + "','" + kjbgPM.zwwz + "','" + kjbgPM.zwztc + "','" + kjbgPM.zlly + "','" + kjbgPM.ys + "','" + kjbgPM.dlr + "','" + kjbgPM.gxrq + "','" + kjbgPM.kf + "')"; operationLogItem.opContent = content; return operationLogItem; }
/// <summary> /// 插入一条篇名信息 /// </summary> /// <param name="kjbg_pm">篇名信息</param> /// <returns></returns> public Boolean InsertKJBG_PM(KJBG_PM kjbg_pm) { Boolean flag = true; try { sqlMapper.Insert("InsertKJBG_PM", kjbg_pm); } catch (Exception) { flag = false; } if (flag) { OperationLogItem operationLog = this.GetOperationLogItem(kjbg_pm, "INSERT", kjbg_pm.dlr); this.operationLogDAO.insertLogItem(operationLog); } return flag; }
/// <summary> /// 获取用户填写的科技报告告篇名信息 /// </summary> /// <returns></returns> private KJBG_PM GetKJBGPM() { KJBG_PM kjbgPM = new KJBG_PM(); //索引编码 kjbgPM.sybm = this.sybmTextBox.Text; //分类编码 kjbgPM.flbm = this.flbmTextBox.Text; //文件名 kjbgPM.wjm = this.wjmTextBox.Text; //报告编号 kjbgPM.bgbh = this.bgbhTextBox.Text.Trim(); //年份 kjbgPM.nf = Int32.Parse(this.nfTextBox.Text); //报告名称 kjbgPM.bgmc = this.bgmcTextBox.Text.Trim(); //报告单位 kjbgPM.bgdw = this.bgdwTextBox.Text.Trim(); //作者 kjbgPM.zz = this.zzTextBox.Text.Trim(); //中文文摘 kjbgPM.zwwz = this.zwwzTextBox.Text.Trim(); //中文主题词 kjbgPM.zwztc = this.zwztcTextBox.Text.Trim(); //页数 kjbgPM.ys =Int32.Parse(this.ysHiddenField.Value) ; //登录人 kjbgPM.dlr =this.dlrTextBox.Text; //更新日期 try { kjbgPM.gxrq = DateTime.Parse(this.gxrqTextBox.Text.Trim()); } catch { kjbgPM.gxrq = DateTime.Now; } //资料来源 kjbgPM.zlly = this.zllyTextBox.Text; //开放 kjbgPM.kf = this.kfCheckBox.Checked; return kjbgPM; }
protected override PM getPM(OleDbDataReader reader, out String err) { err = String.Empty; KJBG_PM pm = new KJBG_PM(); if (hasFormatTable) { pm.flbm = reader["分类编码"].ToString().Trim(); pm.sybm = reader["索引编码"].ToString().Trim(); pm.ywjm = pm.wjm = reader["文件名"].ToString().Trim(); try { pm.ys = int.Parse(reader["页数"].ToString()); } catch (Exception) { pm.ys = 0; err += pm.sybm + ":" + pm.bgmc + ": 页数\"" + reader["页数"] + "\"出错,置为0\n"; } try { pm.nf = int.Parse(reader["年份"].ToString()); } catch (Exception) { pm.nf = 0; err += pm.sybm + ":" + pm.bgmc + ": 年份\"" + reader["年份"] + "\"出错,置为0\n"; } pm.bgbh = reader["报告编号"].ToString().Trim(); pm.bgmc = reader["报告名称"].ToString().Trim(); pm.bgdw = reader["报告单位"].ToString().Trim(); pm.zz = reader["作者"].ToString().Trim(); pm.zwwz = reader["中文文摘"].ToString().Trim(); pm.zwztc = reader["中文主题词"].ToString().Trim(); pm.zlly = reader["资料来源"].ToString().Trim(); pm.dlr = reader["登录人"].ToString().Trim(); pm.gxrq = DateTime.Now; try { pm.kf = Boolean.Parse(reader["开放"].ToString()); } catch { pm.kf = true; } } else { //不支持 } pm.dlr = user.name; pm.fillEmptyStringAsNull(); return pm; }
/// <summary> /// 更新一条篇名信息 /// </summary> /// <param name="kjbg_pm">要更新的篇名信息</param> /// <param name="uname">操作用户名</param> /// <returns></returns> public Boolean UpdateKJBG_PM(KJBG_PM kjbg_pm, String uname) { Boolean flag = true; int back = sqlMapper.Update("UpdateKJBG_PM", kjbg_pm); if (back <= 0) { flag = false; } return flag; }
/// <summary> /// 插入一条篇名信息 /// </summary> /// <param name="kjbg_pm">篇名信息</param> /// <returns></returns> public Boolean InsertKJBG_PM(KJBG_PM kjbg_pm) { Boolean flag = true; try { sqlMapper.Insert("InsertKJBG_PM", kjbg_pm); } catch (Exception) { flag = false; } return flag; }