Exemple #1
0
    public void SkipProduct()
    {
        L_ProductInfo pinfo = new productinfo().GetProduct(productID);

        txtProNumber.Text      = pinfo.Pronumber;
        txtProductName.Text    = pinfo.ProductName;
        ddlLeavl.SelectedIndex = pinfo.ProductCategoryID;
        imgPhoto.ImageUrl      = "~/photo/" + pinfo.ProductImage;
        txtPrice.Text          = pinfo.Price.ToString().Replace(".0000", "");
        txtCurrentPrince.Text  = pinfo.CurrentPrice.ToString().Replace(".0000", "");
        txtMenberPrince.Text   = pinfo.MenberPrince.ToString().Replace(".0000", "");
        txtPoductStore.Text    = pinfo.ProducStore.ToString();
        this.ddlDanWei.ClearSelection();
        ddlDanWei.Items.FindByValue(pinfo.Danwei).Selected = true;
        this.ddlFreightType.ClearSelection();
        ddlFreightType.Items.FindByValue(pinfo.FreightType).Selected = true;
        txtFreight.Text = pinfo.Freight.ToString().Replace(".0000", "");
        ddlQQList.Items.FindByValue("934532778").Selected = true;
        if (pinfo.Iscommend == 0)
        {
            rbDesc.Checked  = false;
            rbDesc2.Checked = true;
        }
        else
        {
            rbDesc.Checked  = true;
            rbDesc2.Checked = false;
        }
        ddlRemainDay.Items.FindByValue(pinfo.RemainDay.ToString()).Selected = true;
        txtContent.Text    = pinfo.ProductDesc;
        ViewState["photo"] = "noimage.gif";
    }
Exemple #2
0
        public string addcart(string productid, string userid, string buynum)
        {
            int         pid  = TypeParse.DbObjToInt(productid, 0);
            int         bnum = TypeParse.DbObjToInt(buynum, 1);
            productinfo item = product.getproductinfo(pid);

            bool cz = order.CheckCart(userid, pid);

            if (cz)
            {
                string jstr = "{'productid':'" + productid + "','userid':'" + userid + "','buynum':'" + buynum + "'}";
                return(jstr);
            }
            else
            {
                orderinfo data = new orderinfo();
                data.productid = pid;
                data.vipprice  = item.vipprice;
                data.userid    = userid;
                data.buynum    = bnum;
                data.adddate   = DateTime.Now;
                bool result = order.AddCart(data);
                if (result)
                {
                    return("t");
                }
                else
                {
                    return("f");
                }
            }
        }
Exemple #3
0
        protected void AddProductInfo(object sender, EventArgs e)
        {
            string uploadName = imgfile.Value; //获取待上传图片的完整路径,包括文件名
            //string uploadName = InputFile.PostedFile.FileName;
            string pictureName = "noimg.jpg";  //上传后的图片名,以当前时间为文件名,确保文件名没有重复

            if (imgfile.Value != "")
            {
                int    idx    = uploadName.LastIndexOf(".");
                string suffix = uploadName.Substring(idx);//获得上传的图片的后缀名
                if (suffix.ToLower() != ".bmp" && suffix.ToLower() != ".jpg" && suffix.ToLower() != ".jpeg" && suffix.ToLower() != ".png" && suffix.ToLower() != ".gif")
                {
                    imgnote.InnerHtml = "<span style=\"color:red\">上传文件必须是图片格式!</span>";
                    return;
                }
                pictureName = DateTime.Now.Ticks.ToString() + suffix;
            }
            try
            {
                if (uploadName != "")
                {
                    string path = Server.MapPath("/Files/Product/");
                    imgfile.PostedFile.SaveAs(path + pictureName);
                }
                productinfo data = new productinfo();
                data.productimg       = pictureName;
                data.productname      = productname.Value.Trim();
                data.productcode      = productcode.Value.Trim();
                data.productprice     = Convert.ToDecimal(TypeParse.DbObjToString(productprice.Value, "100.00"));
                data.vipprice         = Convert.ToDecimal(TypeParse.DbObjToString(vipprice.Value, "100.00"));
                data.productbrief     = productbrief.Value;
                data.productintroduce = editor_id.Value;
                data.smallcategoryid  = TypeParse.DbObjToInt(scID.SelectedValue, 1);
                data.bigcategoryid    = TypeParse.DbObjToInt(bcID.SelectedValue, 1);
                data.brand            = brand.Value.Trim();
                data.punit            = punit.Value.Trim();
                data.tjtypeid         = TypeParse.DbObjToInt(tjtypeID.SelectedValue, 1);
                data.placeid          = TypeParse.DbObjToInt(placeID.SelectedValue, 1);
                data.salestate        = 0;
                data.adddate          = DateTime.Now;
                data.editdate         = DateTime.Now;

                bool result = product.addproduct(data);
                if (result)
                {
                    Response.Write("<script>alert('添加产品成功!');location.href='/Manager/ProductList.aspx';</script>");
                    return;
                }
                else
                {
                    Response.Write("<script>alert('添加产品失败!');location.href='/Manager/ProductList.aspx';</script>");
                    return;
                }
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
        }
Exemple #4
0
        /// <summary>
        /// 添加产品
        /// </summary>
        /// <param name="data"></param>
        /// <returns></returns>
        public static bool addproduct(productinfo data)
        {
            SqlParameter[] parms = new SqlParameter[16];
            parms[0]        = new SqlParameter("@productname", SqlDbType.VarChar, 50);
            parms[0].Value  = data.productname;
            parms[1]        = new SqlParameter("@productprice", SqlDbType.Decimal);
            parms[1].Value  = data.productprice;
            parms[2]        = new SqlParameter("@productcode", SqlDbType.VarChar, 50);
            parms[2].Value  = data.productcode;
            parms[3]        = new SqlParameter("@productbrief", SqlDbType.VarChar, 500);
            parms[3].Value  = data.productbrief;
            parms[4]        = new SqlParameter("@productintroduce", SqlDbType.Text);
            parms[4].Value  = data.productintroduce;
            parms[5]        = new SqlParameter("@vipprice", SqlDbType.Decimal);
            parms[5].Value  = data.vipprice;
            parms[6]        = new SqlParameter("@productimg", SqlDbType.VarChar, 50);
            parms[6].Value  = data.productimg;
            parms[7]        = new SqlParameter("@smallcategoryid", SqlDbType.Int);
            parms[7].Value  = data.smallcategoryid;
            parms[8]        = new SqlParameter("@bigcategoryid", SqlDbType.Int);
            parms[8].Value  = data.bigcategoryid;
            parms[9]        = new SqlParameter("@placeid", SqlDbType.Int);
            parms[9].Value  = data.placeid;
            parms[10]       = new SqlParameter("@brand", SqlDbType.VarChar, 50);
            parms[10].Value = data.brand;
            parms[11]       = new SqlParameter("@tjtypeid", SqlDbType.Int);
            parms[11].Value = data.tjtypeid;
            parms[12]       = new SqlParameter("@salestate", SqlDbType.Int);
            parms[12].Value = data.salestate;
            parms[13]       = new SqlParameter("@punit", SqlDbType.VarChar, 50);
            parms[13].Value = data.punit;
            parms[14]       = new SqlParameter("@adddate", SqlDbType.DateTime);
            parms[14].Value = data.adddate;
            parms[15]       = new SqlParameter("@editdate", SqlDbType.DateTime);
            parms[15].Value = data.editdate;

            string sql    = "insert into product (productname,productprice,productcode,productbrief,productintroduce,vipprice,productimg,smallcategoryid,bigcategoryid,brand,punit,adddate,editdate,salestate,placeid,tjtypeid) values(@productname,@productprice,@productcode,@productbrief,@productintroduce,@vipprice,@productimg,@smallcategoryid,@bigcategoryid,@brand,@punit,@adddate,@editdate,@salestate,@placeid,@tjtypeid)";
            int    result = 0;

            try
            {
                result = SqlHelper.ExecuteNonQuery(SqlHelper.connectionstring, CommandType.Text, sql, parms);
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
            finally
            {
            }
            return(result > 0);
        }
Exemple #5
0
    private IList BindIsComnendRepeater(int IsType, int topNum)
    {
        IList  il;
        string CacheName = "cachByClassIDData_" + IsType;

        if (HttpContext.Current.Cache[CacheName] == null)
        {
            il = new productinfo().GetIndexBindProductShow(Convert.ToInt16(IsType), " top " + topNum + " ");
            HttpContext.Current.Cache.Add(CacheName, il, null, DateTime.MaxValue, new TimeSpan(0, 3, 0, 0, 0), System.Web.Caching.CacheItemPriority.Normal, null);
        }
        il = (IList)HttpContext.Current.Cache.Get(CacheName);
        return(il);
    }
Exemple #6
0
        //绑定浏览记录
        public static List <productinfo> bindproductlistvh(int n, string pidstr)
        {
            SqlParameter[] parms = new SqlParameter[1];
            parms[0]       = new SqlParameter("@pidstr", SqlDbType.NVarChar, 500);
            parms[0].Value = pidstr;

            List <productinfo> list = new List <productinfo>();
            string             sql  = "SELECT TOP " + n + " a.productid,a.productname,a.productprice,a.productcode,a.productbrief,a.productintroduce,a.vipprice,a.productimg,a.smallcategoryid,a.bigcategoryid,a.brand,a.punit,a.placeid,a.adddate,a.editdate,a.salestate,a.tjtypeid,b.bigcategory,c.smallcategory,d.place from product a ,bigcategory b ,smallcategory c ,place d where a.smallcategoryid=c.smallcategoryid and b.bigcategoryid=c.bigcategoryid and a.placeid=d.placeid  and a.productid in (" + pidstr + ")";

            try
            {
                DataTable dt = SqlHelper.ExecuteDataset(SqlHelper.connectionstring, CommandType.Text, sql, parms).Tables[0];
                if (dt != null)
                {
                    foreach (DataRow dr in dt.Rows)
                    {
                        productinfo item = new productinfo();
                        item.productid        = TypeParse.DbObjToInt(dr["productid"].ToString(), 0);
                        item.productname      = TypeParse.DbObjToString(dr["productname"].ToString(), "");
                        item.vipprice         = Convert.ToDecimal(TypeParse.DbObjToString(dr["vipprice"].ToString(), "100.00"));
                        item.productprice     = Convert.ToDecimal(TypeParse.DbObjToString(dr["productprice"].ToString(), "100.00"));
                        item.productcode      = TypeParse.DbObjToString(dr["productcode"].ToString(), "");
                        item.productbrief     = TypeParse.DbObjToString(dr["productbrief"].ToString(), "");
                        item.productintroduce = TypeParse.DbObjToString(dr["productintroduce"].ToString(), "");
                        item.productimg       = TypeParse.DbObjToString(dr["productimg"].ToString(), "");
                        item.smallcategoryid  = TypeParse.DbObjToInt(dr["smallcategoryid"].ToString(), 0);
                        item.smallcategory    = TypeParse.DbObjToString(dr["smallcategory"].ToString(), "");
                        item.bigcategoryid    = TypeParse.DbObjToInt(dr["bigcategoryid"].ToString(), 0);
                        item.brand            = TypeParse.DbObjToString(dr["brand"].ToString(), "");
                        item.punit            = TypeParse.DbObjToString(dr["punit"].ToString(), "");
                        item.adddate          = TypeParse.DbObjToDateTime(dr["adddate"], DateTime.Now);
                        item.editdate         = TypeParse.DbObjToDateTime(dr["editdate"], DateTime.Now);
                        item.salestate        = TypeParse.DbObjToInt(dr["salestate"].ToString(), 0);
                        item.placeid          = TypeParse.DbObjToInt(dr["placeid"].ToString(), 0);
                        item.place            = TypeParse.DbObjToString(dr["place"].ToString(), "");
                        item.tjtypeid         = TypeParse.DbObjToInt(dr["tjtypeid"].ToString(), 0);
                        list.Add(item);
                    }
                }
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
            finally
            {
            }
            return(list);
        }
Exemple #7
0
        /// <summary>
        /// 得到单个产品信息
        /// </summary>
        /// <param name="wiid"></param>
        /// <returns></returns>
        public static productinfo getproductinfo(int productid)
        {
            SqlParameter[] parms = new SqlParameter[1];
            parms[0]       = new SqlParameter("@productid", SqlDbType.Int);
            parms[0].Value = productid;

            productinfo item = new productinfo();
            string      sql  = "select a.productid,a.productname,a.productprice,a.productcode,a.productbrief,a.productintroduce,a.vipprice,a.productimg,a.smallcategoryid,a.bigcategoryid,a.brand,a.punit,a.placeid,a.adddate,a.editdate,a.salestate,a.tjtypeid,b.bigcategory,c.smallcategory,d.place from product a ,bigcategory b ,smallcategory c ,place d where a.smallcategoryid=c.smallcategoryid and b.bigcategoryid=c.bigcategoryid and a.placeid=d.placeid and productid=@productid";

            try
            {
                SqlDataReader dr = SqlHelper.ExecuteReader(SqlHelper.connectionstring, CommandType.Text, sql, parms);
                if (dr.Read())
                {
                    item.productid        = TypeParse.DbObjToInt(dr["productid"].ToString(), 0);
                    item.productname      = TypeParse.DbObjToString(dr["productname"].ToString(), "");
                    item.vipprice         = Convert.ToDecimal(TypeParse.DbObjToString(dr["vipprice"].ToString(), "100.00"));
                    item.productprice     = Convert.ToDecimal(TypeParse.DbObjToString(dr["productprice"].ToString(), "100.00"));
                    item.productcode      = TypeParse.DbObjToString(dr["productcode"].ToString(), "");
                    item.productbrief     = TypeParse.DbObjToString(dr["productbrief"].ToString(), "");
                    item.productintroduce = TypeParse.DbObjToString(dr["productintroduce"].ToString(), "");
                    item.productimg       = TypeParse.DbObjToString(dr["productimg"].ToString(), "");
                    item.smallcategoryid  = TypeParse.DbObjToInt(dr["smallcategoryid"].ToString(), 0);
                    item.bigcategoryid    = TypeParse.DbObjToInt(dr["bigcategoryid"].ToString(), 0);
                    item.bigcategory      = TypeParse.DbObjToString(dr["bigcategory"].ToString(), "");
                    item.smallcategory    = TypeParse.DbObjToString(dr["smallcategory"].ToString(), "");
                    item.brand            = TypeParse.DbObjToString(dr["brand"].ToString(), "");
                    item.punit            = TypeParse.DbObjToString(dr["punit"].ToString(), "");
                    item.adddate          = TypeParse.DbObjToDateTime(dr["adddate"], DateTime.Now);
                    item.editdate         = TypeParse.DbObjToDateTime(dr["editdate"], DateTime.Now);
                    item.salestate        = TypeParse.DbObjToInt(dr["salestate"].ToString(), 0);
                    item.placeid          = TypeParse.DbObjToInt(dr["placeid"].ToString(), 0);
                    item.place            = TypeParse.DbObjToString(dr["place"].ToString(), "");
                    item.tjtypeid         = TypeParse.DbObjToInt(dr["tjtypeid"].ToString(), 0);
                    dr.Close();
                    dr.Dispose();
                }
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
            finally
            {
            }
            return(item);
        }
Exemple #8
0
    private void BindIsCommendhotShopping()
    {
        IList  il;
        string CacheName = "cachIscommentHotProduct";

        if (HttpContext.Current.Cache[CacheName] == null)
        {
            il = new productinfo().GetIndexBindHottuiJian(0, 1, "top 10");
            HttpContext.Current.Cache.Add(CacheName, il, null, DateTime.MaxValue, new TimeSpan(0, 3, 0, 0, 0), System.Web.Caching.CacheItemPriority.Normal, null);
        }
        il = (IList)HttpContext.Current.Cache.Get(CacheName);
        if (il.Count > 0)
        {
            rpIsBindHot.DataSource = il;
            rpIsBindHot.DataBind();
        }
    }
Exemple #9
0
        /// <summary>
        /// 得到产品
        /// </summary>
        /// <param name="pdata"></param>
        /// <returns></returns>
        public static List <productinfo> getproduct(pageinfo pdata)
        {
            List <productinfo> list = new List <productinfo>();

            try
            {
                DataTable dt = pagehelper.getpagedt(pdata);
                if (dt != null)
                {
                    foreach (DataRow dr in dt.Rows)
                    {
                        productinfo item = new productinfo();
                        item.productid        = TypeParse.DbObjToInt(dr["productid"].ToString(), 0);
                        item.productname      = TypeParse.DbObjToString(dr["productname"].ToString(), "");
                        item.vipprice         = Convert.ToDecimal(TypeParse.DbObjToString(dr["vipprice"].ToString(), "100.00"));
                        item.productprice     = Convert.ToDecimal(TypeParse.DbObjToString(dr["productprice"].ToString(), "100.00"));
                        item.productcode      = TypeParse.DbObjToString(dr["productcode"].ToString(), "");
                        item.productbrief     = TypeParse.DbObjToString(dr["productbrief"].ToString(), "");
                        item.productintroduce = TypeParse.DbObjToString(dr["productintroduce"].ToString(), "");
                        item.productimg       = TypeParse.DbObjToString(dr["productimg"].ToString(), "");
                        item.smallcategoryid  = TypeParse.DbObjToInt(dr["smallcategoryid"].ToString(), 0);
                        item.bigcategoryid    = TypeParse.DbObjToInt(dr["bigcategoryid"].ToString(), 0);
                        item.smallcategory    = TypeParse.DbObjToString(dr["smallcategory"].ToString(), "");
                        item.bigcategory      = TypeParse.DbObjToString(dr["bigcategory"].ToString(), "");
                        item.brand            = TypeParse.DbObjToString(dr["brand"].ToString(), "");
                        item.punit            = TypeParse.DbObjToString(dr["punit"].ToString(), "");
                        item.adddate          = TypeParse.DbObjToDateTime(dr["adddate"], DateTime.Now);
                        item.editdate         = TypeParse.DbObjToDateTime(dr["editdate"], DateTime.Now);
                        item.salestate        = TypeParse.DbObjToInt(dr["salestate"].ToString(), 0);
                        item.placeid          = TypeParse.DbObjToInt(dr["placeid"].ToString(), 0);
                        item.place            = TypeParse.DbObjToString(dr["place"].ToString(), "");
                        list.Add(item);
                    }
                }
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
            finally
            {
            }
            return(list);
        }
Exemple #10
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (RouteData.Values["productid"] != null && RouteData.Values["productid"].ToString() != "0")
            {
                int         nid  = TypeParse.DbObjToInt(RouteData.Values["productid"].ToString(), 0);
                productinfo item = product.getproductinfo(nid);
                pTitleHTML = item.productname;
                pDATA      = item;

                //添加浏览历史

                if (Request.Cookies["tfviewhistory"] != null)
                {
                    string   vhstr = Request.Cookies["tfviewhistory"].Value.ToString();
                    string[] vh    = vhstr.Split(',');
                    int      q     = 0;
                    for (int p = 0; p < vh.Length; p++)
                    {
                        if (nid.ToString() == vh[p])
                        {
                            q = 1;
                        }
                    }
                    if (q == 0)
                    {
                        vhstr += "," + nid;
                        Response.Cookies["tfviewhistory"].Value   = vhstr;
                        Response.Cookies["tfviewhistory"].Expires = DateTime.Now.AddDays(30);
                    }
                }
                else
                {
                    HttpCookie vcookie = new HttpCookie("tfviewhistory");
                    vcookie.Expires = DateTime.Now.AddDays(30);
                    vcookie.Value   = nid.ToString();
                    Response.Cookies.Add(vcookie);
                }
            }
            else
            {
                Response.Redirect("/PList");
            }
        }
Exemple #11
0
        public SolrResponse SearchByQuery(string query)
        {
            var Productlists = new List <productinfo>();

            using (var client = new HttpClient())
            {
                string queryStr = _searchUrl + query;
                //var finalUrl = Uri.EscapeUriString(queryStr);
                HttpResponseMessage response = client.GetAsync(queryStr).Result;
                var responseString           = response.Content.ReadAsStringAsync().Result;
                Console.WriteLine(responseString);
                JObject data     = JsonConvert.DeserializeObject <JObject>(responseString);
                var     products = data.Values().Select(x => x.ToObject <productinfo>()).ToList();
                var     list     = (JArray)data["response"]["docs"];
                Dictionary <string, List <string> > facetDictionary = data["facet_counts"]["facet_fields"].ToObject <Dictionary <string, List <string> > >();

                Dictionary <string, int> FacetQueriesDictionaryBroken = data["facet_counts"]["facet_queries"].ToObject <Dictionary <string, int> >();
                Dictionary <string, int> FacetQueriesDictionaryFixed  = new Dictionary <string, int>();

                foreach (KeyValuePair <string, int> index in FacetQueriesDictionaryBroken)
                {
                    var ses = index.Key;
                    var res = ses.Split('}')[1];
                    FacetQueriesDictionaryFixed[res] = index.Value;
                }


                //Dictionary<string, string> facetDictionary = new Dictionary<string, List<string>();
                var NumberTotal = (int)data["response"]["numFound"];

                foreach (var item in list)
                {
                    productinfo product = new productinfo();
                    product.Id    = item.Value <int>("id");
                    product.Title = item.Value <string>("Title");
                    product.Price = item.Value <double>("Price");
                    Productlists.Add(product);
                }
                SolrResponse solrR = new SolrResponse(NumberTotal, Productlists, facetDictionary, FacetQueriesDictionaryFixed);
                return(solrR);
            }
        }
Exemple #12
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Request.QueryString["productid"] != null)
            {
                int         id   = TypeParse.DbObjToInt(Request.QueryString["productid"].ToString(), 0);
                productinfo data = product.getproductinfo(id);
                productinfoDATA = data;
                if (!Page.IsPostBack)
                {
                    productname.Value   = data.productname;
                    productcode.Value   = data.productcode;
                    productprice.Value  = data.productprice.ToString();
                    productbrief.Value  = data.productbrief;
                    sproductid.Value    = data.productid.ToString();
                    oldproductimg.Value = data.productimg;
                    vipprice.Value      = data.vipprice.ToString();
                    editor_id.Value     = data.productintroduce;
                    brand.Value         = data.brand;
                    punit.Value         = data.punit;

                    //大目录
                    List <categoryinfo> bclist = category.getbigcategory();
                    bcID.DataSource     = bclist;
                    bcID.DataTextField  = "bigcategory";
                    bcID.DataValueField = "bigcategoryid";
                    bcID.DataBind();
                    for (int k = 0; k < bcID.Items.Count; k++)
                    {
                        if (bcID.Items[k].Value == data.bigcategoryid.ToString())
                        {
                            bcID.SelectedIndex = k;
                        }
                    }

                    //小目录
                    List <categoryinfo> sclist = category.getsmallcategorybyid(TypeParse.DbObjToInt(bcID.SelectedValue, 0));
                    scID.DataSource     = sclist;
                    scID.DataTextField  = "smallcategory";
                    scID.DataValueField = "smallcategoryid";
                    scID.DataBind();
                    for (int n = 0; n < scID.Items.Count; n++)
                    {
                        if (scID.Items[n].Value == data.smallcategoryid.ToString())
                        {
                            scID.SelectedIndex = n;
                        }
                    }

                    //推荐类型
                    List <categoryinfo> tjlist = category.gettjtype();
                    tjtypeID.DataSource     = tjlist;
                    tjtypeID.DataTextField  = "tjtype";
                    tjtypeID.DataValueField = "tjtypeid";
                    tjtypeID.DataBind();
                    for (int k = 0; k < tjtypeID.Items.Count; k++)
                    {
                        if (tjtypeID.Items[k].Value == data.tjtypeid.ToString())
                        {
                            tjtypeID.SelectedIndex = k;
                        }
                    }

                    //产地
                    List <categoryinfo> cdlist = category.getplace();
                    placeID.DataSource     = cdlist;
                    placeID.DataTextField  = "place";
                    placeID.DataValueField = "placeid";
                    placeID.DataBind();
                    for (int k = 0; k < placeID.Items.Count; k++)
                    {
                        if (placeID.Items[k].Value == data.placeid.ToString())
                        {
                            placeID.SelectedIndex = k;
                        }
                    }
                }
            }
        }
 public void AddProduct(productinfo product)
 {
     this.Products.Add(product);
 }