Exemplo n.º 1
0
        /*
         * ===========================================
         * 留言
         * ===========================================
         */
        #region 留言
        /// <summary>
        /// 添加留言
        /// </summary>
        /// <param name="mod">mod</param>
        public bool AddMessage(g_message mod)
        {
            bool b = false;

            OpSql.Open();
            try
            {
                b = OpSql.Insert(new object[] { mod });
            }
            catch { }
            finally { OpSql.Close(); }
            return(b);
        }
Exemplo n.º 2
0
        /// <summary>
        /// 修改留言
        /// </summary>
        /// <returns></returns>
        public bool EditMessage(g_message mod, g_message mod2)
        {
            bool b = false;

            OpSql.Open();
            try
            {
                b = OpSql.Update(new object[] { mod }, new object[] { mod2 });
            }
            catch { }
            finally { OpSql.Close(); }
            return(b);
        }
Exemplo n.º 3
0
        public IActionResult OnPostAddMessage()
        {
            JObject result = new JObject();

            string        m_name    = Request.Form["m_name"];
            string        m_email   = Request.Form["m_email"];
            string        m_content = Request.Form["m_content"];
            List <string> list      = new List <string>()
            {
                m_name, m_content
            };

            if (!m_inc.OpString.DecideNull(list.ToArray()))
            {
                list.Add(m_email);
                if (!m_inc.OpString.DetectSql(list.ToArray()))
                {
                    if (!m_inc.HasMessageToday())
                    {
                        g_message mod = new g_message();
                        mod.m_name    = m_name;
                        mod.m_email   = m_email;
                        mod.m_content = m_content;
                        mod.m_ip      = m_inc.OpMemory.IPAddress;
                        if (m_inc.AddMessage(mod))
                        {
                            result.Add("success", SysError.GetErrorString("MESSAGE000"));
                        }
                        else
                        {
                            result.Add("error", SysError.GetErrorString("MESSAGE001"));
                        }
                    }
                    else
                    {
                        result.Add("error", SysError.GetErrorString("MESSAGE002"));
                    }
                }
                else
                {
                    result.Add("error", SysError.GetErrorString("SYS001"));
                }
            }
            else
            {
                result.Add("error", SysError.GetErrorString("SYS002"));
            }

            return(new JsonResult(result.ToString()));
        }
Exemplo n.º 4
0
        public IActionResult OnPostSaveMessage()
        {
            JObject result = new JObject();

            string        m_id     = Request.Form["m_id"];
            string        m_isread = Request.Form["m_isread"];
            List <string> query    = new List <string>()
            {
                m_id, m_isread
            };

            if (!m_incAdmin.OpString.DecideNull(query.ToArray()))
            {
                if (!m_incAdmin.OpString.DetectSql(query.ToArray(), Config.g_illegal))
                {
                    g_message mod = new g_message();
                    mod.m_id = int.Parse(m_id);
                    g_message mod2 = new g_message();
                    mod2.m_isread = bool.Parse(m_isread);
                    if (m_incAdmin.EditMessage(mod, mod2))
                    {
                        result.Add("success", SysError.GetErrorString("EDIT000"));
                    }
                    else
                    {
                        result.Add("error", SysError.GetErrorString("EDIT001"));
                    }
                }
                else
                {
                    result.Add("error", SysError.GetErrorString("SYS001"));
                }
            }
            else
            {
                result.Add("error", SysError.GetErrorString("SYS002"));
            }

            return(new JsonResult(result.ToString()));
        }