Ejemplo n.º 1
0
        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "text/plain";
            var UserPasswrod = context.Request["LogIng"];

            string[] msg = UserPasswrod.Split('*');

            bool LogUsername = sql.ExistDate("select UserName from LC_USERS  where UserName='******' or Phone='" + msg[0] + "'  ");

            if (LogUsername == false)
            {
                context.Response.Write("NOExistUser");
            }
            else
            {
                string passwrod = System.Web.Security.FormsAuthentication.HashPasswordForStoringInConfigFile(msg[1].ToString(), "MD5");
                bool   falge    = sql.ExistDate("select UserName from LC_USERS  where Passwrod='" + passwrod + "' and (Phone='" + msg[0] + "' or UserName='******') ");
                if (falge == true)
                {
                    //如果该权限是管理员就直接跳转到管理员主页!!

                    string LC_RertrictID = sql.ReturnValue("select RertrictID from LC_USERS where  UserName='******' or Phone='" + msg[0].ToString() + "' ");

                    //买家和卖家
                    if (LC_RertrictID == "buy")
                    {
                        string LC_name = sql.ReturnValue("select UserName from LC_USERS where  UserName='******' or Phone='" + msg[0].ToString() + "' ");
                        // context.Response.Write("该参数是:" + LC_name);
                        //HttpCookie Cookename = new HttpCookie("name");
                        //Cookename.Value = LC_name;
                        //context.Response.AppendCookie(Cookename);
                        AddCookiesValie("name", "keys", LC_name, context);
                        context.Response.Write("true");
                    }

                    //管理员
                    if (LC_RertrictID == "management")
                    {
                        context.Response.Write("APP_Administrator/Administrator.aspx");
                    }
                    //admin
                    if (LC_RertrictID == "admin")
                    {
                    }
                }
                else
                {
                    context.Response.Write("false");
                }
                //判断权限
            }
        }
Ejemplo n.º 2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                try
                {
                    string UserName  = Request.Cookies["name"].Values[0].ToString();
                    string LC_Upshop = Request.Cookies["Upshop"].Values[0].ToString();  //要不要放在数据库中????
                    /*当该cookie不为空时则说明,已经提交申请!*/
                    // 查出用户申请状态!判断该用户是否已经申请过
                    string LC_ApplyResult = sql.ReturnValue("select ApplyResult from LC_UPDATE_RESTRICT where UserName='******' ");
                    string ApplyResu      = "";
                    switch (LC_ApplyResult)
                    {
                    case "0":
                        ApplyResu = "申请";
                        break;

                    case "1":
                        ApplyResu = "通过";
                        break;
                    }
                    if (LC_ApplyResult == "0")
                    {
                        if (!string.IsNullOrEmpty(LC_Upshop))
                        {
                            LC_SeelTable = new StringBuilder();
                            LC_Adater    = sql.CreateDa("select UserID,UserName,Phone,RertrictID,AccountState from LC_USERS where UserName='******' or Phone='" + UserName + "'   ");
                            DataTable LC_Table = new DataTable();
                            LC_Adater.Fill(LC_Table);
                            LC_SeelTable.Append("<table class='table table-bordered'>");
                            foreach (DataRow item in LC_Table.Rows)
                            {
                                LC_SeelTable.Append("<tr><th>是否过</th><th>用户ID</th><th>用户名</th><th>号码</th><th>权限ID</th><th>账号状态</th><th>申请状态</th></tr>");
                                LC_SeelTable.Append("<tr><td><label class='checkbox'><input  type='checkbox' id='Yes' />通过</label><label class='checkbox'><input id='No' class='checkbox' type='checkbox' />拒绝</label></td><td>" + item[0].ToString() + "</td><td id='AdminUserName'>" + item[1].ToString() + "</td><td>" + item[2].ToString() + "</td><td>" + item[3].ToString() + "</td><td>" + item[4].ToString() + "</td><td>" + ApplyResu + "</td></tr>");
                            }
                            LC_SeelTable.Append("</table>");
                        }
                        SeelTable = LC_SeelTable.ToString();
                    }
                    else
                    {
                        SeelTable = "暂时没有人申请哦......";
                    }
                }
                catch
                {
                    SeelTable = "暂时没有人申请哦......";
                }
            }
        }
Ejemplo n.º 3
0
        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "text/plain";
            var LC_category = context.Request["category"];

            if (LC_category == "0") //把数据区里分开
            {
                LC_PayStringBuilder = new StringBuilder();
                LC_Payadter         = new SqlDataAdapter();
                LC_Paytable         = new DataTable();
                try
                {
                    //用户名
                    //      LC_PayUsername = context.Request.Cookies["name"].Values[0].ToString();
                    LC_PayUsername = CookiesValues("name", context).ToString();
                    AddCookiesValie("username", "one", LC_PayUsername, context);
                }
                catch
                {
                    context.Response.Write("请登录!");
                }
                //  context.Response.Write("用户名:" + LC_PayUsername);

                if (!string.IsNullOrEmpty(LC_PayUsername))
                {
                    //如果该用户存在收货信息,就直接把地址等信息发给前台
                    if (!string.IsNullOrEmpty(sql.ReturnValue("select ConsigneeName from LC_CONSIGNEE where UserName='******'")))
                    {
                        LC_Payadter = new SqlDataAdapter();
                        LC_Payadter = sql.CreateDa("select ConsigneeAdrees,ConsigneePhone,ConsigneeName,DefultAdrees,ConsigneeID from LC_CONSIGNEE where UserName='******'");
                        LC_Payadter.Fill(LC_Paytable);

                        foreach (DataRow item in LC_Paytable.Rows)
                        {
                            LC_PayStringBuilder.Append("<tr><td colspan='3' class='col-md-12'><div class='col-md-12'>");
                            LC_PayStringBuilder.Append("<input type='radio' class='radio  input-sm pull-left' name='" + item[4] + "' value='" + item[3] + "'   /> ");
                            LC_PayStringBuilder.Append("<div class='col-md-4 text-left LC_paaddress'>" + item[0] + "</div>");
                            LC_PayStringBuilder.Append("<div class='col-md-2'><label class='LC_payname'>(" + item[2] + "收)</label></div>");
                            LC_PayStringBuilder.Append("<div class='col-md-2'><label class='LC_payUnmber'>" + item[1] + "</label></div>");
                            LC_PayStringBuilder.Append("<div class='col-md-1  pull-right tab-content text-center'><a href='javascript:;' class='h6  DeleteAdrees'>删除</a></div>");
                            LC_PayStringBuilder.Append("</div>");
                            LC_PayStringBuilder.Append("</td></tr>");
                        }
                        LC_PayStringBuilder.Append("<tr><td>");
                        LC_PayStringBuilder.Append("<button  id='ButtonLoad'  class='btn  btn-success  btn-xs' data-toggle='modal' data-target='#myModal'><span class='glyphicon glyphicon-plus'></span>添加新地址 </button></td></tr>");
                        context.Response.Write(LC_PayStringBuilder.ToString() + "*");
                    }
                    //如果不存在地址的话就,让用户添加
                    else
                    {
                        LC_PayStringBuilder.Append("<tr><td>");
                        LC_PayStringBuilder.Append("<button  id='ButtonLoad'  class='btn  btn-success btn-xs' data-toggle='modal' data-target='#myModal'>添加新地址</button></td></tr>");
                        context.Response.Write(LC_PayStringBuilder.ToString() + "*");
                    }

                    var msg = context.Request["Pay"]; //商品ID  ;

                    /********************
                     * 如果说msg当中存在‘*’就是加入购物车后购买的,不存在就是立即购买的!!!【会报错】
                     **********************/
                    try
                    {    //这个是加入【购物车】之后购买的!
                        int indexof = msg.IndexOf('*');
                        if (msg.IndexOf('*') > -1)
                        {
                            //商品ID
                            string[] LC_msg = msg.Split('*');
                            //商品数量
                            string[] unber = context.Request["Payber"].Split('*');
                            for (int i = 0; i < LC_msg.Length - 1; i++)
                            {
                                ///商品信息
                                SqlDataAdapter LC_Pro     = sql.CreateDa("select ShowImage,CommodityName,SellPrice,CommodityDescribe from LC_COMMODITY where CommodityID='" + LC_msg[i] + "'");
                                DataTable      LCproTable = new DataTable();
                                LC_Pro.Fill(LCproTable);
                                StringBuilder LC_Prostring = new StringBuilder();

                                string pric = "";
                                foreach (DataRow item in LCproTable.Rows)
                                {
                                    LC_Prostring.Append("<tr>");
                                    LC_Prostring.Append("<td class='text-center'><img src='" + item[0] + "' class='img-responsive pull-left' width='50' /><span>" + item[3] + "</span></td>");
                                    LC_Prostring.Append("<td class='text-center'>" + item[2] + "</td>");
                                    LC_Prostring.Append("<td class='text-center'>" + unber[i] + "</td>");
                                    pric = item[2].ToString();
                                }
                                LC_Prostring.Append("<td  class='text-center LC_sum'>" + int.Parse(pric.ToString()) * int.Parse(unber[i]) + "</td>");
                                LC_Prostring.Append("</tr>");
                                //商品!
                                context.Response.Write(LC_Prostring.ToString());
                            }
                        }
                        else
                        {
                            // 这个是直接购买的!!!

                            ///商品信息
                            SqlDataAdapter LC_Pro     = sql.CreateDa("select ShowImage,CommodityName,SellPrice,CommodityDescribe from LC_COMMODITY where CommodityID='" + msg + "'");
                            DataTable      LCproTable = new DataTable();
                            LC_Pro.Fill(LCproTable);
                            StringBuilder LC_Prostring = new StringBuilder();
                            string        unber        = context.Request["Payber"];
                            string        pric         = "";
                            foreach (DataRow item in LCproTable.Rows)
                            {
                                LC_Prostring.Append("<tr>");
                                LC_Prostring.Append("<td><img src='" + item[0] + "' class='img-responsive pull-left' width='50' /><span >" + item[3] + "</span></td>");
                                LC_Prostring.Append("<td>" + item[2] + "</td>");
                                LC_Prostring.Append("<td>" + unber + "</td>");
                                pric = item[2].ToString();
                            }
                            LC_Prostring.Append("<td class='LC_sum'>" + int.Parse(pric.ToString()) * int.Parse(unber) + "</td>");
                            LC_Prostring.Append("</tr>");
                            //商品!
                            context.Response.Write(LC_Prostring.ToString());
                        }
                    }
                    catch (Exception el)
                    {
                        context.Response.Write("字符截取错误:" + el);
                    }
                }
                else
                {
                    context.Response.Write("请登录!");
                }
            }
            else if (LC_category == "1")
            {
                //收货人地址信息
                var LC_Aderss = context.Request["CONSIGNEE"];
                LC_PayUsername = CookiesValues("username", context);
                if (!string.IsNullOrEmpty(LC_Aderss))
                {
                    string[] AdreeMsg = LC_Aderss.Split('*');
                    //收件人ID
                    string LC_ConsigneeID = AdreeMsg[1] + DateTime.Now.ToString();
                    sql.RunProc("insert into LC_CONSIGNEE values('" + LC_ConsigneeID + "','" + LC_PayUsername + "','" + AdreeMsg[1] + "','" + AdreeMsg[0] + "','" + AdreeMsg[2] + "','" + AdreeMsg[3] + "')");
                    context.Response.Write("成功!");
                }
            } //支付宝绑定
            else if (LC_category == "2")
            {
                LC_PayUsername = CookiesValues("username", context);
                string LC_RedliningNubers = sql.ReturnValue("select RedliningNuber from LC_USERS where UserName='******'");
                if (!string.IsNullOrEmpty(LC_RedliningNubers))
                {
                    context.Response.Write(LC_RedliningNubers);
                }
                else
                {
                    context.Response.Write("NULL");
                }
            }
            else if (LC_category == "3")//添加支付宝信息
            {
                LC_PayUsername = CookiesValues("username", context);
                var LC_buybuy = context.Request["baybay"].Split('*');
                sql.RunProc("update  LC_USERS set RedliningNuber='" + LC_buybuy[0] + "',RedNuberPasswrod=" + LC_buybuy[1] + " where UserName='******' ");
                context.Response.Write("修改成功!");
            }
            else if (LC_category == "4")  //对比密码,ss返回余额
            {
                LC_PayUsername = CookiesValues("username", context);
                var    LC_Passwrod = context.Request["paypasswrod"].ToString();
                string Sqlpasswrod = sql.ReturnValue("select RedNuberPasswrod from LC_USERS where UserName='******' ");
                if (LC_Passwrod == Sqlpasswrod)
                {
                    string Balance = sql.ReturnValue("select Balance from LC_USERS where UserName='******' ");
                    context.Response.Write(int.Parse(Balance));
                }
                else
                {
                    context.Response.Write("Eroor");
                }
            }
            else if (LC_category == "5") // 减掉支出
            {
                LC_PayUsername = CookiesValues("username", context);
                var LC_Consume = context.Request["consume"];
                sql.RunProc("update  LC_USERS set Balance=" + decimal.Parse(LC_Consume) + " where UserName='******' ");
                context.Response.Write("账户余额修改成功!");
            }
            //修改余额
            else if (LC_category == "6") // 减掉支出
            {
                LC_PayUsername = CookiesValues("username", context);
                var LC_Balance = context.Request["consume"];
                sql.RunProc("update  LC_USERS set Balance=" + LC_Balance + " where UserName='******' ");
                context.Response.Write("修改成功!");
            }
            else if (LC_category == "7")
            {
                LC_PayUsername = CookiesValues("username", context); // 用户名
                //商品ID:
                var LC_CommID = context.Request["CommID"];
                //数量
                var LC_ProNuber = context.Request["ProNuber"];
                //价格
                // var LC_Price = context.Request["Price"];

                /***在修改账户余额的时候就应该把账单表的数据添加完成!在卖家的《今日订单中》直接查找这些数据即可点击发货就把该商品id传到我的类淘中显示我要收货
                 * 如果是卖家该用户的账户余额应该增加相印的金额!!!!
                 * /********应该先找到该商品的商家,然后买家支付多少该商家就盈利多少!!!********/
                if (LC_CommID.IndexOf('*') > -1 && LC_ProNuber.IndexOf('*') > -1)
                {       //
                    string[] ArryCommid   = LC_CommID.Substring(0, LC_CommID.Length - 1).Split('*');
                    string[] ArryProNuber = LC_ProNuber.Substring(0, LC_ProNuber.Length - 1).Split('*');
                    //  string[] ArryPrice = LC_Price.Substring(0, LC_Price.Length - 1).Split('*');
                    Random sj = new Random();

                    for (int i = 0; i < ArryCommid.Length; i++)
                    {
                        //插入用户的账单! 到时候直接查询权限就可以知道是收入还是支出
                        //商品价格
                        int pricrBill = int.Parse(sql.ReturnValue("select SellPrice from LC_COMMODITY where CommodityID='" + ArryCommid[i] + "'"));
                        //图片ID
                        string LC_BillImgs = sql.ReturnValue("select ShowImage from LC_COMMODITY where CommodityID='" + ArryCommid[i] + "'");
                        //收件人ID
                        string LC_BillConsigneeID = sql.ReturnValue("select ConsigneeID from LC_CONSIGNEE where UserName='******'");
                        //账单ID规则:时间精确到秒
                        sql.RunProc("insert into LC_BILL values('" + DateTime.Now.ToString("yyyyMMddhhmmss") + sj.Next(1000).ToString() + "','" + LC_BillImgs + "','" + ArryCommid[i] + "','" + LC_PayUsername + "','" + DateTime.Now.ToString() + "'," + ArryProNuber[i] + "," + pricrBill * int.Parse(ArryProNuber[i]) + ",'" + LC_BillConsigneeID + "','NO')");
                    }
                    context.Response.Write("多个数据账单表插入成功!");
                }
                else
                {
                    //单个商品
                    int pricrBill = int.Parse(sql.ReturnValue("select SellPrice from LC_COMMODITY where CommodityID='" + LC_CommID + "'"));
                    //图片ID
                    string LC_BillImgs = sql.ReturnValue("select ShowImage from LC_COMMODITY where CommodityID='" + LC_CommID + "'");
                    //收件人ID
                    string LC_BillConsigneeID = sql.ReturnValue("select ConsigneeID from LC_CONSIGNEE where UserName='******'");
                    //账单ID规则:时间精确到秒
                    //插入用户的账单! 到时候直接查询权限就可以知道是收入还是支出

                    sql.RunProc("insert into LC_BILL values('" + DateTime.Now.ToString("yyyyMMddhhmmss") + "','" + LC_BillImgs + "','" + LC_CommID + "','" + LC_PayUsername + "','" + DateTime.Now.ToString() + "'," + LC_ProNuber + "," + pricrBill + ",'" + LC_BillConsigneeID + "','NO')");
                    context.Response.Write("账单表插入成功!");

                    //找到该商品对应的用户名 [收件人ID为空]  [用过卖家姓名找到该卖家的用户名]
                    // string LC_SeellUsername = sql.ReturnValue("select UserName from LC_COMMODITY where CommodityID='" + ProidOrunber_Arry[0] + "'");
                    //sql.RunProc("insert into LC_BILL(ShowImage,CommodityID,UserName,PaymentTime,BuyNumber,BuyPrice) values('" + LC_BillImgs + "','" + ProidOrunber_Arry[0] + "','" + LC_SeellUsername + "'," + DateTime.Now.ToString() + "," + int.Parse(ProidOrunber_Arry[1]) + "," + pricrBill + ")");

                    //修改卖家的账户余额
                    //sql.RunProc("update  LC_USERS set Balance=Balance+" + pricrBill + " where UserName='******' ");
                    //context.Response.Write("卖家的账户余额修改成功!");
                }
            }
            else if (LC_category == "8")  //修改用户的默认地址
            {
                // 先修改原来的默认地址,在添加新的默认地址
                string LC_ConsigneenID = sql.ReturnValue("select ConsigneeID from LC_CONSIGNEE where DefultAdrees='1'");
                sql.RunProc("update LC_CONSIGNEE set DefultAdrees='0' where ConsigneeID='" + LC_ConsigneenID + "'");
                var msg = context.Request["Addressid"];
                //新增默认地址
                sql.RunProc("update LC_CONSIGNEE set DefultAdrees='1' where ConsigneeID='" + msg + "'");
                context.Response.Write("Ture");
            }
            else if (LC_category == "9")  //删除用户地址
            {
                var msg = context.Request["Addressid"];
                sql.RunProc("delete from LC_CONSIGNEE  where ConsigneeID='" + msg + "'");
                context.Response.Write("Ture");
            }
        }
Ejemplo n.º 4
0
        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "text/plain";
            var msg = context.Request["My"];

            if (msg == "0")
            {   //判断是几个商品
                StringBuilder MYdelivery = new StringBuilder();

                var LC_MyProid  = context.Request["myproOne"];
                var LC_MyNunber = context.Request["myproTwo"];
                //var LC_MyPrice = context.Request["myproThree"];

                //&& LC_MyPrice.IndexOf('*') > -1
                if (LC_MyProid.IndexOf('*') > -1 && LC_MyNunber.IndexOf('*') > -1)
                {
                    string[] ArryCommid   = LC_MyProid.Split('*');
                    string[] ArryProNuber = LC_MyNunber.Split('*');
                    ///  string[] ArryPrice = LC_MyPrice.Split('*');

                    for (int i = 0; i < ArryCommid.Length; i++)
                    {
                        //商品描述
                        string LC_CommodityDescribe = sql.ReturnValue("select CommodityDescribe from  LC_COMMODITY where CommodityID='" + ArryCommid[i] + "'   ");
                        //判断是否是已发货
                        string lc_consignment = sql.ReturnValue("select consignment from LC_BILL where CommodityID='" + ArryCommid[i] + "'");
                        ///商品信息
                        SqlDataAdapter LC_Myadpter = sql.CreateDa("select ShowImage,CommodityDescribe,SellPrice from LC_COMMODITY where CommodityID='" + ArryCommid[i] + "'");
                        DataTable      LC_MyTable  = new DataTable();
                        LC_Myadpter.Fill(LC_MyTable);
                        string LC_Prostring = "";
                        foreach (DataRow item in LC_MyTable.Rows)
                        {
                            LC_Prostring += "<tr>" +
                                            "<td><img src='" + item[0].ToString() + "' name='" + lc_consignment + "' class='img-responsive pull-left' width='50' /><span>" + LC_CommodityDescribe + "</span></td>" +
                                            "<td>" + item[2].ToString() + "</td>" +
                                            "<td>" + ArryProNuber[i] + "</td>" +
                                            "<td>" + int.Parse(item[2].ToString()) * int.Parse(ArryProNuber[i]) + "</td>" +
                                            "<td><button type='button' id='" + ArryCommid[i] + "'  class='" + lc_consignment + " MyDelivery btn btn-default btn-xs'>确认收货</button></td>" +
                                            "</tr>";
                        }
                        context.Response.Write(LC_Prostring);
                    }
                }
                //一个商品
                else
                {
                    string lc_consignment = sql.ReturnValue("select consignment from LC_BILL where CommodityID='" + LC_MyProid + "'");
                    ///商品信息
                    SqlDataAdapter LC_Myadpter = sql.CreateDa("select ShowImage,CommodityName,CommodityDescribe,SellPrice from LC_COMMODITY where CommodityID='" + LC_MyProid + "'");
                    DataTable      LC_MyTable  = new DataTable();
                    LC_Myadpter.Fill(LC_MyTable);
                    string LC_Prostring = "";
                    foreach (DataRow item in LC_MyTable.Rows)
                    {
                        LC_Prostring += "<tr>" +
                                        "<td><img src='" + item[0].ToString() + "' class='img-responsive pull-left' width='50' /><span>" + item[1].ToString() + "</span></td>" +
                                        "<td>" + item[3] + "</td>" +
                                        "<td>" + LC_MyNunber + "</td>" +
                                        "<td>" + int.Parse(item[3].ToString()) * int.Parse(LC_MyNunber) + "</td>" + ")" +
                                        "<td ><button type='button' id='" + LC_MyProid + "'  class='" + lc_consignment + " MyDelivery btn btn-default btn-xs'>确认收货</button></td>" +
                                        "</tr>";
                        // LC_Prostring += item[0] + "*" + item[1] + "*" + item[2] + "*" + item[3];
                    }
                    context.Response.Write(LC_Prostring);
                    //判断是否是已发货
                    //    string lc_consignment = sql.ReturnValue("select consignment from LC_BILL where CommodityID='" + LC_MyProid + "'");
                    //    ///商品信息
                    //    SqlDataAdapter LC_Myadpter = sql.CreateDa("select ShowImage,CommodityName,CommodityDescribe,SellPrice from LC_COMMODITY where CommodityID='" + LC_MyProid + "'");
                    //    DataTable LC_MyTable = new DataTable();
                    //    LC_Myadpter.Fill(LC_MyTable);
                    //    string LC_Prostring = "";
                    //    foreach (DataRow item in LC_MyTable.Rows)
                    //    {
                    //        LC_Prostring += item[0] + "*" + item[1] + "*" + item[2] + "*" + item[3];
                    //    }
                    //    context.Response.Write(LC_Prostring + "*" + lc_consignment);
                }
            }
            else if (msg == "1")
            {
                try
                {
                    var LC_MyProid = context.Request["mypro"];
                    //用户名
                    //var _username = context.Request.Cookies["name"].Values[0].ToString();
                    var _username = CookiesValues("name", context);
                    //评价表ID规则: 用户名+随机数
                    Random sj           = new Random();
                    string ran          = sj.Next(100, 999).ToString();
                    string LC_Evaluteid = ran + _username;
                    //详细表ID规则:用户名+当前时间
                    string LC_Detailid = _username + DateTime.Now.ToString();
                    //评价内容
                    var LC_discuss = context.Request["Mydiscuss"];
                    sql.RunProc("insert into LC_EVALUATE values('" + LC_Evaluteid + "','" + LC_MyProid + "')");
                    sql.RunProc("insert into LC_EVALUATE_DETAIL values('" + LC_Detailid + "','" + LC_Evaluteid + "','" + _username + "','" + LC_discuss + "')");
                    context.Response.Write("true");
                }
                catch {
                    context.Response.Write("请登录!");
                }
            }
            else if (msg == "2")
            {
                string MyTrtd         = "";
                string LC_BillConsiID = "";
                string CommodityID    = "";
                /****该商品的信息*****/
                string LC_CommodityName = sql.ReturnValue("select CommodityName from LC_COMMODITY where CommodityID in(select CommodityID from LC_BILL  where consignment='NO')");
                /***账单表中的内容****/
                SqlDataAdapter LC_billAdpter = new SqlDataAdapter();
                LC_billAdpter = sql.CreateDa("select UserName,ShowImage,ConsigneeID,BuyNumber,BuyPrice,CommodityID from LC_BILL  where consignment='NO'");
                DataTable LC_billDataTable = new DataTable();
                LC_billAdpter.Fill(LC_billDataTable);
                foreach (DataRow item in LC_billDataTable.Rows)
                {
                    LC_BillConsiID = item[2].ToString();
                    MyTrtd        += "<tr>" +
                                     "<td><label>" + item[0] + "</label></td>" +
                                     "<td><img src='" + item[1] + "' class='img-responsive pull-left' width='50' /><span>" + LC_CommodityName + "</span></td>" +
                                     "<td>" + item[3] + "</td>" +
                                     "<td>" + item[4] + "</td>" + ")";
                    CommodityID = item[5].ToString();
                    //收件人号码和姓名,地址
                    SqlDataAdapter LC_consignAdpter = new SqlDataAdapter();
                    LC_consignAdpter = sql.CreateDa("select ConsigneeName,ConsigneeAdrees,ConsigneePhone  from LC_CONSIGNEE where ConsigneeID='" + LC_BillConsiID + "'");
                    DataTable LC_consignTable = new DataTable();
                    LC_consignAdpter.Fill(LC_consignTable);
                    foreach (DataRow temp in LC_consignTable.Rows)
                    {
                        MyTrtd += "<td>" + temp[0] + "</td>" +
                                  "<td>" + temp[1] + "</td>" +
                                  "<td>" + temp[2] + "</td>" +
                                  "<td class='" + CommodityID + "'><button type='button'    class='btn btn-default Immediately btn-xs'>立即发货</button></td>" +
                                  "</tr>";
                    }
                }
                context.Response.Write(MyTrtd.ToString());
            }
            else if (msg == "3")
            {
                var LC_setPro = context.Request["UPdateconsignment"];
                sql.RunProc("update LC_BILL  set consignment='YES' where CommodityID='" + LC_setPro + "'");
                context.Response.Write("已经发货........");
            }
        }
Ejemplo n.º 5
0
        public void ProcessRequest(HttpContext context)
        {
            SQLDBC sql = new SQLDBC();
            //context.Response.Write("用户名是:"+LC_UserName);
            var Adminstrator = "";

            //管理员界面操作数据库[]
            Adminstrator = context.Request["Adminstra"];


            var LC_Shoping = context.Request["Shopping"];

            //判断权限
            if (LC_Shoping == "0")
            {
                // var _usernaem = context.Request.Cookies["name"].Values[0];
                var    _usernaem      = CookiesValues("name", context);
                string LC_RertrictIDs = sql.ReturnValue("select RestrictID from Vi_RESTRICT where UserName='******'");
                if (LC_RertrictIDs == "buy")
                {
                    context.Response.Write("buy");
                }
                else if (LC_RertrictIDs == "sell")
                {
                    context.Response.Write("sell");
                }
                else if (LC_RertrictIDs == "management")
                {
                    context.Response.Write("management");
                }
                else
                {
                    context.Response.Write("admin");
                }
            }

            var LC_Repulse = context.Request["Refuse"];

            // 管理员同意后台操作!
            if (!string.IsNullOrEmpty(LC_Repulse))
            {
                var LC_AdminUserName = context.Request["Variate"]; //是否允许该用户名成为卖家
                if (LC_Repulse == "YES")
                {
                    //context.Response.Write("接受成功!该用户名是:" + LC_AdminUserName);
                    sql.RunProc("update  LC_UPDATE_RESTRICT set ApplyResult=1 where UserName='******' ");
                    //context.Response.Write("您已经是卖家了!");
                    string BuyPro = CookiesValues("Sell", context);
                    if (!string.IsNullOrEmpty(BuyPro))
                    {
                        sql.RunProc("update LC_USERS set RedliningNuber='" + BuyPro[0] + "', RedNuberPasswrod='" + BuyPro[1] + "' where UserID='" + BuyPro[0] + "'");
                        context.Response.Write("支付数据保存成功!");
                    }
                }
                if (LC_Repulse == "NO")
                {
                    sql.RunProc("update  LC_UPDATE_RESTRICT set ApplyResult=2 where UserName='******' ");
                    context.Response.Write("申请失败!");
                }
            }
            else
            {
                // context.Response.Write("你正在提交申请成为卖家!");
                if (Adminstrator != "0")  //申请成为卖家页面
                {
                    try
                    {
                        var LC_UserName = context.Request["Variate"];


                        // 申明一个信号,表示已经提交申请成为卖家,同时把该用户的支付信息添加到用户表中
                        if (LC_UserName != "亲,请登陆")
                        {
                            string[] BuyPro = LC_UserName.Split('*');

                            //存入支付账号和密码到COOkies中
                            AddCookiesValie("Sell", "keys", BuyPro[1] + "*" + BuyPro[2], context);

                            //该申请的用户只能是买家
                            string sell = sql.ReturnValue("select RertrictID from LC_USERS where UserName='******'");
                            if (sell == "buy")
                            {
                                HttpCookie ShopCookie = new HttpCookie("Upshop");
                                ShopCookie.Value = "arrhy";
                                context.Response.AppendCookie(ShopCookie);
                                context.Response.Write("数据保存成功!");
                            }
                            else
                            {
                                context.Response.Write("您已经是卖家了!不能重复提交您的信息哦!");
                                return;
                            }
                        }
                        else
                        {
                            context.Response.Write("请登录!");
                        }
                    }
                    catch { };
                }
            }
        }
Ejemplo n.º 6
0
        public void ProcessRequest(HttpContext context)
        {
            var LC_Shoping = context.Request["Shopping"];
            var _usernaem  = "";

            try
            {
                //    _usernaem = context.Request.Cookies["name"].Values[0].ToString();

                _usernaem = CookiesValues("name", context);
                AddCookiesValie("shopping", "keys", _usernaem, context);
            }
            catch
            {
                context.Response.Write("请登录!");
            }
            if (LC_Shoping == "1")
            {
                var LC_Shop = context.Request["PurShopp"];
                if (!string.IsNullOrEmpty(LC_Shop.ToString()))
                {
                    string[] LC_ShopProid = LC_Shop.Split('*');
                    int      sumPrice     = int.Parse(LC_ShopProid[1]) * int.Parse(LC_ShopProid[2]); //总价格
                    AddCookiesValie("shopPirce", "keys", sumPrice.ToString(), context);
                    try
                    {   //如果有尺码这些的话,直接在后面给条件就好
                        string LC_ShowProNunber = sql.ReturnValue("select CommodityID from LC_SHOPPING_CART  where CommodityID='" + LC_ShopProid[0] + "' ");
                        if (!string.IsNullOrEmpty(LC_ShowProNunber))
                        {
                            sql.RunProc("update  LC_SHOPPING_CART  set  AddNumber=AddNumber+" + int.Parse(LC_ShopProid[1]) + " where CommodityID='" + LC_ShopProid[0] + "'");
                        }
                        else
                        {
                            sql.RunProc("insert into LC_SHOPPING_CART values('" + _usernaem + DateTime.Now.ToString() + "','" + _usernaem + "','" + LC_ShopProid[0] + "','" + DateTime.Now.ToString() + "','" + LC_ShopProid[1] + "'," + LC_ShopProid[2] + ")");
                        }
                    }
                    catch (Exception el)
                    {
                        context.Response.Write("购物车数据添加失败!" + el);
                    }
                    // context.Response.Write("购物车表插入成功!");
                }
            }
            else if (LC_Shoping == "2")
            {
                _usernaem = CookiesValues("shopping", context).ToString();
                string LC_Detailimgs = "";
                //购物车表
                LC_ShoppString = new StringBuilder();
                LC_ShoppAdater = new SqlDataAdapter();
                LC_ShoppTable  = new DataTable();
                LC_ShoppAdater = sql.CreateDa("SELECT CommodityID,AddNumber,Price,ShoppingID FROM LC_SHOPPING_CART WHERE UserName='******';");
                LC_ShoppAdater.Fill(LC_ShoppTable);
                foreach (DataRow item in LC_ShoppTable.Rows)
                {
                    //商品表
                    LC_Commoddater = new SqlDataAdapter();
                    LC_CommodTable = new DataTable();
                    LC_commString  = new StringBuilder();
                    LC_Commoddater = sql.CreateDa("SELECT ShowImage,CommodityDescribe FROM LC_COMMODITY WHERE CommodityID='" + item[0] + "';");
                    LC_Commoddater.Fill(LC_CommodTable);

                    int    sumPrice = int.Parse(CookiesValues("shopPirce", context));
                    string Showimgs = "";
                    string Describe = "";
                    foreach (DataRow itemConmm in LC_CommodTable.Rows)
                    {
                        Showimgs = itemConmm[0].ToString();
                        Describe = itemConmm[1].ToString();
                    }
                    LC_ShoppString.Append("<tr>");
                    LC_ShoppString.Append("<td class='text-center'>");
                    LC_ShoppString.Append("<input type='checkbox' class='input-sm input-group'  value='" + item[0] + "' /></td>");
                    LC_ShoppString.Append("<td>");
                    LC_ShoppString.Append("<img src='" + Showimgs + "' class='img-responsive' width='50' /></td>");
                    LC_ShoppString.Append("<td>" + Describe + "</td>");

                    LC_ShoppString.Append("<td class='" + item[0] + "'>" + item[2] + "</td>");
                    LC_ShoppString.Append("<td  class='text-center'>");
                    LC_ShoppString.Append("<div class='col-md-5 '>");
                    LC_ShoppString.Append("<button class='btn  btn-default PurSubtract btn-sm pull-left' ><strong>-</strong></button>");
                    LC_ShoppString.Append("<input class='col-md-3 Number input-group text-center input-sm  pull-left'   value='" + item[1] + "' />");
                    LC_ShoppString.Append("<button class='btn PurPuls  btn-default btn-sm' ><strong>+</strong></button>");
                    LC_ShoppString.Append("</div>");
                    LC_ShoppString.Append("</td>");
                    LC_ShoppString.Append("<td><b class='h4' style='color:red;'>" + int.Parse(item[1].ToString()) * int.Parse(item[2].ToString()) + "</b></td>");
                    LC_ShoppString.Append("<td><a href='#' class='Delete' delete='" + item[3] + "'>删除</a></td>");
                    LC_ShoppString.Append("</tr>");
                }
                context.Response.Write(LC_ShoppString.ToString());
            }
            //删除
            else if (LC_Shoping == "3")
            {
                var LC_DeletePro = context.Request["deleteProid"];
                sql.RunProc("delete from LC_SHOPPING_CART where ShoppingID='" + LC_DeletePro + "'  ");
                context.Response.Write("Yes");
            }
        }
Ejemplo n.º 7
0
        private string _username;            //用户名

        public void ProcessRequest(HttpContext context)
        {
            //一般程序都是从头开始执行!!变量的存储会在程序重新运行的时候清空!!!!!
            context.Response.ContentType = "text/plain";
            //_username = context.Request.Cookies["name"].Values[0].ToString();
            _username = CookiesValues("name", context).ToString();
            if (_username == "0")
            {
                context.Response.Write("请登录!");
            }
            ///详细图片ID
            string DetailImageID = (int)(char)_username[0] + DateTime.Now.ToShortDateString();    // 详细图片ID命名规则: 扩展名前的字符!

            AddCookiesValie("LC_Detail", "deteailID", DetailImageID, context);
            //判断属性该个人用户的文件是否存在
            if (Directory.Exists(context.Server.MapPath("~/App_Image/SellerProImage/" + _username + "")) == false)
            {
                //如果不存在就创建file文件夹
                Directory.CreateDirectory(context.Server.MapPath("~/App_Image/SellerProImage/" + _username + ""));
                //Directory.Delete(Server.MapPath("~/upimg/hufu"), true);//删除文件夹以及文件夹中的子目录,文件
            }
            else
            {
                string json = "成功!";
                try
                {
                    HttpRequest        request     = System.Web.HttpContext.Current.Request;
                    HttpFileCollection FileCollect = request.Files;
                    HttpPostedFile     file;
                    try
                    {
                        file = context.Request.Files["shows"];
                        file = context.Request.Files["shows"];
                        string imgPath = "App_Image/SellerProImage/" + _username + "/" + file.FileName;
                        file.SaveAs(context.Server.MapPath("~/") + imgPath);
                        //展示图
                        string ShowImage = "../" + imgPath;
                        AddCookiesValie("LC_Show", "imgss", ShowImage, context);
                    }
                    catch
                    {
                        file = context.Request.Files["model_file"];
                        string imgPath = "App_Image/SellerProImage/" + _username + "/" + file.FileName;
                        file.SaveAs(context.Server.MapPath("~/") + imgPath);

                        /**
                         * 优化提示:在本处找不到一个可以储存长字符的全局变量如果可以的话直接把所有的详细图片的ID存放在其中!
                         *        就不必直接插入数据库这样不易于修改!
                         **/
                        //解读详细id
                        LC_DetailImageID = CookiesValues("LC_Detail", context).ToString();
                        sql.RunProc("insert into LC_IMAGE values('" + LC_DetailImageID + "','../App_Image/SellerProImage/" + _username + "/" + file.FileName + "')");
                    }
                }
                catch (Exception ex)
                {
                    //失败时返回的参数必须加 error键
                    json = "{\"error\":\"" + ex.Message + "\"}";
                }
            }
            var qufen = context.Request["Distinguish"];

            if (qufen == "0")
            {
                /*商品分类*/
                var msg = context.Request["filenames"];
                ///  context.Response.Write("分类是:"+msg+"  ");
                //怎么用一个sql查询找到该用户选择的类别????????????????????
                try
                {
                    LC_Sonadter = sql.CreateDa("select CommodityCategory from LC_COMMODITY_CATEGORY where MinuteID='" + msg + "'");
                    LC_Sontable = new DataTable();
                    LC_Sonadter.Fill(LC_Sontable);
                    foreach (DataRow item in LC_Sontable.Rows)
                    {
                        context.Response.Write(item[0].ToString() + "*");
                    }
                    string commodity = sql.ReturnValue("select CommodityCategory  from LC_COMMODITY_CATEGORY where  CategoryID='" + msg + "' ");
                    if (!string.IsNullOrEmpty(commodity))
                    {    //商品类别
                        AddCookiesValie("LC_Commodity", "commdo", commodity, context);
                    }
                    else
                    {
                        context.Response.Write("请选择商品类别!!");
                    }
                }
                catch (Exception el)
                {
                    context.Response.Write(el);
                }
            }
            else if (qufen == "1")
            {
                #region
                var      Pro         = context.Request["uploadPRO"];
                string[] information = Pro.Split('*');
                //商品类别
                LC_CommodityCategory = CookiesValues("LC_Commodity", context).ToString();
                //详细图ID
                LC_DetailImageID = CookiesValues("LC_Detail", context).ToString();
                //展示图
                LC_ShowImage = CookiesValues("LC_Show", context).ToString();
                //卖家姓名
                LC_MerchantName = information[5].ToString();
                try
                {
                    //商品ID规则:该用户的用户名的前两个字的ULCD编码 +当前时间精确到毫秒
                    string LC_NowTime = DateTime.Now.ToString("yyyyMMddhhmmss");
                    if (_username.ToString().Length > 2)
                    {
                        for (int i = 0; i < 2; i++)
                        {
                            char chars = (char)_username.ToString()[i];
                            int  names = (int)chars;
                            LC_NowTime = names.ToString() + LC_NowTime;
                        }
                    }
                    LC_CommodityID = LC_NowTime;
                }
                catch
                {
                    context.Response.Write("请登录!");
                }
                //商品名
                LC_CommodityName = information[0].ToString();
                try
                {
                    //成本价&销售价
                    LC_CostPrice = decimal.Parse(information[2]);
                    LC_SellPrice = decimal.Parse(information[3]);
                }
                catch
                {
                    context.Response.Write("价格数据转化失败!");
                }
                //库存
                LC_Repertory = information[1].ToString();
                //商品描述
                LC_CommodityDescribe = information[4].ToString();
                //上架时间
                LC_UploadingTime = DateTime.Parse(information[7]);
                //商品状态
                LC_CommodityState = "上架";
                #endregion

                /********************** 添加数据到表************************/
                // context.Response.Write("商品ID: " + LC_CommodityID + "卖家姓名 " + LC_MerchantName + "商品名 " + LC_CommodityName +
                //     "商品类别 " + LC_CommodityCategory + "展示图 " + LC_ShowImage + "详细图ID " + LC_DetailImageID + "成本价 " + LC_CostPrice
                //       + " 销售价 " + LC_SellPrice + "库存 " + LC_Repertory + "商品描述 " + LC_CommodityDescribe + "上架时间 " + LC_UploadingTime);
                try
                {
                    //商品表
                    sql.RunProc("insert  into LC_COMMODITY values('" + LC_CommodityID + "','" + LC_MerchantName + "','" + LC_CommodityName + "','" + LC_CommodityCategory + "','" + LC_ShowImage + "','" + LC_DetailImageID + "'," + LC_CostPrice + "," + LC_SellPrice + ",'" + LC_Repertory + "','" + LC_CommodityDescribe + "','" + LC_UploadingTime + "','" + LC_CommodityState + "')");
                    //   context.Response.Write("商品表插入成功!");
                    //商品表添加成功后才可以添加图片表!
                    //try
                    //{
                    //    //图片表
                    //    //string[] LC_sonImagPath = information[8].Split('_');
                    //    //for (int i = 0; i < LC_sonImagPath.Length; i++)
                    //    //{
                    //    //    if (!string.IsNullOrEmpty(LC_sonImagPath[i]))
                    //    //    {
                    //    //        //sql.RunProc("insert into LC_IMAGE values('" + LC_DetailImageID + "','../App_Image/SellerProImage/" + _username + "/" + LC_sonImagPath[i].ToString() + "')");
                    //    //    }
                    //    //}
                    //    //context.Response.Write("详细图片插入成功!");
                    //}
                    //catch (Exception el)
                    //{
                    //    context.Response.Write("添加数据到图片表错误:  " + el);
                    //}
                }
                catch (Exception el)
                {
                    context.Response.Write("添加数据到商品表错误:  " + el);
                }
                context.Response.Write("SucceesImage");
            }
        }
Ejemplo n.º 8
0
        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "text/plain";
            var LC_Chunk = context.Request["Chunk"];

            if (LC_Chunk == "0")
            {
                var msg = context.Request["Variate"];
                if (!string.IsNullOrEmpty(msg))
                {
                    string Count           = sql.ReturnValue("select COUNT(ShoppingID) from LC_SHOPPING_CART"); //购物车数量
                    string LC_Commd        = sql.ReturnValue("select CommodityDescribe  from LC_COMMODITY  where CommodityID='" + msg + "'");
                    string LC_ProSellPrice = sql.ReturnValue("select SellPrice  from LC_COMMODITY  where CommodityID='" + msg + "'");
                    //判断该商品ID是否存在
                    if (!string.IsNullOrEmpty(LC_Commd))
                    {
                        LC_PurAdater = new SqlDataAdapter();
                        LC_PurTable  = new DataTable();
                        LC_PurAdater = sql.CreateDa("SELECT Paths,ShowImage,Repertory FROM VI_DetailImg WHERE CommodityID='" + msg + "';");
                        LC_PurAdater.Fill(LC_PurTable);
                        string LC_Detailimgs = ""; //展示图
                        string LC_ShowImags  = ""; //详细图
                        int    LC_Repertory  = 0;  //库存
                        foreach (DataRow item in LC_PurTable.Rows)
                        {
                            LC_ShowImags   = item[1].ToString();
                            LC_Detailimgs += item[0].ToString() + "*";
                            LC_Repertory   = int.Parse(item[2].ToString());
                        }
                        //显示评论
                        string        LC_EvaluteID    = sql.ReturnValue("select EvaluteID from LC_EVALUATE where CommodityID='" + msg + "'");
                        StringBuilder LC_ReviewString = new StringBuilder();
                        if (!string.IsNullOrEmpty(LC_EvaluteID))
                        {
                            SqlDataAdapter LC_ReviewAdater = new SqlDataAdapter();
                            LC_ReviewAdater = sql.CreateDa("select UserName,EvaluateDescribe,COUNT(UserName) from LC_EVALUATE_DETAIL where EvaluteID='" + LC_EvaluteID + "' group by UserName,EvaluateDescribe");
                            DataTable LC_ReviewTable = new DataTable();
                            LC_ReviewAdater.Fill(LC_ReviewTable);
                            LC_ReviewString.Append("<tr><th>评论</th><th>用户名</th></tr>");
                            foreach (DataRow item in LC_ReviewTable.Rows)
                            {
                                LC_ReviewString.Append("<tr>");
                                LC_ReviewString.Append("<td>" + item[1] + "</td>");
                                LC_ReviewString.Append("<td>" + item[0] + "</td>");
                                LC_ReviewString.Append("</tr>");
                                LC_ReviewString.Append("*" + item[2] + "");
                            }
                        }
                        else
                        {
                            LC_ReviewString.Append("暂无评论,赶紧抢沙发!");
                        }

                        LC_Detailimgs = LC_ShowImags + "*" + LC_Commd + "*" + LC_ProSellPrice + "*" + LC_Detailimgs.Remove(LC_Detailimgs.Length - 1, 1) + "*" + Count + "*" + LC_ReviewString.ToString() + "*" + LC_Repertory;
                        context.Response.Write(LC_Detailimgs);
                    }
                    else
                    {
                        context.Response.Write("该商品ID不存在!");
                    }
                }
            }
            if (LC_Chunk == "1")
            {
                try
                {
                    //string _Username=context.Request.Cookies["name"].Values[0];
                    string _Username = CookiesValues("name", context);

                    if (!string.IsNullOrEmpty(_Username))
                    {
                        context.Response.Write("True");
                    }
                    else
                    {
                        context.Response.Write("False");
                    }
                }
                catch (Exception el)
                {
                    context.Response.Write("False");
                }
            }
            //点击时候我就把这个商品ID储存到项目中  【步骤二】
            //var acx = context.Request["acx"];
            //HttpCookie axcoolkoie = new HttpCookie("proidss");
            //axcoolkoie.Value = acx;
            //context.Response.AppendCookie(axcoolkoie);
        }