protected void Btn_Next_Click(object sender, EventArgs e)
    {
        string keys      = CheckVali();
        string goodsId   = "";
        string goodsname = "";
        string goodspic  = "";

        if (keys != "")
        {
            foreach (RepeaterItem item in Rpt_GoodsList.Items)
            {
                RadioButton rb = item.FindControl("RBtn_Goods") as RadioButton;
                if (rb.Checked)
                {
                    Label lbl = item.FindControl("Lbl_GoodsId") as Label;
                    goodsId = lbl.Text;

                    Label lblname = item.FindControl("Lbl_GoodsName") as Label;
                    goodsname = lblname.Text;

                    Label lblpic = item.FindControl("Lbl_GoodsPic") as Label;
                    goodspic = lblpic.Text;

                    break;
                }
            }
            if (goodsId != "")
            {
                string nick = "nick";
                if (Request.Cookies["nick"] != null)
                {
                    nick = HttpUtility.UrlDecode(Request.Cookies["nick"].Value); //"nick";
                }
                else
                {
                    if (Session["snick"] != null)
                    {
                        nick = Session["snick"].ToString();
                    }
                }
                TuiGoodsInfo info = new TuiGoodsInfo();
                info.GoodsId   = goodsId;
                info.Keywords  = keys;
                info.TuiId     = Guid.NewGuid();
                info.Nick      = nick;
                info.GoodsName = goodsname;
                info.GoodsPic  = goodspic;
                info.Type      = 1;

                new TuiGoodsService().InsertTuiGoods(info);
                Response.Redirect("BaiShare.aspx?id=" + info.TuiId);
            }
        }
    }
Beispiel #2
0
    private static SqlParameter[] CreateSqlParameter(TuiGoodsInfo info)
    {
        SqlParameter[] param = new[]
        {
            new SqlParameter("@TuiId", info.TuiId),
            new SqlParameter("@GoodsPic", info.GoodsPic),
            new SqlParameter("@GoodsId", info.GoodsId),
            new SqlParameter("@GoodsName", info.GoodsName),
            new SqlParameter("@Keywords", info.Keywords),
            new SqlParameter("@Nick", info.Nick),
            new SqlParameter("@Type", info.Type)
        };

        return(param);
    }
Beispiel #3
0
    public TuiGoodsInfo GetTuiGoods(Guid tuiId)
    {
        SqlParameter param = new SqlParameter("@TuiId", tuiId);

        TuiGoodsInfo info = null;

        DataTable dt = DBHelper.ExecuteDataTable(SQL_SELECT_BY_ID, param);

        foreach (DataRow dr in dt.Rows)
        {
            info           = new TuiGoodsInfo();
            info.GoodsId   = dr["GoodsId"].ToString();
            info.GoodsName = dr["GoodsName"].ToString();
            info.Keywords  = dr["Keywords"].ToString();
            info.GoodsPic  = dr["GoodsPic"].ToString();
        }

        return(info);
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            string id = Request.QueryString["id"];

            TuiGoodsService tuiDal = new TuiGoodsService();
            try
            {
                TuiGoodsInfo info = tuiDal.GetTuiGoods(new Guid(id));

                TB_KeyWords.Text       = info.Keywords.Replace("[ksp]", " ");
                ViewState["GoodsPic"]  = info.GoodsPic;
                ViewState["GoodsUrl"]  = "http://item.taobao.com/item.htm?id=" + info.GoodsId;
                ViewState["GoodsName"] = info.GoodsName;
                ViewState["Keys"]      = info.Keywords.Replace("[ksp]", " ");

                ViewState["ShowUrl"] = Request.Url.ToString().Substring(0, Request.Url.ToString().LastIndexOf("/")) + "/?" + id.Substring(0, 8);
            }
            catch (Exception ex)
            {
            }
        }
    }
Beispiel #5
0
    public IList <TuiGoodsInfo> GetAllTuiGoodsByType(string nick, int type)
    {
        SqlParameter[] param = new[]
        {
            new SqlParameter("@nick", nick),
            new SqlParameter("@type", type)
        };
        IList <TuiGoodsInfo> list = new List <TuiGoodsInfo>();
        DataTable            dt   = DBHelper.ExecuteDataTable(SQL_SELECT_All_BY_TYPE, param);

        foreach (DataRow dr in dt.Rows)
        {
            TuiGoodsInfo info = new TuiGoodsInfo();
            info.GoodsId   = dr["GoodsId"].ToString();
            info.TuiId     = new Guid(dr["TuiId"].ToString());
            info.GoodsName = dr["GoodsName"].ToString();
            info.GoodsPic  = dr["GoodsPic"].ToString();
            info.Keywords  = dr["Keywords"].ToString();

            list.Add(info);
        }

        return(list);
    }
Beispiel #6
0
 public int InsertTuiGoods(TuiGoodsInfo info)
 {
     return(DBHelper.ExecuteNonQuery(SQL_INSERT, CreateSqlParameter(info)));
 }