Ejemplo n.º 1
0
    private static void ActionGoods(string nick, string session, TeteShopInfo info)
    {
        TeteShopItemService itemDal = new TeteShopItemService();

        List <GoodsInfo>         glist    = TaoBaoAPI.GetGoodsInfoListByNick(info.Short, session, info.Appkey, info.Appsecret);
        IList <TeteShopItemInfo> itemList = itemDal.GetAllTeteShopItem(Encrypt(nick));

        List <TeteShopItemInfo> addList = new List <TeteShopItemInfo>();
        List <TeteShopItemInfo> upList  = new List <TeteShopItemInfo>();

        foreach (GoodsInfo cinfo in glist)
        {
            List <TeteShopItemInfo> clist = itemList.Where(o => o.Itemid == cinfo.num_iid).ToList();
            if (clist.Count > 0)
            {
                InitItem(nick, cinfo, clist[0]);
                upList.Add(clist[0]);
            }

            else
            {
                TeteShopItemInfo ainfo = new TeteShopItemInfo();
                InitItem(nick, cinfo, ainfo);

                addList.Add(ainfo);
            }
        }

        //添加
        foreach (TeteShopItemInfo cinfo in addList)
        {
            itemDal.AddTeteShopItem(cinfo);
        }

        //修改
        foreach (TeteShopItemInfo cinfo in upList)
        {
            itemDal.ModifyTeteShopItem(cinfo);
        }

        //删除
        //List<TeteShopItemInfo> delList = new List<TeteShopItemInfo>();
        //foreach (TeteShopItemInfo cinfo in itemList)
        //{
        //    if (upList.Where(o => o.Itemid == cinfo.Itemid).ToList().Count == 0)
        //    {
        //        delList.Add(cinfo);
        //    }
        //}

        //foreach (TeteShopItemInfo cinfo in upList)
        //{
        //    itemDal.DeleteTeteShopItem(cinfo.Id);
        //}
    }
Ejemplo n.º 2
0
    public int UpdateShopInfo(TeteShopInfo info)
    {
        SqlParameter[] param = new[]
        {
            new SqlParameter("@ads", info.Ads),
            new SqlParameter("@logo", info.Logo),
            new SqlParameter("@guid", info.Guid)
        };

        return(DBHelper.ExecuteNonQuery(SQL_UPDATE, param));
    }
Ejemplo n.º 3
0
    public int InsertShop(TeteShopInfo info)
    {
        SqlParameter[] param = new[]
        {
            new SqlParameter("@guid", Guid.NewGuid()),
            new SqlParameter("@nick", info.Nick),
            new SqlParameter("@short", info.Short),
            new SqlParameter("@appkey", info.Appkey),
            new SqlParameter("@appsecret", info.Appsecret),
            new SqlParameter("@session", info.Session),
            new SqlParameter("@adddate", info.Adddate)
        };

        return(DBHelper.ExecuteNonQuery(SQL_INSERT, param));
    }
Ejemplo n.º 4
0
    public TeteShopInfo GetShopInfo(string nick)
    {
        TeteShopInfo info  = null;
        SqlParameter param = new SqlParameter("@nick", nick);
        DataTable    dt    = DBHelper.ExecuteDataTable(SQL_SELECT_BY_NICK, param);

        foreach (DataRow dr in dt.Rows)
        {
            info           = new TeteShopInfo();
            info.Guid      = new Guid(dr["guid"].ToString());
            info.Logo      = dr["logo"] == DBNull.Value ? "" : dr["logo"].ToString();
            info.Ads       = dr["ads"] == DBNull.Value ? "" : dr["ads"].ToString();
            info.Appsecret = dr["appsecret"].ToString();
            info.Appkey    = dr["appkey"].ToString();
        }

        return(info);
    }
Ejemplo n.º 5
0
    protected override void InitializeCulture()
    {
        string msg = "尊敬的用户您好,非常抱歉的告诉您,您尚未订购该功能,如需继续使用请购买该服务:<br><br>9元/月  <a href=' http://fuwu.taobao.com/item/subsc.htm?items=service-0-22762-6:1;' target='_blank'>立即购买</a><br>";

        if (!string.IsNullOrEmpty(Request.QueryString["nick"]) && !string.IsNullOrEmpty(Request.QueryString["nicksession"]) && !string.IsNullOrEmpty(Request.QueryString["mobile"]))
        {
            HttpCookie cookie = new HttpCookie("nick", HttpUtility.UrlEncode(Request.QueryString["nick"]));
            cookie.Expires = DateTime.Now.AddDays(1);
            Response.Cookies.Add(cookie);
            HttpCookie cookieSe = new HttpCookie("nicksession", Request.QueryString["nicksession"]);
            cookieSe.Expires = DateTime.Now.AddDays(1);
            Response.Cookies.Add(cookieSe);

            HttpCookie cookieM = new HttpCookie("mobile", Request.QueryString["nicksession"]);
            cookieM.Expires = DateTime.Now.AddDays(1);
            Response.Cookies.Add(cookieM);

            TeteShopService tss = new TeteShopService();
            if (CacheCollection.GetNickSessionList().Where(o => o.Short == Request.QueryString["nick"]).ToList().Count == 0)
            {
                TeteShopInfo info = new TeteShopInfo();
                info.Nick      = Encrypt(Request.QueryString["nick"]);
                info.Session   = Request.QueryString["nicksession"];
                info.Short     = Request.QueryString["nick"];
                info.Adddate   = DateTime.Now;
                info.Appkey    = "12132145";
                info.Appsecret = "1fdd2aadd5e2ac2909db2967cbb71e7f";
                tss.InsertShop(info);
                CacheCollection.RemoveCacheByKey(CacheCollection.KEY_ALLNICKSESSIONINFO);
            }
        }
        else
        {
            if (Request.Cookies["nick"] == null || Request.Cookies["nicksession"] == null || Request.Cookies["mobile"] == null)
            {
                Response.Redirect("http://www.7fshop.com/top/market/buy.aspx?msg=" + msg);
            }
        }
        //else
        //{
        //    Session["nick"] = Request.Cookies["nick"].Value;
        //    Session["session"] = Request.Cookies["nicksession"].Value;
        //}
    }
Ejemplo n.º 6
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            string nick = HttpUtility.UrlDecode(Request.Cookies["nick"].Value);

            TeteShopInfo info = tsDal.GetShopInfo(nick);

            if (info == null)
            {
                Page.RegisterStartupScript("错误", "<script>alert('您的身份不合法,请确定您已购买!');</script>");
                return;
            }

            Tb_Ads.Text  = info.Ads;
            Tb_Logo.Text = info.Logo;

            ViewState["guid"] = info.Guid;
        }
    }
Ejemplo n.º 7
0
    public IList <TeteShopInfo> GetAllShopInfo()
    {
        DataTable dt = DBHelper.ExecuteDataTable(SQL_SELECT);

        IList <TeteShopInfo> list = new List <TeteShopInfo>();

        foreach (DataRow dr in dt.Rows)
        {
            TeteShopInfo info = new TeteShopInfo();
            info.Nick      = dr["nick"].ToString();
            info.Appkey    = dr["appkey"].ToString();
            info.Appsecret = dr["appsecret"].ToString();
            info.Session   = dr["session"].ToString();
            info.Short     = dr["short"].ToString();

            list.Add(info);
        }

        return(list);
    }
Ejemplo n.º 8
0
    protected void Btn_Up_Click(object sender, EventArgs e)
    {
        if (string.IsNullOrEmpty(Tb_Ads.Text.Trim()))
        {
            Page.RegisterStartupScript("提示", "<script>alert('请输入Ads链接地址!');</script>");
            return;
        }

        if (string.IsNullOrEmpty(Tb_Logo.Text.Trim()))
        {
            Page.RegisterStartupScript("提示", "<script>alert('请输入Logo链接地址!');</script>");
            return;
        }

        TeteShopInfo info = new TeteShopInfo();

        info.Guid = new Guid(ViewState["guid"].ToString());

        info.Ads  = Tb_Ads.Text.Trim();
        info.Logo = Tb_Logo.Text.Trim();

        tsDal.UpdateShopInfo(info);
        Page.RegisterStartupScript("提示", "<script>alert('更新成功!');</script>");
    }
Ejemplo n.º 9
0
    protected void Btn_Update_Click(object sender, EventArgs e)
    {
        string nick    = HttpUtility.UrlDecode(Request.Cookies["nick"].Value);
        string session = Request.Cookies["nicksession"].Value;

        TeteShopCategoryService cateDal = new TeteShopCategoryService();

        IList <TeteShopInfo> list = CacheCollection.GetNickSessionList().Where(o => o.Short == nick && o.Session == session).ToList();

        TeteShopInfo info = null;

        if (list.Count > 0)
        {
            info = list[0];
        }
        if (info == null)
        {
            Page.RegisterStartupScript("错误", "<script>alert('您的身份不合法,请确定您已购买!');</script>");
            return;
        }

        IList <TeteShopCategoryInfo> cateList  = cateDal.GetAllTeteShopCategory(Encrypt(nick));
        IList <GoodsClassInfo>       classList = TaoBaoAPI.GetGoodsClassInfoList(info.Short, session, info.Appkey, info.Appsecret);

        if (classList == null)
        {
            Page.RegisterStartupScript("错误", "<script>alert('获取店铺分类出错!');</script>");
            return;
        }

        List <TeteShopCategoryInfo> addList = new List <TeteShopCategoryInfo>();

        List <TeteShopCategoryInfo> upList = new List <TeteShopCategoryInfo>();

        foreach (GoodsClassInfo cinfo in classList)
        {
            List <TeteShopCategoryInfo> clist = cateList.Where(o => o.Cateid == cinfo.cid).ToList();
            if (clist.Count > 0)
            {
                InitCate(nick, cinfo, clist[0]);
                clist[0].Catecount = classList.Count(o => o.parent_cid == cinfo.cid);
                upList.Add(clist[0]);
            }

            else
            {
                TeteShopCategoryInfo ainfo = new TeteShopCategoryInfo();
                InitCate(nick, cinfo, ainfo);
                ainfo.Catecount = classList.Count(o => o.parent_cid == cinfo.cid);

                addList.Add(ainfo);
            }
        }

        //添加
        foreach (TeteShopCategoryInfo cinfo in addList)
        {
            cateDal.AddTeteShopCategory(cinfo);
        }

        //修改
        foreach (TeteShopCategoryInfo cinfo in upList)
        {
            cateDal.ModifyTeteShopCategory(cinfo);
        }

        //删除
        //List<TeteShopCategoryInfo> delList = new List<TeteShopCategoryInfo>();
        //foreach (TeteShopCategoryInfo cinfo in cateList)
        //{
        //    if (upList.Where(o => o.Cateid == cinfo.Cateid).ToList().Count == 0)
        //    {
        //        delList.Add(cinfo);
        //    }
        //}

        //foreach (TeteShopCategoryInfo cinfo in upList)
        //{
        //    cateDal.DeleteTeteShopCategory(cinfo.Id);
        //}

        //更新商品
        ActionGoods(nick, session, info);
        //更新商品分类包含商品数量
        IList <TeteShopCategoryInfo> nowCateList = cateDal.GetAllTeteShopCategory(Encrypt(nick));
        TeteShopItemService          itemDal     = new TeteShopItemService();

        for (int i = 0; i < nowCateList.Count; i++)
        {
            int count = itemDal.GetItemCountByCId(nowCateList[i].Cateid);
            nowCateList[i].Catecount = count;
        }

        //修改
        foreach (TeteShopCategoryInfo cinfo in nowCateList)
        {
            cateDal.ModifyTeteShopCategory(cinfo);
        }

        Page.RegisterStartupScript("更新提示", "<script>alert('更新成功!');</script>");
    }