Exemplo n.º 1
0
        /// <summary>
        /// 设置消息状态
        /// </summary>
        /// <param name="IsDeal"></param>
        /// <param name="EmployeeId"></param>
        /// <param name="IpAddress"></param>
        public void SetStatus(bool IsDeal, int EmployeeId, string IpAddress)
        {
            //0,未处理,1、仅标记为已读,2、已做处理
            string sql = "update pub_message_record set DealStatus = {0},FirstReader={1},ReadTime=getdate(),ReadByIP = '{2}'  where MsgId = '{3}'";

            sql += " and FirstReader=0 and ReadTime is null and ReadByIP=''";
            if (IsDeal)
            {
                sql = string.Format(sql, 2, EmployeeId, IpAddress, this.messageId.ToString());
            }
            else
            {
                sql = string.Format(sql, 1, EmployeeId, IpAddress, this.messageId.ToString());
            }
            try
            {
                RelationalDatabase database = new TrasenClasses.DatabaseAccess.MsSqlServer();
                database.Initialize(WorkStaticFun.GetConnnectionString_Default(ConnectionType.SQLSERVER));
                database.Open();
                database.DoCommand(sql);
                database.Close();
            }
            catch (Exception error)
            {
                FrmMdiMain.WriteFrameLocalLog(new string[] { "更改消息状态失败!", error.Message, error.StackTrace }, true);
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// 根据参数ID构造对象
        /// </summary>
        /// <param name="cfgID"></param>
        public SystemCfg(int cfgID)
        {
            InitDatabase();
            try
            {
                _dbType = DatabaseType.SqlServer;
                //FrmMdiMain.WriteFrameLocalLog(new string[] { string.Format("测试参数问题{0}", "SystemCfg(int cfgID):1-cfgID:" + cfgID.ToString()) }, true);
                DataRow dr = DataRowConfig(cfgID); //2013-7-18 修改 取内存表
                if (dr == null)
                {
                    dr = _database.GetDataRow("SELECT * FROM JC_CONFIG(nolock) WHERE ID=" + cfgID);
                }

                //FrmMdiMain.WriteFrameLocalLog(new string[] { string.Format("测试参数问题{0}", "SystemCfg(int cfgID):2-cfgID:" + cfgID.ToString()) }, true);
                if (dr == null)
                {
                    _cfgID = -1;
                    throw new Exception("指定的参数记录不存在:" + cfgID);
                }

                //FrmMdiMain.WriteFrameLocalLog(new string[] { string.Format("测试参数问题{0}", "SystemCfg(int cfgID):3-cfgID:" + cfgID.ToString()) + ":列:" + GetTableColumnsName(dr.Table) }, true);
                _cfgID     = cfgID;
                _config    = Convertor.IsNull(dr["CONFIG"], "");
                _note      = Convertor.IsNull(dr["NOTE"], "");
                _moduleID  = Convert.ToInt32(Convertor.IsNull(dr["MODULE_ID"], "-1"));
                _paraLevel = Convert.ToInt16(Convertor.IsNull(dr["CSJB"], "-1"));
                _writable  = Convert.ToInt16(Convertor.IsNull(dr["RWBZ"], "0")) > 0 ? true : false;
                _varType   = Convert.ToInt16(Convertor.IsNull(dr["BLBZ"], "-1"));
                //FrmMdiMain.WriteFrameLocalLog(new string[] { string.Format("测试参数问题{0}", "SystemCfg(int cfgID):4-cfgID:" + cfgID.ToString()) }, true);
                ReleaseDatabase();
            }
            catch (Exception err)
            {
                FrmMdiMain.WriteFrameLocalLog(new string[] { string.Format("测试参数问题{0}", "SystemCfg(int cfgID):err-cfgID:" + cfgID.ToString()) + err.Message }, true);
                throw new Exception("SystemCfg(int cfgID)\\读取系统参数表出错\n" + err.Message);
                //throw new Exception("SystemCfg\\读取系统参数表出错\n"+err.Message);
            }
        }