Example #1
0
    public void GetItme()
    {
        object[] str;
        string   str1 = (base.Request.QueryString["type"] == null ? "1" : WebFun.ReplaceComma(base.Request.QueryString["type"]));
        string   str2 = (base.Request.QueryString["page"] == null ? "1" : WebFun.ReplaceComma(base.Request.QueryString["page"]));
        string   str3 = string.Concat("and FLD_TYPE=", str1);

        base.Response.Write("{ \"item\": [ ");
        int     num     = 0;
        int     num1    = 0;
        int     num2    = 5;
        DataSet newList = DBA.GetNewList("ITEMSELL", num2, int.Parse(str2), str3, "ID", "ID", 1, out num, out num1);
        string  str4    = "";

        for (int i = 0; i < newList.Tables[0].Rows.Count; i++)
        {
            int item = (int)newList.Tables[0].Rows[i]["FLD_PRICE"];
            item = item * 4;
            str  = new object[] { str4, "{ \"id\":\"", newList.Tables[0].Rows[i]["FLD_PID"].ToString(), "\",\"name\": \"", newList.Tables[0].Rows[i]["FLD_NAME"].ToString(), "\", \"pic\":\"Images/Item/", newList.Tables[0].Rows[i]["FLD_PID"].ToString(), ".gif\",\"yjg\":\"", item, "\",\"jg\":\"", newList.Tables[0].Rows[i]["FLD_PRICE"].ToString(), "\",\"info\":\"", newList.Tables[0].Rows[i]["FLD_DESC"].ToString(), "\",\"type\":\"", newList.Tables[0].Rows[i]["FLD_TYPE"].ToString(), "\"}" };
            string str5 = string.Concat(str);
            base.Response.Write(str5.Replace("\n", ""));
            str4 = ",";
        }
        base.Response.Write("],");
        HttpResponse response = base.Response;

        str = new object[] { "\"pages\": [{\"curpage\":\"", str2, "\",\"pagenum\":\"", num, "\",\"type\":\"", str1, "\"}]" };
        response.Write(string.Concat(str));
        base.Response.Write("}");
        newList.Dispose();
    }
Example #2
0
    protected void Page_Load(object sender, EventArgs e)
    {
        object[] item;
        base.Response.ContentEncoding = Encoding.GetEncoding("utf-8");
        string str  = (base.Request.QueryString["itemid"] == null ? "1" : WebFun.ReplaceComma(base.Request.QueryString["itemid"]));
        string str1 = (base.Request.QueryString["itemnum"] == null ? "1" : WebFun.ReplaceComma(base.Request.QueryString["itemnum"]));
        string str2 = (base.Request.QueryString["itemje"] == null ? "1" : WebFun.ReplaceComma(base.Request.QueryString["itemje"]));
        string str3 = (base.Request.QueryString["type"] == null ? "0" : WebFun.ReplaceComma(base.Request.QueryString["type"]));
        string str4 = (base.Request.QueryString["option1"] == null ? "0" : WebFun.ReplaceComma(base.Request.QueryString["option1"]));
        string str5 = (base.Request.QueryString["option2"] == null ? "0" : WebFun.ReplaceComma(base.Request.QueryString["option2"]));
        string str6 = (base.Request.QueryString["option3"] == null ? "0" : WebFun.ReplaceComma(base.Request.QueryString["option3"]));
        string str7 = (base.Request.QueryString["option4"] == null ? "0" : WebFun.ReplaceComma(base.Request.QueryString["option4"]));
        int    num  = (this.Session["SSPOINT"] == null ? 0 : int.Parse(this.Session["SSPOINT"].ToString()));
        int    num1 = (this.Session["SSCASH"] == null ? 0 : int.Parse(this.Session["SSCASH"].ToString()));
        int    num2 = (this.Session["SSBLANK"] == null ? 0 : int.Parse(this.Session["SSBLANK"].ToString()));
        int    num3 = int.Parse(str2);
        int    num4 = int.Parse(str1);

        if (num4 > num2)
        {
            base.Response.Write("{\"goumai\": [ { \"state\": \"0\",\"title\":\"인벤토리 부족 구입실패 1\"}]} ");
        }
        else if (!(num3 > num & num3 > num1))
        {
            if (str3 == "3")
            {
                item = new object[] { this.Session["Id"], ",", str, ",", str1, ",", str2, ",0,", str4, ",", str5, ",", str6, ",", str7 };
                if (PublicClass.SendBuyShuxing(string.Concat(item)))
                {
                    if (num3 > 0)
                    {
                        if (num < num3)
                        {
                            if (num1 >= num3)
                            {
                                this.Session["SSCASH"]  = num1 - num3;
                                this.Session["SSBLANK"] = num2 - num4;
                                base.Response.Write("{\"goumai\": [ { \"state\": \"1\",\"title\":\"축하합니다 ~! 판매 성공\"}]} ");
                                return;
                            }
                            base.Response.Write("{\"goumai\": [ { \"state\": \"0\",\"title\":\"포인트 부족 1\"}]} ");
                            return;
                        }
                        this.Session["SSPOINT"] = num - num3;
                    }
                    this.Session["SSBLANK"] = num2 - num4;
                    base.Response.Write("{\"goumai\": [ { \"state\": \"1\",\"title\":\"축하합니다 ~! 판매 성공\"}]} ");
                }
                else
                {
                    base.Response.Write("{\"goumai\": [ { \"state\": \"0\",\"title\":\"구매오류 1\"}]} ");
                }
                return;
            }
            else
            {
                item = new object[] { this.Session["Id"], ",", str, ",", str1, ",", str2, "," };
                if (PublicClass.SendBuy(string.Concat(item)))
                {
                    if (num3 > 0)
                    {
                        if (num < num3)
                        {
                            if (num1 >= num3)
                            {
                                this.Session["SSCASH"]  = num1 - num3;
                                this.Session["SSBLANK"] = num2 - num4;
                                base.Response.Write("{\"goumai\": [ { \"state\": \"1\",\"title\":\"축하합니다 ~! 판매 성공\"}]} ");
                                this.Session["SSCASH"]  = num1 - num3;
                                this.Session["SSBLANK"] = num2 - num4;
                                base.Response.Write("{\"goumai\": [ { \"state\": \"1\",\"title\":\"축하합니다 ~! 판매 성공\"}]} ");
                                return;
                            }
                            base.Response.Write("{\"goumai\": [ { \"state\": \"0\",\"title\":\"구매 오류 2\"}]} ");
                            return;
                        }
                        this.Session["SSPOINT"] = num - num3;
                    }
                    this.Session["SSBLANK"] = num2 - num4;
                    base.Response.Write("{\"goumai\": [ { \"state\": \"1\",\"title\":\"축하합니다 ~! 판매 성공\"}]} ");
                }
                else
                {
                    base.Response.Write("{\"goumai\": [ { \"state\": \"0\",\"title\":\"구매오류 3\"}]} ");
                }
                return;
            }
            this.Session["SSCASH"]  = num1 - num3;
            this.Session["SSBLANK"] = num2 - num4;
            base.Response.Write("{\"goumai\": [ { \"state\": \"1\",\"title\":\"축하합니다 ~! 판매 성공\"}]} ");
            return;
        }
        else
        {
            base.Response.Write("{\"goumai\": [ { \"state\": \"0\",\"title\":\"인벤토리 부족 구입실패 2\"}]} ");
        }
    }