Example #1
0
        /// <summary>
        /// 删除信息类型
        /// </summary>
        /// <returns></returns>
        public bool DelNewsType(g_newstype mod)
        {
            bool b = false;

            OpSql.Open();
            try
            {
                b = OpSql.Delete(new object[] { mod });
            }
            catch { }
            finally { OpSql.Close(); }
            return(b);
        }
Example #2
0
        /// <summary>
        /// 修改信息类型
        /// </summary>
        /// <returns></returns>
        public bool EditNewsType(g_newstype mod, g_newstype mod2)
        {
            bool b = false;

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

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

            if (!m_incAdmin.OpString.DecideNull(query.ToArray()))
            {
                if (!m_incAdmin.OpString.DetectSql(query.ToArray(), Config.g_illegal))
                {
                    g_newstype mod = new g_newstype();
                    mod.nt_id = int.Parse(nt_id);
                    if (m_incAdmin.DelNewsType(mod))
                    {
                        result.Add("success", SysError.GetErrorString("DEL000"));
                    }
                    else
                    {
                        result.Add("error", SysError.GetErrorString("DEL001"));
                    }
                }
                else
                {
                    result.Add("error", SysError.GetErrorString("SYS001"));
                }
            }
            else
            {
                result.Add("error", SysError.GetErrorString("SYS002"));
            }

            return(new JsonResult(result.ToString()));
        }
Example #4
0
        public IActionResult OnPostSaveNewsType()
        {
            JObject result = new JObject();

            string        nt_id      = Request.Form["nt_id"];
            string        nt_name    = Request.Form["nt_name"];
            string        nt_pid     = Request.Form["nt_pid"];
            string        nt_top     = Request.Form["nt_top"];
            string        nt_examine = Request.Form["nt_examine"];
            List <string> query      = new List <string>()
            {
                nt_name, nt_pid, nt_top, nt_examine
            };

            if (!m_incAdmin.OpString.DecideNull(query.ToArray()))
            {
                query.AddRange(new string[] { nt_id });
                if (!m_incAdmin.OpString.DetectSql(query.ToArray(), Config.g_illegal))
                {
                    if (string.IsNullOrEmpty(nt_id))
                    {
                        g_newstype mod = new g_newstype();
                        mod.nt_name    = nt_name;
                        mod.nt_pid     = int.Parse(nt_pid);
                        mod.nt_top     = int.Parse(nt_top);
                        mod.nt_examine = bool.Parse(nt_examine);
                        if (m_incAdmin.AddNewsType(mod))
                        {
                            result.Add("success", SysError.GetErrorString("ADD000"));
                        }
                        else
                        {
                            result.Add("error", SysError.GetErrorString("ADD001"));
                        }
                    }
                    else
                    {
                        g_newstype mod = new g_newstype();
                        mod.nt_id = int.Parse(nt_id);
                        g_newstype mod2 = new g_newstype();
                        mod2.nt_name    = nt_name;
                        mod2.nt_pid     = int.Parse(nt_pid);
                        mod2.nt_top     = int.Parse(nt_top);
                        mod2.nt_examine = bool.Parse(nt_examine);
                        if (m_incAdmin.EditNewsType(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()));
        }