/// <summary> /// 插入一条篇名信息 /// </summary> /// <param name="gdfg_pm">篇名信息</param> /// <returns></returns> public Boolean InsertGDFG_PM(GDFG_PM gdfg_pm) { Boolean flag = true; try { sqlMapper.Insert("InsertGDFG_PM", gdfg_pm); } catch (Exception) { flag = false; } return flag; }
/// <summary> /// 更新一条篇名信息 /// </summary> /// <param name="gdfg_pm">要更新的篇名信息</param> /// <param name="uname">操作用户名</param> /// <returns></returns> public Boolean UpdateGDFG_PM(GDFG_PM gdfg_pm, String uname) { Boolean flag = true; int back = sqlMapper.Update("UpdateGDFG_PM", gdfg_pm); return flag; }
protected override PM getPM(OleDbDataReader reader, out String err) { err = String.Empty; GDFG_PM pm = new GDFG_PM(); if (hasFormatTable) { pm.flbm = reader["分类编码"].ToString().Trim(); pm.sybm = reader["索引编码"].ToString().Trim(); pm.wjm = reader["文件名"].ToString().Trim(); pm.ywjm = pm.wjm; pm.fgwh = reader["法规文号"].ToString().Trim(); pm.fgmc = reader["法规名称"].ToString().Trim(); pm.fbdw = reader["发布单位"].ToString().Trim(); try { pm.ys = int.Parse(reader["页数"].ToString().Trim()); } catch (Exception) { pm.ys = 0; } try { pm.qwjc = Boolean.Parse(reader["全文检查"].ToString().Trim()); } catch (Exception) { pm.qwjc = true; } try { pm.kf = Boolean.Parse(reader["开放"].ToString().Trim()); } catch (Exception) { pm.kf = true; } try { if (!String.Empty.Equals(reader["发布日期"].ToString().Trim())) { pm.fbrq = DateTime.Parse(reader["发布日期"].ToString().Trim()); } } catch { err += pm.fgmc + ": 发布日期\"" + reader["发布日期"] + "\"出错\n"; } try { if (!String.Empty.Equals(reader["实施日期"].ToString().Trim())) { pm.ssrq = DateTime.Parse(reader["实施日期"].ToString().Trim()); } } catch { err += pm.fgmc + ": 实施日期\"" + reader["实施日期"] + "\"出错\n"; } try { if (!String.Empty.Equals(reader["失效日期"].ToString().Trim())) { pm.sxrq = DateTime.Parse(reader["失效日期"].ToString().Trim()); } } catch { err += pm.fgmc + ": 失效日期\"" + reader["失效日期"] + "\"出错\n"; } pm.sx = reader["时效"].ToString().Trim(); pm.kb = reader["开本"].ToString().Trim(); pm.bz = reader["备注"].ToString().Trim(); pm.zyfl = reader["专业分类"].ToString().Trim(); pm.gxx = reader["更新项"].ToString().Trim(); } else { //不支持 } pm.gxrq = DateTime.Now; 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(GDFG_PM gdfgPM, String opType, String uname) { if (null == gdfgPM) { return null; } OperationLogItem operationLogItem = new OperationLogItem(); //操作类型 operationLogItem.opType = opType; //数据库表 operationLogItem.opTable = "GDFG_PM"; //全文页数 operationLogItem.opPageCount = gdfgPM.ys; operationLogItem.opObjectID = "国电法规"; // 操作涉及的法规 operationLogItem.opBookIn = "国电法规"; // 时间 operationLogItem.opDate = DateTime.Now; // 操作员 operationLogItem.opPerson = uname; //记录操作模式,判断是否属于批量操作。取值范围SINGLE/BATCH。 operationLogItem.opMode = "SINGLE"; //操作的内容 String content = "('" + gdfgPM.flbm + "','" + gdfgPM.sybm + "','" + gdfgPM.wjm + "','" + gdfgPM.fgwh + "','" + gdfgPM.fgmc + "','" + gdfgPM.fbdw + "','" + gdfgPM.fbrq + "','" + gdfgPM.ssrq + "','" + gdfgPM.sx + "','" + gdfgPM.sxrq + "','" + gdfgPM.kb + "','" + gdfgPM.ys + "','" + gdfgPM.bz + "','" + gdfgPM.zyfl + "','" + gdfgPM.qwjc + "','" + gdfgPM.kf + "','" + gdfgPM.gxrq + "','" + gdfgPM.gxx + "','" + gdfgPM.dlr + "')"; operationLogItem.opContent = content; return operationLogItem; }
/// <summary> /// 更新一条篇名信息 /// </summary> /// <param name="gdfg_pm">要更新的篇名信息</param> /// <param name="uname">操作用户名</param> /// <returns></returns> public Boolean UpdateGDFG_PM(GDFG_PM gdfg_pm, String uname) { Boolean flag = true; int back = sqlMapper.Update("UpdateGDFG_PM", gdfg_pm); if (back <= 0) { flag = false; } if (flag) { OperationLogItem operationLog = this.GetOperationLogItem(gdfg_pm, "UPDATE", uname); this.operationLogDAO.insertLogItem(operationLog); } return flag; }
/// <summary> /// 插入一条篇名信息 /// </summary> /// <param name="gdfg_pm">篇名信息</param> /// <returns></returns> public Boolean InsertGDFG_PM(GDFG_PM gdfg_pm) { Boolean flag = true; OperationLogItem operationLog = this.GetOperationLogItem(gdfg_pm, "INSERT", null); try { sqlMapper.Insert("InsertGDFG_PM", gdfg_pm); this.operationLogDAO.insertLogItem(operationLog); } catch (Exception) { flag = false; } return flag; }
/// <summary> /// 获取用户填写的国电法规篇名信息 /// </summary> /// <returns></returns> private GDFG_PM GetGDFGPM() { GDFG_PM gdfgPM = new GDFG_PM(); //索引编码 gdfgPM.sybm = this.sybmTextBox.Text; //分类编码 gdfgPM.flbm = this.flbmTextBox.Text; //文件名 gdfgPM.wjm = this.pdfTextBox.Text; //法规名称 gdfgPM.fgmc = this.fgmcTextBox.Text.Trim(); //法规文号 gdfgPM.fgwh = this.fgwhTextBox.Text.Trim(); //发布单位 gdfgPM.fbdw = this.fbdwTextBox.Text.Trim(); //发布日期 if (!"".Equals(this.fbrqTextBox.Text)) gdfgPM.fbrq = DateTime.Parse(this.fbrqTextBox.Text); //实施日期 if (!"".Equals(this.ssrqTextBox.Text)) gdfgPM.ssrq = DateTime.Parse(this.ssrqTextBox.Text); //失效日期 if (!"".Equals(this.sxrqTextBox.Text)) gdfgPM.sxrq = DateTime.Parse(this.sxrqTextBox.Text); //专业分类 gdfgPM.zyfl = this.zyflTextBox.Text; //时效 gdfgPM.sx = this.sxDropDownList.SelectedValue.Trim(); //开本 gdfgPM.kb = this.kbTextBox.Text.Trim(); //开放 gdfgPM.kf = this.kfCheckBox.Checked; //全文检查 gdfgPM.qwjc = this.qwjcCheckBox.Checked; if (!"".Equals(this.ysTextBox.Text)) gdfgPM.ys = Int32.Parse(this.ysTextBox.Text); //更新项 gdfgPM.gxx = this.gxxTextBox.Text; //备注 gdfgPM.bz = this.bzTextBox.Text; //更新日期 try { gdfgPM.gxrq = DateTime.Parse(this.gxrqTextBox.Text.ToString()); } catch { gdfgPM.gxrq = DateTime.Now; } //登录人 gdfgPM.dlr = this.dlrTextBox.Text.Trim(); return gdfgPM; }