示例#1
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public int Add(nics_alert model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into nics_alert(");
            strSql.Append("regulator_id,alert_type,alert_info,alert_time)");
            strSql.Append(" values (");
            strSql.Append("@regulator_id,@alert_type,@alert_info,@alert_time)");
            MySqlParameter[] parameters =
            {
                new MySqlParameter("@regulator_id", MySqlDbType.Int32,    11),
                new MySqlParameter("@alert_type",   MySqlDbType.VarChar,  32),
                new MySqlParameter("@alert_info",   MySqlDbType.VarChar, 255),
                new MySqlParameter("@alert_time",   MySqlDbType.DateTime)
            };
            parameters[0].Value = model.regulator_id;
            parameters[1].Value = model.alert_type;
            parameters[2].Value = model.alert_info;
            parameters[3].Value = model.alert_time;

            int iRst = 0;

            using (var db = new DatabaseContext())
            {
                iRst = db.Database.ExecuteSqlCommand(strSql.ToString(), parameters);
            };
            return(iRst);
        }
示例#2
0
 /// <summary>
 /// 更新数据
 /// </summary>
 /// <param name="oNics_alert"></param>
 /// <returns>返回更新的记录条数</returns>
 public int Add(nics_alert oNics_alert)
 {
     if (oNics_alert.alert_info == StateType.SocketOffline.ToString())
     {
         oNics_alert.alert_info = "控制器网络通讯异常";
     }
     else if (oNics_alert.alert_info == StateType.ControllerOffline.ToString())
     {
         oNics_alert.alert_info = "控制器命令交互异常";
     }
     else
     {
     }
     return(m_DAL.Add(oNics_alert));
 }
示例#3
0
        public override void ExecuteCommand(MySession session, MyRequestInfo requestInfo)
        {
            if (requestInfo.IsCorrectPkg)
            {
                if (requestInfo.BodyKey == "MINUTEDATA")
                {
                    nics_regulator_output    oNics_regulator_output    = JsonConvert.DeserializeObject <nics_regulator_output>(requestInfo.Content);
                    nics_regulator_outputBLL oNics_regulator_outputBLL = new nics_regulator_outputBLL();
                    oNics_regulator_outputBLL.Add(oNics_regulator_output);
                }
                else if (requestInfo.BodyKey == "ALERTDATA")
                {
                    nics_alert    oNics_alert    = JsonConvert.DeserializeObject <nics_alert>(requestInfo.Content);
                    nics_alertBLL oNics_alertBLL = new nics_alertBLL();
                    oNics_alertBLL.Add(oNics_alert);
                }
                else
                {
                }
            }


            //session.Send(requestInfo.Parameters.Select(p => int.Parse(p)).Sum().ToString());
        }