/// <summary> /// 生成日志信息 /// </summary> /// <param name="kcbgPM">中文篇名信息</param> /// <param name="opType">操作类型</param> /// <param name="uname">用户名</param> /// <returns></returns> private OperationLogItem GetOperationLogItem(KCBG_PM kcbgPM, String opType, String uname) { if (null == kcbgPM) { return null; } OperationLogItem operationLogItem = new OperationLogItem(); //操作类型 operationLogItem.opType = opType; //数据库表 operationLogItem.opTable = "KCBG_PM"; //全文页数 operationLogItem.opPageCount =kcbgPM.ys; operationLogItem.opObjectID = "考察报告"; // 操作涉及的书刊 operationLogItem.opBookIn = "考察报告"; // 时间 operationLogItem.opDate = DateTime.Now; // 操作员 operationLogItem.opPerson = uname; //记录操作模式,判断是否属于批量操作。取值范围SINGLE/BATCH。 operationLogItem.opMode = "SINGLE"; //操作的内容 String content = "('" + kcbgPM.flbm + "','" + kcbgPM.sybm + "','" + kcbgPM.wjm + "','" + kcbgPM.bgbh + "','" + kcbgPM.bgmc + "','" + kcbgPM.bgdw + "','" + kcbgPM.cjdw + "','" + kcbgPM.gjdq + "','" + kcbgPM.zyry + "','" + kcbgPM.bgrq + "','" + kcbgPM.cfrq + "','" + kcbgPM.fhrq + "','" + kcbgPM.zyly + "','" + kcbgPM.ztc + "','" + kcbgPM.bgzy +"','"+ kcbgPM.ys + "','" + kcbgPM.bz + "','" + kcbgPM.dlr +"','"+ kcbgPM.gxrq + "','" + kcbgPM.kf + "','" + kcbgPM.yx + "')"; operationLogItem.opContent = content; return operationLogItem; }
/// <summary> /// 更新一条篇名信息 /// </summary> /// <param name="kcbg_pm">要更新的篇名信息</param> /// <param name="uname">操作用户名</param> /// <returns></returns> public Boolean UpdateKCBG_PM(KCBG_PM kcbg_pm, String uname) { Boolean flag = true; int back = sqlMapper.Update("UpdateKCBG_PM", kcbg_pm); if (back <= 0) { flag = false; } if (flag) { OperationLogItem operationLog = this.GetOperationLogItem(kcbg_pm, "UPDATE", uname); this.operationLogDAO.insertLogItem(operationLog); } return flag; }
/// <summary> /// 插入一条篇名信息 /// </summary> /// <param name="kcbg_pm">篇名信息</param> /// <returns></returns> public Boolean InsertKCBG_PM(KCBG_PM kcbg_pm) { Boolean flag = true; OperationLogItem operationLog = this.GetOperationLogItem(kcbg_pm, "INSERT", null); try { sqlMapper.Insert("InsertKCBG_PM", kcbg_pm); this.operationLogDAO.insertLogItem(operationLog); } catch (Exception) { flag = false; } return flag; }
/// <summary> /// 获取用户填写的国研报告篇名信息 /// </summary> /// <returns></returns> private KCBG_PM GetKCBGPM() { KCBG_PM kcbgPM = new KCBG_PM(); //索引编码 kcbgPM.sybm = this.sybmTextBox.Text; //分类编码 kcbgPM.flbm = this.flbmTextBox.Text; //文件名 kcbgPM.wjm = this.wjmTextBox.Text; //报告编号 kcbgPM.bgbh = this.bgbhTextBox.Text.Trim(); //报告名称 kcbgPM.bgmc = this.bgmcTextBox.Text.Trim(); //报告单位 kcbgPM.bgdw = this.bgdwTextBox.Text.Trim(); //参加单位 kcbgPM.cjdw = this.cjdwTextBox.Text.Trim(); //国家地区 kcbgPM.gjdq = this.gjdqTextBox.Text.Trim(); //主要人员 kcbgPM.zyry= this.zyryTextBox.Text.Trim(); //报告日期 kcbgPM.bgrq = DateTime.Parse(this.bgrqTextBox.Text); //出访日期 kcbgPM.cfrq = DateTime.Parse(this.cfrqTextBox.Text); //返回日期 kcbgPM.fhrq = DateTime.Parse(this.fhrqTextBox.Text); //专业领域 kcbgPM.zyly = this.zylyTextBox.Text.Trim(); //主题词 kcbgPM.ztc = this.ztcTextBox.Text.Trim(); //报告摘要 kcbgPM.bgzy =this.bgzyTextBox.Text.Trim(); //页数 kcbgPM.ys = Int32.Parse(this.ysHiddenField.Value); //备注 kcbgPM.bz = this.bzTextBox.Text.Trim(); //更新日期 try { kcbgPM.gxrq = DateTime.Parse(this.gxrqTextBox.Text.Trim()); } catch { kcbgPM.gxrq = DateTime.Now; } //登录人 kcbgPM.dlr = this.dlrTextBox.Text; //开放 kcbgPM.kf = this.kfCheckBox.Checked; //优秀 kcbgPM.yx = this.yxCheckBox.Checked; return kcbgPM; }
protected override PM getPM(OleDbDataReader reader, out String err) { err = String.Empty; KCBG_PM pm = new KCBG_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 += "页数\"" + reader["页数"] + "\"出错,置为0; "; } pm.bgbh = reader["报告编号"].ToString().Trim(); pm.bgmc = reader["报告名称"].ToString().Trim(); pm.bgdw = reader["报告单位"].ToString().Trim(); pm.cjdw = reader["参加单位"].ToString().Trim(); pm.gjdq = reader["国家地区"].ToString().Trim(); pm.zyry = reader["主要人员"].ToString().Trim(); try { pm.bgrq = DateTime.Parse(reader["报告日期"].ToString()); } catch (Exception) { err += "报告日期\"" + reader["报告日期"] + "\"出错; "; } try { if (!"".Equals(reader["出访日期"].ToString())) pm.cfrq = DateTime.Parse(reader["出访日期"].ToString()); } catch (Exception) { err += "出访日期\"" + reader["出访日期"] + "\"出错; "; } try { if (!"".Equals(reader["返回日期"].ToString())) pm.fhrq = DateTime.Parse(reader["返回日期"].ToString()); } catch (Exception) { err += "返回日期\"" + reader["返回日期"] + "\"出错; "; } pm.zyly = reader["专业领域"].ToString().Trim(); pm.ztc = reader["主题词"].ToString().Trim(); pm.bgzy = reader["报告摘要"].ToString().Trim(); pm.bz = reader["备注"].ToString().Trim(); pm.dlr = reader["登录人"].ToString().Trim(); pm.gxrq = DateTime.Now; try { pm.kf = Boolean.Parse(reader["开放"].ToString()); } catch { pm.kf = true; } if (true == pm.kf) pm.kf1 = "T"; else pm.kf1 = "F"; try { pm.yx = Boolean.Parse(reader["优秀"].ToString()); } catch { pm.yx = true; } if (true == pm.yx) pm.yx1 = "T"; else pm.yx1 = "F"; } else { //不支持 } if (!err.Equals(String.Empty)) err += pmKeyInfo(pm); pm.dlr = user.name; pm.fillEmptyStringAsNull(); return pm; }
/// <summary> /// 插入一条篇名信息 /// </summary> /// <param name="kcbg_pm">篇名信息</param> /// <returns></returns> public Boolean InsertKCBG_PM(KCBG_PM kcbg_pm) { Boolean flag = true; try { sqlMapper.Insert("InsertKCBG_PM", kcbg_pm); } catch (Exception) { flag = false; } return flag; }