Exemplo n.º 1
0
        protected override PM getPM(OleDbDataReader reader, out String err)
        {
            err = String.Empty;
            HYBZ_PM pm = new HYBZ_PM();
            if (hasFormatTable)
            {
                pm.flbm = reader["分类编码"].ToString().Trim();
                pm.bzwh = reader["标准文号"].ToString();
                pm.ybzwh = pm.bzwh; //记住原有的“标准文号”
                pm.wjm = reader["文件名"].ToString().Trim();
                pm.ywjm = pm.wjm;

                pm.icsfl = reader["ICS分类"].ToString().Trim();
                pm.gbfl = reader["GB分类"].ToString().Trim();
                pm.zyfl = reader["专业分类"].ToString().Trim();
                pm.bbxz = reader["版本性质"].ToString().Trim();
                pm.zwmc = reader["中文名称"].ToString().Trim();
                pm.wwmc = reader["外文名称"].ToString().Trim();

                try
                {
                    pm.isOK = Boolean.Parse(reader["强制导入"].ToString());
                }
                catch
                {
                    pm.isOK = false;
                }

                string dateStr = "";
                dateStr = reader["发布日期"].ToString().Trim();
                try
                {
                    if (!String.Empty.Equals(dateStr))
                    {
                        pm.fbrq = DateTime.Parse(dateStr);
                    }
                } catch
                {
                    err += pm.bzwh + ": 发布日期\"" + reader["发布日期"] + "\"出错\n";
                }

                dateStr = reader["实施日期"].ToString().Trim();
                try
                {
                    if (!String.Empty.Equals(dateStr))
                    {
                        pm.ssrq = DateTime.Parse(dateStr);
                    }
                }
                catch
                {
                    err += pm.bzwh + ": 实施日期\"" + reader["实施日期"] + "\"出错\n";
                }

                pm.cygx = reader["采用关系"].ToString().Trim();
                string yeshu = "";
                yeshu = reader["页数"].ToString().Trim();

                try
                {
                    if (!String.Empty.Equals(yeshu))
                    {
                        pm.ys = Int32.Parse(yeshu);
                    }
                    else pm.ys = 0;
                } catch
                {
                    err += pm.bzwh + ": 页数\"" + reader["页数"] + "\"出错\n";
                }

                try
                {
                    pm.zf = Boolean.Parse(reader["作废"].ToString().Trim());
                }
                catch (Exception)
                {
                    pm.zf = false;
                }

                if (true == pm.zf) pm.zf1 = "T";
                else pm.zf1 = "F";

                pm.dtbz = reader["代替标准"].ToString().Trim();
                pm.bdtbz = reader["被代替标准"].ToString().Trim();
                pm.zfnf = reader["作废年份"].ToString().Trim();
                pm.zwztc = reader["中文主题词"].ToString().Trim();
                pm.wwztc = reader["外文主题词"].ToString().Trim();
                pm.qcdw = reader["起草单位"].ToString().Trim();
                pm.fbdw = reader["发布单位"].ToString().Trim();
                pm.gkdw = reader["归口单位"].ToString().Trim();
                pm.bzdhhy = reader["标准代号含义"].ToString().Trim();
                pm.bz = reader["备注"].ToString().Trim();
                pm.gxx = reader["更新项"].ToString().Trim();

                pm.qrnd = reader["确认年代"].ToString().Trim();
                pm.ly = reader["来源"].ToString().Trim();

            }
            else
            {
                //不支持
            }

            pm.gxrq = DateTime.Now;
            pm.dlr = user.name;
            pm.fillEmptyStringAsNull();

            return pm;
        }
Exemplo n.º 2
0
        /// <summary>
        /// 更新潜在的替代标准和被替代标准关系
        /// </summary>
        /// <param name="gp"></param>
        /// <returns></returns>
        public String UpdateDTBZ(HYBZ_PM gp)
        {
            String err = String.Empty;
            if (gp.bzwh.LastIndexOf('-') < 0)
            {
                err = "标准文号缺少年份 ";
                return err;
            }

            //进行标准替代关系的更新, 确保标准文号格式正确
            string pre_wh = gp.bzwh.Substring(0, gp.bzwh.LastIndexOf('-') + 1);

            //找到代替的标准,只代替最近的标准
            HYBZ_PM gpm = hybzDAO.GetAlikeHYBZ_PM(pre_wh, gp.bzwh, "desc");

            if (gpm != null && gpm.bzwh.CompareTo(gp.bzwh) < 0)
            {
                gpm.zf = false;
                gpm.zf1 = "F";

                gpm.zfnf = gp.bzwh.Substring(gp.bzwh.Length - 4);
                if (GlobalMethod.IsBzInvalid(gp.ssrq))
                {
                    gpm.zf = true;
                    gpm.zf1 = "T";
                }

                string bzwh_full = ComposeFullBZWH(gp);

                if (gpm.bdtbz == null)
                {
                    gpm.bdtbz = bzwh_full;
                }
                else if (gpm.bdtbz.IndexOf(gp.bzwh) < 0 && gpm.bdtbz.IndexOf(bzwh_full) < 0)
                {
                    if (!"".Equals(gpm.bdtbz)) gpm.bdtbz += ";";
                    gpm.bdtbz += bzwh_full;
                }

                bzwh_full = ComposeFullBZWH(gpm);

                if (gp.dtbz == null)
                {
                    gp.dtbz = bzwh_full;
                }
                else if (gp.dtbz.IndexOf(gpm.bzwh) < 0 && gp.dtbz.IndexOf(bzwh_full) < 0)
                {
                    if (!"".Equals(gp.dtbz)) gp.dtbz += ";";
                    gp.dtbz += bzwh_full;
                }

                try
                {
                    hybzDAO.UpdateHYBZ_PM(gpm, user.name);

                    /* 更新access表中记录 */
                    if (gp.bzwjm.Equals("NULL"))
                    {

                        gp.fillEmptyStringAsNull();
                        deletePM((PM)gp, out err);
                        insertPM((PM)gp);
                        gp.eraseNullInEmptyString();

                    }
                }
                catch
                {
                    err += "更新替代关系错误 ";
                }
            }

            return err;
        }