示例#1
0
        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "text/plain";

            string uname = context.Request["uname"];
            string name  = context.Request["name"];

            string sql = "select * from 菜品表 where name='" + name + "' and uname='" + uname + "'";

            commom  com = new commom();
            DataSet ds  = com.Lookup_table(sql);

            if (ds.Tables[0].Rows.Count == 0)
            {
                //没有该菜品
                context.Response.Write("false");

                return;
            }

            sql = "delete from 菜品表 where name='" + name + "' and uname='" + uname + "'";
            //string sql = "delete from 菜品表 where name='wsx' and uname='he'";

            //删除菜品
            int flag = com.Operate_table(sql);

            if (flag == 0)
            {
                context.Response.Write("false");
            }
            else
            {
                context.Response.Write("true");
            }
        }
        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "text/plain";

            //获取输入的用户名、密码和身份
            string uname = context.Request["uname"];
            string id    = context.Request["id"];

            //创建sql语句
            string sql;

            if (id == "1")
            {
                sql = "select * from 订单表 where user_name = '" + uname + "'";
            }
            else
            {
                sql = "select * from 订单表 where busi_name = '" + uname + "'";
            }

            //从数据库获取值
            DataSet ds  = new DataSet();
            commom  com = new commom();

            ds = com.Lookup_table(sql);

            string json = Common.JsonHelper.DataSetToJson(ds.Tables[0]);

            context.Response.Write(json);
        }
示例#3
0
        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "text/plain";

            string uname = context.Request["uname"];
            string pow   = context.Request["pow"];
            string id    = context.Request["id"];

            string sql;

            if (id == "1")
            {
                sql = "update 用户表 set pow='" + pow + "' where uname='" + uname + "'";
            }
            else
            {
                sql = "update 商家表 set pow='" + pow + "' where uname='" + uname + "'";
            }

            commom com  = new commom();
            int    flag = com.Operate_table(sql);

            if (flag == 0)
            {
                context.Response.Write("false");
            }
            else
            {
                context.Response.Write("true");
            }
        }
示例#4
0
        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "text/plain";

            //获取输入的用户名和密码
            string uname = context.Request["uname"];
            string pwd   = context.Request["pwd"];
            string id    = context.Request["id"];

            //创建sql语句
            string sql;

            if (id == "1")
            {
                sql = "select * from 用户表 where uname = '" + uname + "'";
            }
            else
            {
                sql = "select * from 商家表 where uname = '" + uname + "'";
            }

            //从数据库获取值
            DataSet ds = new DataSet();

            commom com = new commom();

            ds = com.Lookup_table(sql);

            //如果读到数据了,说明 数据库中已存在 文本框中输入的用户名
            if (ds.Tables[0].Rows.Count != 0)
            {
                //如果读到相同的用户名 则提示 用户名已存在
                context.Response.Write("false");

                return;
            }

            //创建sql语句
            if (id == "1")
            {
                sql = "insert into 用户表 values ('" + uname + "', '" + pwd + "')";
            }
            else
            {
                sql = "insert into 商家表 values ('" + uname + "', '" + pwd + "')";
            }

            //执行sql语句
            int flag = com.Operate_table(sql);

            //判断sql语句是否执行成功
            if (flag != 0)
            {
                context.Response.Write("true");
            }
            else
            {
                context.Response.Write("false");
            }
        }
        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "text/plain";

            //获取参数
            string uname     = context.Request["uname"];
            string user_name = context.Request["user_name"];
            string menu_name = context.Request["menu_name"];
            string num       = context.Request["num"];
            string address   = context.Request["address"];
            string price     = context.Request["price"];

            //添加菜品
            string sql = "insert into 订单表 values ('" + uname + "','" + user_name + "','" + menu_name + "'," + num + "," + price + ",'" + address + "')";

            commom com  = new commom();
            int    flag = com.Operate_table(sql);

            if (flag == 0)
            {
                context.Response.Write("false");
            }
            else
            {
                context.Response.Write("true");
            }
        }
示例#6
0
        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "text/plain";

            string id = context.Request["id"];

            string sql = "select * from 订单表 where id=" + id;

            commom  com = new commom();
            DataSet ds  = com.Lookup_table(sql);

            if (ds.Tables[0].Rows.Count == 0)
            {
                //没有该订单
                context.Response.Write("false");

                return;
            }

            sql = "delete from 订单表 where id=" + id;

            //删除菜品
            int flag = com.Operate_table(sql);

            if (flag == 0)
            {
                context.Response.Write("false");
            }
            else
            {
                context.Response.Write("true");
            }
        }
        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "text/plain";

            //获取输入的用户名、密码和身份
            string uname = context.Request["uname"];
            string pwd   = context.Request["pwd"];
            string id    = context.Request["id"];
            //string pwd = "123";

            //连接数据库
            SqlConnection con = new SqlConnection(connStr);

            //创建sql语句
            string sql;

            if (id == "1")
            {
                sql = "select * from 用户表 where uname = '" + uname + "'";
            }
            else
            {
                sql = "select * from 商家表 where uname = '" + uname + "'";
            }

            //从数据库获取值
            DataSet ds  = new DataSet();
            commom  com = new commom();

            ds = com.Lookup_table(sql);

            //判断用户是否存在
            if (ds.Tables[0].Rows.Count != 0)
            {
                //处理获取的密码(去首尾空格)
                string _pwd = (string)ds.Tables[0].Rows[0][1];
                _pwd = _pwd.Trim();

                //判断密码是否匹配
                if (pwd == _pwd)
                {
                    context.Response.Write("true");
                }
                else
                {
                    context.Response.Write("false");
                }
            }
            else
            {
                context.Response.Write("false");
            }
        }
示例#8
0
        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "text/plain";

            //获取参数
            string DishName = context.Request["DishName"];
            string Price    = context.Request["Price"];
            string fileName = context.Request["fileName"];
            string uname    = context.Request["uname"];

            //设置上传文件存储位置
            fileaddress = @fileaddress + fileName;

            string sql = "select * from 菜品表 where name = '" + DishName + "'";

            ////查找菜品表
            DataSet ds = new DataSet();

            commom com = new commom();

            ds = com.Lookup_table(sql);


            //判断菜品是否以存在
            if (ds.Tables[0].Rows.Count != 0)
            {
                //如果读到相同的用户名 则提示 用户名已存在
                context.Response.Write("false");

                return;
            }

            //添加菜品
            sql = "insert into 菜品表 values ('" + DishName + "', " + Price + ", '" + fileaddress + "', '" + uname + "')";

            int flag = com.Operate_table(sql);

            //存储上传文件
            HttpPostedFile file = HttpContext.Current.Request.Files[0];

            file.SaveAs(fileaddress);

            if (flag == 0)
            {
                context.Response.Write("false");
            }
            else
            {
                context.Response.Write("true");
            }
        }
        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "text/plain";

            string chprice = context.Request["chprice"];
            string name    = context.Request["name"];

            string sql = "select uname from 商家表";

            commom  com = new commom();
            DataSet ds  = com.Lookup_table(sql);

            string json = Common.JsonHelper.DataSetToJson(ds.Tables[0]);

            context.Response.Write(json);
        }
示例#10
0
        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "text/plain";

            string chprice = context.Request["chprice"];
            string name    = context.Request["name"];

            string sql = "update 菜品表 set price=" + chprice + " where name='" + name + "'";
            //string sql = "update 菜品表 set price=100 where name='asd'";

            commom com  = new commom();
            int    flag = com.Operate_table(sql);

            if (flag == 0)
            {
                context.Response.Write("false");
            }
            else
            {
                context.Response.Write("true");
            }
        }