/// <summary> /// 规整字段 /// </summary> /// <param name="pm">要规整的记录</param> /// <returns>反馈规整信息,规整错误</returns> public virtual String formatSyml(SYML syml) { MessageBox.Show("formatSyml 未实现", "错误", MessageBoxButton.OK, MessageBoxImage.Error); return null; }
/// <summary> /// 在本地删除一条记录 /// </summary> /// <param name="pm"></param> /// <returns></returns> public virtual int deleteSyml(SYML syml, out String err) { MessageBox.Show("deleteSyml 未实现", "错误", MessageBoxButton.OK, MessageBoxImage.Error); err = String.Empty; return 0; }
public virtual Boolean findServerSymlDuplicate(SYML syml) { MessageBox.Show("findServerSymlDuplicate 未实现", "错误", MessageBoxButton.OK, MessageBoxImage.Error); return false; }
public virtual String addOneSymlRecord(SYML syml) { MessageBox.Show("addOneSymlRecord 未实现", "错误", MessageBoxButton.OK, MessageBoxImage.Error); return String.Empty; }
public virtual Boolean checkSymlValid(SYML syml, out String errMsg) { MessageBox.Show("checkSymlValid 未实现", "错误", MessageBoxButton.OK, MessageBoxImage.Error); errMsg = String.Empty; return true; }
public virtual String insertSymlwithUpdateSybm(SYML syml) { MessageBox.Show("insertSymlwithUpdateSybm 未实现", "错误", MessageBoxButton.OK, MessageBoxImage.Error); return String.Empty; }
/// <summary> /// 在本地更新一条索引记录 /// </summary> /// <param name="syml">要更新的索引目录信息</param> /// <returns>更新结果,空更新成功;非空新成功</returns> public String updateSyml(SYML syml) { // 另一种方法是先delete再insert,就不用每文库都写了 String err; deleteSyml(syml, out err); err += insertSyml(syml); return err; }
public override String insertSymlwithUpdateSybm(SYML syml) { String err = String.Empty; WWHY_SYML wwhy = (WWHY_SYML)syml; string maxSybm = wwhyDAO.getMaxWwhySYML(wwhy.flbm, wwhy.nf.ToString()); int serial; if (maxSybm != null) { int pos = maxSybm.LastIndexOf('-'); serial = int.Parse(maxSybm.Substring(pos + 1, 3)) + 1; String serialStr = "0000" + serial.ToString(); wwhy.sybm = maxSybm.Substring(0, pos + 1) + serialStr.Substring(serialStr.Length - 3); } else { serial = 1; String serialStr = "0000" + serial.ToString(); wwhy.sybm = wwhy.flbm + "-" + wwhy.nf.ToString() + "-" + serialStr.Substring(serialStr.Length - 3); } try { wwhyDAO.insertWwhySYML(wwhy); } catch (Exception e) { err += e.Message + "\n"; } return err; }
/// <summary> /// 处理出错的索引目录信息 /// </summary> /// <param name="syml">出错的索引信息</param> /// <param name="errMsg">出错提示信息</param> public void handleWrongSyml(SYML syml, String errMsg, TextBox logViewer) { syml.isValid = false; logInfo(logViewer, errMsg); }
public override string formatSyml(SYML syml) { //反馈信息 String result = String.Empty; String Empty = "NULL"; WWHY_SYML wwhy = (WWHY_SYML)syml; wwhy.wz = "英"; wwhy.zbdw = GlobalMethod.Semicolon(wwhy.zbdw); wwhy.cbdw = GlobalMethod.Semicolon(wwhy.cbdw); wwhy.chbdw = GlobalMethod.Semicolon(wwhy.chbdw); wwhy.gtfl = GlobalMethod.Semicolon(wwhy.gtfl); wwhy.sybm = "自动生成"; wwhy.dlrq = DateTime.Now; if (Empty.Equals(wwhy.wwmc) && Empty.Equals(wwhy.zwmc)) { result += "外文名称为空 "; } if (Empty.Equals(wwhy.gch)) { result += "馆藏号为空 "; } if (!result.Equals(String.Empty)) { result += " : 《" + wwhy.ToString() + "》\n"; } return result; }
public override String insertSyml(SYML syml) { WWHY_SYML wwhy = (WWHY_SYML)syml; int back; String err = String.Empty; //打开连接 this.openOleDbConnection(); OleDbCommand sqlcmd = new OleDbCommand(); sqlcmd.CommandText = @"insert into " + symlTableName + @"(分类编码,索引编码,年份,文种,中文名称,外文名称,主办单位,承办单位,出版单位,发布日期,国图分类,会议地点,简介,馆藏号,登录日期) values(@分类编码,@索引编码,@年份,@文种,@中文名称,@外文名称,@主办单位,@承办单位,@出版单位,@发布日期,@国图分类,@会议地点,@简介,@馆藏号,@登录日期)"; sqlcmd.Connection = this.ObjConnection; sqlcmd.Parameters.Add(new OleDbParameter("分类编码", wwhy.flbm)); sqlcmd.Parameters.Add(new OleDbParameter("索引编码", wwhy.sybm)); sqlcmd.Parameters.Add(new OleDbParameter("年份", wwhy.nf)); sqlcmd.Parameters.Add(new OleDbParameter("文种", wwhy.wz)); sqlcmd.Parameters.Add(new OleDbParameter("中文名称", wwhy.zwmc)); sqlcmd.Parameters.Add(new OleDbParameter("外文名称", wwhy.wwmc)); sqlcmd.Parameters.Add(new OleDbParameter("主办单位", wwhy.zbdw)); sqlcmd.Parameters.Add(new OleDbParameter("承办单位", wwhy.cbdw)); sqlcmd.Parameters.Add(new OleDbParameter("出版单位", wwhy.chbdw)); sqlcmd.Parameters.Add(new OleDbParameter("发布日期", wwhy.fbrq)); sqlcmd.Parameters.Add(new OleDbParameter("国图分类", wwhy.gtfl)); sqlcmd.Parameters.Add(new OleDbParameter("会议地点", wwhy.hydd)); sqlcmd.Parameters.Add(new OleDbParameter("简介", wwhy.gtfl)); sqlcmd.Parameters.Add(new OleDbParameter("馆藏号", wwhy.gch)); OleDbParameter parameter = new OleDbParameter("登陆日期", OleDbType.DBDate); parameter.Value = wwhy.dlrq; sqlcmd.Parameters.Add(parameter); try { back = sqlcmd.ExecuteNonQuery(); } catch (Exception e) { err = e.Message + "\n"; } sqlcmd.Parameters.Clear(); return err; }
public override bool findServerSymlDuplicate(SYML syml) { WWHY_SYML wwhy = (WWHY_SYML)syml; int result = wwhyDAO.countQueryWwhySYML(wwhy.flbm, wwhy.wwmc); if (result > 0) return true; else return false; }
public override int deleteSyml(SYML syml, out String err) { int back = 0; err = String.Empty; WWHY_SYML wwhy = (WWHY_SYML)syml; //打开连接 this.openOleDbConnection(); OleDbCommand sqlcmd = new OleDbCommand(); //sql语句 sqlcmd.CommandText = @"delete from " + symlTableName + " where 分类编码=@分类编码 and 外文名称=@外文名称 and 馆藏号=@馆藏号"; sqlcmd.Connection = this.ObjConnection; sqlcmd.Parameters.Add(new OleDbParameter("分类编码", wwhy.flbm)); sqlcmd.Parameters.Add(new OleDbParameter("外文名称", wwhy.wwmc)); sqlcmd.Parameters.Add(new OleDbParameter("馆藏号", wwhy.gch)); try { back = sqlcmd.ExecuteNonQuery(); } catch (Exception e) { err = "Exception: " + e.Message + "\n"; } sqlcmd.Parameters.Clear(); return back; }
public override bool checkSymlValid(SYML syml, out string errMsg) { errMsg = String.Empty; WWHY_SYML wwhy = (WWHY_SYML)syml; this.openOleDbConnection(); sqlcmd.CommandText = @"select * from " + symlTableName + " where 分类编码=@分类编码 and 外文名称=@外文名称 and 馆藏号=@馆藏号"; sqlcmd.Connection = this.ObjConnection; sqlcmd.Parameters.Add(new OleDbParameter("分类编码", wwhy.flbm)); sqlcmd.Parameters.Add(new OleDbParameter("外文名称", wwhy.wwmc)); sqlcmd.Parameters.Add(new OleDbParameter("馆藏号", wwhy.gch)); OleDbDataReader reader = sqlcmd.ExecuteReader(); if (reader.Read()) { reader.Close(); sqlcmd.Parameters.Clear(); return true; } else { reader.Close(); sqlcmd.Parameters.Clear(); return false; } }
public override string addOneSymlRecord(SYML syml) { String err = String.Empty; WWHY_SYML wwhy = (WWHY_SYML)syml; wwhy.dlrq = DateTime.Now; wwhy.eraseNullInEmptyString(); err += insertSymlwithUpdateSybm(syml); return err; }
public override bool findServerSymlDuplicate(SYML syml) { ZWHY_SYML zwhy = (ZWHY_SYML)syml; int result = zwhyDAO.countQueryZwhySYML(zwhy.flbm, zwhy.zwmc); if (result > 0) return true; else return false; }