private string getSbbm(KJCG_PM kjcg) { string ret = "000"; int serial = 1; KJCG_PM kjcgPM = kjcgDAO.getMaxSbbmKJCG_PM(kjcg.sbbm); if (null != kjcgPM) { try { string[] segs = kjcgPM.sbbm.Split('-'); int lastSerial = int.Parse(segs[segs.Length-1]); serial = lastSerial + 1; } catch { } } ret += serial.ToString(); return kjcg.sbbm + "-" + ret.Substring(ret.Length - 3, 3); }
protected override PM getPM(OleDbDataReader reader, out String err) { err = String.Empty; KJCG_PM pm = new KJCG_PM(); if (hasFormatTable) { pm.flbm = reader["分类编码"].ToString().Trim(); pm.zydm = reader["专业代码"].ToString().Trim(); pm.cgdm = reader["成果代码"].ToString().Trim(); pm.sbbm = reader["上报编码"].ToString().Trim(); pm.zwmc = reader["中文名称"].ToString().Trim(); pm.cglb = reader["成果类别"].ToString().Trim(); string dateStr = reader["起始日期"].ToString().Trim(); try { if (!"".Equals(dateStr)) pm.qsrq = DateTime.Parse(dateStr); } catch { } dateStr = reader["终止日期"].ToString().Trim(); try { if (!"".Equals(dateStr)) pm.zzrq = DateTime.Parse(dateStr); } catch { } pm.xkdm = reader["学科代码"].ToString().Trim(); pm.gtfl = reader["国图分类"].ToString().Trim(); pm.zwztc = reader["中文主题词"].ToString().Trim(); pm.zwwz = reader["中文文摘"].ToString().Trim(); pm.ktly = reader["课题来源"].ToString().Trim(); pm.pjfs = reader["评价方式"].ToString().Trim(); pm.pjdw = reader["评价单位"].ToString().Trim(); dateStr = reader["评价日期"].ToString().Trim(); try { if (!"".Equals(dateStr)) pm.pjrq = DateTime.Parse(dateStr); } catch { } pm.pjyj = reader["评价意见"].ToString().Trim(); pm.jxmc = reader["奖项名称"].ToString().Trim(); pm.jldw = reader["奖励单位"].ToString().Trim(); pm.jlnd = reader["奖励年度"].ToString().Trim(); pm.sjdj = reader["授奖等级"].ToString().Trim(); pm.cqxs = reader["产权形式"].ToString().Trim(); pm.cqmc = reader["产权名称"].ToString().Trim(); pm.cqbs = reader["产权标识"].ToString().Trim(); pm.dydw = reader["第一单位"].ToString().Trim(); pm.dwsx = reader["单位属性"].ToString().Trim(); pm.lsgx = reader["隶属关系"].ToString().Trim(); pm.txdz = reader["通讯地址"].ToString().Trim(); pm.yzbm = reader["邮政编码"].ToString().Trim(); pm.lxdh = reader["联系电话"].ToString().Trim(); pm.czdh = reader["传真电话"].ToString().Trim(); pm.lxr = reader["联系人"].ToString().Trim(); pm.dzxx = reader["电子信箱"].ToString().Trim(); pm.qtdw = reader["其他单位"].ToString().Trim(); pm.dywcr = reader["第一完成人"].ToString().Trim(); pm.xb = reader["性别"].ToString().Trim(); pm.zwzc = reader["职务职称"].ToString().Trim(); pm.szdw = reader["所在单位"].ToString().Trim(); pm.dh = reader["电话"].ToString().Trim(); pm.qtwcr = reader["其他完成人"].ToString().Trim(); pm.tjdwyj = reader["推荐单位意见"].ToString().Trim(); pm.gxrq = DateTime.Now; try { pm.gx = Boolean.Parse(reader["共享"].ToString().Trim()); } catch (Exception) { pm.gx = false; } } else { //不支持 } pm.dlr = user.name; pm.fillEmptyStringAsNull(); return pm; }
/// <summary> /// 生成日志信息 /// </summary> /// <param name="kjcgPM">科技成果信息</param> /// <param name="opType">操作类型</param> /// <param name="uname">用户名</param> /// <returns></returns> private OperationLogItem GetOperationLogItem(KJCG_PM kjcgPM, String opType, String uname) { if (null == kjcgPM) { return null; } OperationLogItem operationLogItem = new OperationLogItem(); //操作类型 operationLogItem.opType = opType; //数据库表 operationLogItem.opTable = "KJCG_PM"; operationLogItem.opObjectID = "科技成果"; // 操作涉及的书刊 operationLogItem.opBookIn = "科技成果"; // 时间 operationLogItem.opDate = DateTime.Now; // 操作员 operationLogItem.opPerson = uname; //记录操作模式,判断是否属于批量操作。取值范围SINGLE/BATCH。 operationLogItem.opMode = "SINGLE"; //操作的内容 String content = "('" + kjcgPM.flbm + "','" + kjcgPM.zydm + "','" + kjcgPM.cgdm + "','" + kjcgPM.sbbm + "','" + kjcgPM.zwmc + "','" + kjcgPM.cglb + "','" + kjcgPM.qsrq + "','" + kjcgPM.zzrq + "','" + kjcgPM.xkdm + "','" + kjcgPM.gtfl + "','" + kjcgPM.zwztc + "','" + kjcgPM.zwwz + "','" + kjcgPM.ktly + "','" + kjcgPM.pjfs + "','" + kjcgPM.pjdw + "','" + kjcgPM.pjrq + "','" + kjcgPM.pjyj + "','" + kjcgPM.jxmc + "','" + kjcgPM.jldw + "','" + kjcgPM.jlnd + "','" + kjcgPM.sjdj + "','" + kjcgPM.cqxs + "','" + kjcgPM.cqmc + "','" + kjcgPM.cqbs + "','" + kjcgPM.dydw + "','" + kjcgPM.dwsx + "','" + kjcgPM.lsgx + "','" + kjcgPM.txdz + "','" + kjcgPM.yzbm + "','" + kjcgPM.lxdh + "','" + kjcgPM.czdh + "','" + kjcgPM.lxr + "','" + kjcgPM.dzxx + "','" + kjcgPM.qtdw + "','" + kjcgPM.dywcr + "','" + kjcgPM.xb + "','" + kjcgPM.zwzc + "','" + kjcgPM.szdw + "','" + kjcgPM.dh + "','" + kjcgPM.qtwcr + "','" + kjcgPM.tjdwyj + "','" + kjcgPM.gxrq + "','" + kjcgPM.gx + "','" + "')"; operationLogItem.opContent = content; return operationLogItem; }
/// <summary> /// 更新一条篇名信息 /// </summary> /// <param name="kjcg_pm">要更新的篇名信息</param> /// <param name="uname">操作用户名</param> /// <returns></returns> public Boolean UpdateKJCG_PM(KJCG_PM kjcg_pm, String uname) { Boolean flag = true; int back = sqlMapper.Update("UpdateKJCG_PM", kjcg_pm); if (back <= 0) { flag = false; } if (flag) { OperationLogItem operationLog = this.GetOperationLogItem(kjcg_pm, "UPDATE", uname); this.operationLogDAO.insertLogItem(operationLog); } return flag; }
/// <summary> /// 插入一条篇名信息 /// </summary> /// <param name="kjcg_pm">篇名信息</param> /// <returns></returns> public Boolean InsertKJCG_PM(KJCG_PM kjcg_pm) { Boolean flag = true; OperationLogItem operationLog = this.GetOperationLogItem(kjcg_pm, "INSERT", null); try { sqlMapper.Insert("InsertKJCG_PM", kjcg_pm); this.operationLogDAO.insertLogItem(operationLog); } catch (Exception) { flag = false; } return flag; }
/// <summary> /// 获取用户填写的科技成果篇名信息 /// </summary> /// <returns></returns> private KJCG_PM GetKJCGPM() { KJCG_PM kjcgPM = new KJCG_PM(); //成果代码 kjcgPM.cgdm = this.cgdmTextBox.Text; //分类编码 kjcgPM.flbm = this.flbmTextBox.Text; //上报编码 kjcgPM.sbbm = this.sbdmTextBox.Text; //专业代码 kjcgPM.zydm = this.zydmTextBox.Text.Trim(); //中文名称 kjcgPM.zwmc = this.zwmcTextBox.Text.Trim(); //成果类别 kjcgPM.cglb = this.cglbDropDownList.SelectedValue; //起始日期 if (!"".Equals(this.qsrqTextBox.Text)) kjcgPM.qsrq = DateTime.Parse(this.qsrqTextBox.Text); //终止日期 if(!"".Equals(this.zzrqTextBox.Text)) kjcgPM.zzrq = DateTime.Parse(this.zzrqTextBox.Text); //学科代码 kjcgPM.xkdm = this.xkdmTextBox.Text; //国图分类 kjcgPM.gtfl = this.gtflTextBox.Text; //中文主题词 kjcgPM.zwztc = this.zwztcTextBox.Text; //中文文摘 kjcgPM.zwwz = this.zwwzTextBox.Text; kjcgPM.ktly = this.ktlyTextBox.Text;//课题来源 kjcgPM.pjfs = this.pjfsTextBox.Text;//评价方式 kjcgPM.pjdw = this.pjdwTextBox.Text;//评价单位 if(!"".Equals(this.pjrqTextBox.Text)) kjcgPM.pjrq = DateTime.Parse(this.pjrqTextBox.Text);//评价日期 kjcgPM.pjyj = this.pjyjTextBox.Text;//评价意见 kjcgPM.jxmc = this.jxmcTextBox.Text;//奖项名称 kjcgPM.jldw = this.jldwTextBox.Text;//奖励单位 kjcgPM.jlnd = this.jlndTextBox.Text;//奖励年度 kjcgPM.sjdj = this.sjdjTextBox.Text;//授奖等级 kjcgPM.cqxs = this.cqxsTextBox.Text;//产权形式 kjcgPM.cqmc = this.cqmcTextBox.Text;//产权名称 kjcgPM.cqbs = this.cqbsTextBox.Text;//产权标识 kjcgPM.dydw = this.dydwTextBox.Text;//第一单位 kjcgPM.dwsx = this.dwsxTextBox.Text;//单位属性 kjcgPM.lsgx = this.lsgxTextBox.Text;//隶属关系 kjcgPM.txdz = this.txdzTextBox.Text;//通讯地址 kjcgPM.yzbm = this.yzbmTextBox.Text;//邮政编码 kjcgPM.lxdh = this.lxdhTextBox.Text;//联系电话 kjcgPM.czdh = this.czdhTextBox.Text;//传真电话 kjcgPM.lxr = this.lxrTextBox.Text;//联系人 kjcgPM.dzxx = this.dzxxTextBox.Text;//电子邮箱 kjcgPM.qtdw = this.qtdwTextBox.Text;//其他单位 kjcgPM.dywcr = this.dywcrTextBox.Text;//第一完成人 kjcgPM.xb = this.xbDropDownList.SelectedValue;//性别 kjcgPM.zwmc = this.zwmcTextBox.Text;//职务名称 kjcgPM.szdw = this.szdwTextBox.Text;//所在单位 kjcgPM.dh = this.dhTextBox.Text;//电话 kjcgPM.qtwcr = this.qtwcrTextBox.Text;//其他完成人 kjcgPM.tjdwyj = this.tjdwyjTextBox.Text;//推荐单位意见 kjcgPM.gx = this.gxCheckBox.Checked;//共享 try { kjcgPM.gxrq = DateTime.Parse(this.gxrqTextBox.Text.Trim()); } catch { kjcgPM.gxrq = DateTime.Now;//更新日期 } return kjcgPM; }