コード例 #1
0
        /// <summary>
        /// 动漫app由9miao社团研发,如有问题请登陆http://www.9miao.com/官网
        /// </summary>
        ///



        public void ProcessRequest(HttpContext context)
        {
            CallBackJson json   = new CallBackJson();
            jsonClass    jclass = new jsonClass();

            jclass.Status = "Error";
            jclass.Msg    = "服务器异常";
            try
            {
                string _id   = context.Request.Form["id"];          //小分类id
                string _name = context.Request.Form["name"];        //小分类名称
                string _type = context.Request.Form["type"];        //类型 0修改  1添加
                if (string.IsNullOrEmpty(_name.Trim()))
                {
                    throw new Exception("信息参数未空");
                }
                using (
                    CDBAccess cn =
                        new CDBAccess(System.Configuration.ConfigurationSettings.AppSettings["OledbStr"]))
                {
                    if (_type == "0")
                    {
                        cn.ExecSQL(@"UPDATE T0001 SET C00006=? WHERE C00004=?",
                                   new OleDbParameter[] {
                            new OleDbParameter("@C00003", _name),
                            new OleDbParameter("@C00001", _id)
                        });
                        jclass.Msg = "恭喜你!修改分类成功";
                    }
                    else
                    {
                        string systemid = cn.ExecScalar(@"select max(Val(C00004))+1 from T0001 where C00101 <> 6 ").ToString();
                        if (string.IsNullOrEmpty(systemid))
                        {
                            systemid = "1";
                        }
                        cn.ExecSQL(@"INSERT INTO T0001 (C00004,C00005,C00006,C00101) VALUES (?,?,?,?)",
                                   new OleDbParameter[] {
                            new OleDbParameter("@C00004", systemid),
                            new OleDbParameter("@C00005", ""),
                            new OleDbParameter("@C00006", _name),
                            new OleDbParameter("@C00101", _id)
                        });
                        jclass.Msg = "恭喜你!添加分类成功";
                    }
                    jclass.Status = "Success";
                }
            }
            catch (Exception ex)
            {
                jclass.Msg = ex.Message;
            }
            context.Response.Write(json.Serializer(jclass));
        }
コード例 #2
0
        /// <summary>
        /// 动漫app由9miao社团研发,如有问题请登陆http://www.9miao.com/官网
        /// </summary>
        ///


        public void ProcessRequest(HttpContext context)
        {
            string id = context.Request.Form["thisid"];

            if (!string.IsNullOrEmpty(id))
            {
                using (CDBAccess cn = new CDBAccess(System.Configuration.ConfigurationSettings.AppSettings["OledbStr"]))
                {
                    cn.ExecSQL("delete from T0000 where C00001 = '" + id + "'");
                    cn.ExecSQL("delete from T0001 where C00101 = " + id + "");
                    context.Response.Write("0");
                    context.Response.End();
                }
            }
            else
            {
                context.Response.Write("参数错误");
                context.Response.End();
            }
        }
コード例 #3
0
        protected void Button1_Click(object sender, EventArgs e)
        {
            string id      = Request.QueryString["id"];
            string name    = TextBox1.Text;
            string jianjie = TextBox2.Text;
            string leixing = Request.Form["checkname"];
            string tpdizhi = TextBox4.Text;
            string zuozhe  = TextBox5.Text;
            string jieshao = TextBox6.Text;

            using (CDBAccess cn = new CDBAccess(System.Configuration.ConfigurationSettings.AppSettings["OledbStr"]))
            {
                string   Tleixing = "";
                string[] T        = null;
                if (!string.IsNullOrEmpty(leixing))
                {
                    T = leixing.Split(',');
                    string Tsql = "";
                    if (T.Length > 0)
                    {
                        foreach (string s in T)
                        {
                            Tsql += " C00004 = '" + s + "' or";
                        }
                        Tsql = Tsql.Substring(0, Tsql.LastIndexOf("or"));
                        using (DataTable dt = cn.ExecQuery("select * from T0001 where " + Tsql))
                        {
                            foreach (DataRow dr in dt.Rows)
                            {
                                Tleixing += dr[2] + "/";
                            }
                            if (dt.Rows.Count > 0)
                            {
                                Tleixing = Tleixing.Substring(0, Tleixing.LastIndexOf("/"));
                            }
                        }
                    }
                }

                if (string.IsNullOrEmpty(id))
                {
                    Dictionary <string, string> dc = new Dictionary <string, string>();
                    int iid = int.Parse(cn.ExecQuery("select top 1 C00010 from T0003 order by C00010 desc").Rows[0][0].ToString()) + 1;
                    dc.Add("id", iid.ToString());
                    dc.Add("name", name);
                    dc.Add("jianjie", jianjie);
                    dc.Add("tpdizhi", tpdizhi);
                    dc.Add("zuozhe", zuozhe);
                    dc.Add("jieshao", jieshao);
                    dc.Add("tm", exPagers.getSecondEnd(DateTime.Now).ToString());

                    //添加
                    string sql = "insert into T0004(C00016,C00017,C00018,C00024,C00025,C00026,C00028,C00023) values (@id,@name,@jianjie,@tpdizhi,@zuozhe,@jieshao,1,@tm)";
                    cn.ExecSQL("insert into T0003 (C00010,C00011,C00013,C00012,C00014) values (@p1,@p2,@p3,@p4,@p5)", new OleDbParameter[] { new OleDbParameter("@p1", iid), new OleDbParameter("@p2", name), new OleDbParameter("@p3", tpdizhi), new OleDbParameter("@p4", exPagers.getSecondEnd(DateTime.Now)), new OleDbParameter("@p5", exPagers.getSecondEnd(DateTime.Now)) });
                    cn.ExecQuery(sql, cn.sqlparameter_append(dc));

                    //    string Tid = cn.ExecQuery("select C00016 from T0004 where C00017 = @name", new OleDbParameter[] { new OleDbParameter("@name", name) }).Rows[0][0].ToString();
                    string insertsql = "insert into T0002(C00008,C00009) values (@p2,@p3)";
                    if (T != null)
                    {
                        foreach (string s in T)
                        {
                            cn.ExecSQL(insertsql, new OleDbParameter[] { new OleDbParameter("@p2", s), new OleDbParameter("@p3", iid) });
                        }
                    }
                    Response.Write("<script>alert('添加成功');window.location.href='addcomic.aspx'</script>");
                }
                else
                {
                    //修改
                    Dictionary <string, string> dc = new Dictionary <string, string>();
                    dc.Add("name", name);
                    dc.Add("jianjie", jianjie);
                    dc.Add("tpdizhi", tpdizhi);
                    dc.Add("zuozhe", zuozhe);
                    dc.Add("jieshao", jieshao);
                    dc.Add("id", id);
                    cn.ExecQuery("update T0003 set C00011 = @name,C00013=@tpdizhi where C00010=@id", new OleDbParameter[] { new OleDbParameter("@name", name), new OleDbParameter("@tpdizhi", tpdizhi), new OleDbParameter("@id", id) });
                    cn.ExecSQL("update T0004 set C00017 = @name,C00018 = @jianjie,C00024 = @tpdizhi,C00025 = @zuozhe,C00026 = @jieshao where C00016 = @id", cn.sqlparameter_append(dc));
                    //循环插入分类
                    string insertsql = "insert into T0002(C00008,C00009) values (@p2,@p3)";
                    cn.ExecSQL("delete from T0002 where C00009 = @id", new OleDbParameter[] { new OleDbParameter("@p", id) });
                    if (T != null)
                    {
                        foreach (string s in T)
                        {
                            cn.ExecSQL(insertsql, new OleDbParameter[] { new OleDbParameter("@p2", s), new OleDbParameter("@p3", id) });
                        }
                    }
                    Response.Write("<script>alert('修改成功');window.location.href='addcomic.aspx?id=" + id + "'</script>");
                }
            }
        }