示例#1
0
文件: DLBK_MDB.cs 项目: Brinews/Code
        protected override PM getPM(OleDbDataReader reader, out String err)
        {
            err = String.Empty;
            DLBK_PM pm = new DLBK_PM();
            if (hasFormatTable)
            {
                pm.flbm = reader["分类编码"].ToString().Trim();
                pm.bt = reader["标题"].ToString().Trim();
                pm.zz = reader["作者"].ToString().Trim();

                try
                {
                    if (!String.Empty.Equals(reader["日期"].ToString().Trim()))
                        pm.rq = DateTime.Parse(reader["日期"].ToString().Trim());
                }
                catch
                {
                    err += "日期\"" + reader["日期"] + "\"不正确" + pmKeyInfo(pm);
                }

                try
                {
                    pm.bh = int.Parse(reader["版号"].ToString().Trim());
                }
                catch (Exception)
                {
                    pm.bh = 0;
                }

                pm.lm = reader["栏目"].ToString().Trim();
                pm.zw = reader["正文"].ToString().Trim();
            }
            else
            {
                pm.bt = reader["正标题"].ToString().Trim() + reader["副标题"].ToString().Trim();
                pm.zz = reader["作者"].ToString().Trim();
                pm.lm = reader["栏目"].ToString().Trim();
                pm.zw = reader["全文"].ToString().Trim();

                try
                {
                    pm.bh = Int32.Parse(reader["版号"].ToString().Trim());
                }
                catch
                {
                    pm.bh = 0;
                }

                try
                {
                    if (!String.Empty.Equals(reader["日期"].ToString().Trim()))
                        pm.rq = DateTime.Parse(reader["日期"].ToString().Trim());
                }
                catch
                {
                    err += "日期\"" + reader["日期"] + "\"不正确";
                }

                if (pm.bt.Length > 255)
                    pm.bt = pm.bt.Substring(0, 255);

                String bzzwm = reader["报纸中文名"].ToString().Trim();

                foreach (DLBK_FL dlbk in dlbkFL)
                {
                    if (bzzwm.Equals(dlbk.flmc.Trim()))
                    {
                        pm.flbm = dlbk.flbm;
                        break;
                    }
                }

                if (null == pm.flbm && "".Equals(pm.flbm))
                {
                    pm.flbm = "";
                    err += " 分类编码未能找到" + "报纸中文名\"" + bzzwm + "\"";
                }

                if (!String.Empty.Equals(err))
                    err += pmKeyInfo(pm);
            }

            pm.dlr = user.name;
            pm.gxrq = DateTime.Now;

            pm.fillEmptyStringAsNull();

            return pm;
        }
示例#2
0
文件: DLBK_DAO.cs 项目: Brinews/Code
        /// <summary>
        /// 生成日志信息
        /// </summary>
        /// <param name="zwqkPM">电力报刊刊信息</param>
        /// <param name="opType">操作类型</param>
        /// <param name="uname">用户名</param>
        /// <returns></returns>
        private OperationLogItem GetOperationLogItem(DLBK_PM dlbkPM, String opType, String uname)
        {
            if (null == dlbkPM)
            {
                return null;
            }

            OperationLogItem operationLogItem = new OperationLogItem();
            //操作类型
            operationLogItem.opType = opType;
            //数据库表
            operationLogItem.opTable = "DLBK_PM";
            //全文页数
            try
            {
                operationLogItem.opPageCount = 0;
            }
            catch (Exception)
            {
            }

            operationLogItem.opObjectID = "电力报刊";
            // 操作涉及的书刊
            operationLogItem.opBookIn = "电力报刊";

            // 时间
            operationLogItem.opDate = DateTime.Now;
            // 操作员
            operationLogItem.opPerson = uname;
            //记录操作模式,判断是否属于批量操作。取值范围SINGLE/BATCH。
            operationLogItem.opMode = "SINGLE";

            //操作的内容
            String content = "('" + dlbkPM.flbm + "','" + dlbkPM.bt + "','" + dlbkPM.zz + "','" + dlbkPM.rq + "','" + dlbkPM.bh + "','" + dlbkPM.lm + "','" + dlbkPM.zw + "')";
            operationLogItem.opContent = content;
            return operationLogItem;
        }
示例#3
0
文件: DLBK_DAO.cs 项目: Brinews/Code
 /// <summary>
 /// 更新一条篇名信息
 /// </summary>
 /// <param name="dlbk_pm">要更新的篇名信息</param>
 /// <param name="uname">操作用户名</param>
 /// <returns></returns>
 public Boolean UpdateDLBK_PM(DLBK_PM dlbk_pm, String uname)
 {
     Boolean flag = true;
     int back = sqlMapper.Update("UpdateDLBK_PM", dlbk_pm);
     if (back <= 0)
     {
         flag = false;
     }
     if (flag)
     {
         OperationLogItem operationLog = this.GetOperationLogItem(dlbk_pm, "UPDATE", uname);
         this.operationLogDAO.insertLogItem(operationLog);
     }
     return flag;
 }
示例#4
0
文件: DLBK_DAO.cs 项目: Brinews/Code
 /// <summary>
 /// 插入一条篇名信息
 /// </summary>
 /// <param name="dlbk_pm">篇名信息</param>
 /// <returns></returns>
 public Boolean InsertDLBK_PM(DLBK_PM dlbk_pm)
 {
     Boolean flag = true;
     OperationLogItem operationLog = this.GetOperationLogItem(dlbk_pm, "INSERT", null);
     sqlMapper.Insert("InsertDLBK_PM", dlbk_pm);
     this.operationLogDAO.insertLogItem(operationLog);
     return flag;
 }
示例#5
0
    /// <summary>
    /// 获取用户填写的电力报刊篇名信息
    /// </summary>
    /// <returns></returns>
    private DLBK_PM GetDLBKPM()
    {
        DLBK_PM dlbkPM = new DLBK_PM();
        //分类编码
        dlbkPM.flbm = this.flbmTextBox.Text;
        //标题
        dlbkPM.bt = this.btTextBox.Text.Trim();
        //作者
        dlbkPM.zz = this.zzTextBox.Text.Trim();
        //日期
        dlbkPM.rq = DateTime.Parse(this.rqTextBox.Text);
        //版号
        dlbkPM.bh = Int32.Parse(this.bhTextBox.Text);
        //栏目
        dlbkPM.lm = this.lmTextBox.Text.Trim();
        //日期
        try
        {
            dlbkPM.rq = DateTime.Parse(this.rqTextBox.Text);
        }
        catch { }

        try
        {
            dlbkPM.gxrq = DateTime.Parse(this.gxrqTextBox.Text.Trim());
        }
        catch
        {
            dlbkPM.gxrq = DateTime.Now;
        }

        //登录人
        dlbkPM.dlr = this.dlrTextBox.Text;
        //正文
        dlbkPM.zw = this.zwTextBox.Text;

        return dlbkPM;
    }
示例#6
0
文件: DLBK_DAO.cs 项目: Brinews/Code
 /// <summary>
 /// 插入一条篇名信息
 /// </summary>
 /// <param name="dlbk_pm">篇名信息</param>
 /// <returns></returns>
 public Boolean InsertDLBK_PM(DLBK_PM dlbk_pm)
 {
     Boolean flag = true;
     OperationLogItem operationLog = this.GetOperationLogItem(dlbk_pm, "INSERT", null);
     try
     {
         sqlMapper.Insert("InsertDLBK_PM", dlbk_pm);
         this.operationLogDAO.insertLogItem(operationLog);
     }
     catch (Exception)
     {
         flag = false;
     }
     return flag;
 }