Пример #1
0
        /// <summary>
        /// 通过id查询商品对象
        /// </summary>
        /// <param name="gid"></param>
        /// <returns></returns>
        public static YC_Goods selectObjectById(int gid)
        {
            DataTable dt = BLL.Goods.selectOneByID(gid);
            YC_Goods  g  = new YC_Goods();
            DataRow   dr = dt.Rows[0];

            g.Name         = dr["Name"].ToString();
            g.Cxprice      = Convert.ToDouble(dr["CXPrice"].ToString());
            g.SCPrice      = Convert.ToDouble(dr["SCPrice"].ToString());
            g.DesImg1Url   = dr["DesImg1Url"].ToString();
            g.DesImg2Url   = dr["DesImg2Url"].ToString();
            g.DesImg3Url   = dr["DesImg3Url"].ToString();
            g.AllSize      = dr["AllSize"].ToString();
            g.DetailImages = dr["DetailImages"].ToString();
            return(g);
        }
Пример #2
0
 public void getGoods()
 {
     if (Request.QueryString["GID"] == null)
     {
         Response.Write("{status:\"failure\"}");
     }
     else
     {
         int      gid      = Convert.ToInt32(Request.QueryString["GID"]);
         YC_Goods goodobj  = BLL.Goods.selectObjectById(gid);
         string   allsize  = goodobj.AllSize;
         string   cxprice  = goodobj.Cxprice.ToString();
         string   goodname = goodobj.Name;
         string   img1     = goodobj.DesImg1Url;
         Response.Write("{status:\"success\",allsize:\"" + allsize + "\",cxprice:\"" + cxprice + "\",goodname:\"" + goodname + "\",imgurl:\"" + img1 + "\"}");
     }
 }
Пример #3
0
        protected void btnSubmit_Click(object sender, EventArgs e)
        {
            if (FileUpload1.HasFile == false || FileUpload2.HasFile == false || FileUpload3.HasFile == false)
            {
                ClientScript.RegisterClientScriptBlock(this.GetType(), "fileup", "<script>warningDesPic();</script>");
            }
            else if (txtName.Text.Trim() == "" || txtSize.Text.Trim() == "" || txtSCPrice.Text.Trim() == "" || txtCXPrice.Text.Trim() == "")
            {
                ClientScript.RegisterClientScriptBlock(this.GetType(), "fileup", "<script>warningEmpty();</script>");
            }
            else
            {
                string name = txtName.Text.Trim();
                //市场价格
                string scprice = txtSCPrice.Text.Trim();
                //促销价格
                string cxprice = txtCXPrice.Text.Trim();
                //可选尺码
                string selectSize = txtSize.Text.Trim();
                string File1      = FileUpload1.FileName;
                string File2      = FileUpload2.FileName;
                string File3      = FileUpload3.FileName;
                string DetailDes  = FCKeditor1.Value;
                //string type1, type2, type3;
                //type1 = File1.Substring(File1.LastIndexOf("."));
                //type2 = File2.Substring(File2.LastIndexOf("."));
                //type3 = File3.Substring(File3.LastIndexOf("."));
                ///这里还没有判断是否是图片
                //////
                //随机种子
                //Random rd = new Random();
                //int sj1= rd.Next(10000, 99999999);
                //int sj2 = rd.Next(10000, 99999999);
                //int sj3 = rd.Next(10000, 99999999);
                //File1 = File1 + sj1.ToString();
                //File2 = File2 + sj1.ToString();
                //File3 = File3 + sj1.ToString();
                string a1    = getFileName(File1);
                string a2    = getFileName(File2);
                string a3    = getFileName(File3);
                string path1 = Server.MapPath("~\\productImg\\" + a1);
                string path2 = Server.MapPath("~\\productImg\\" + a2);
                string path3 = Server.MapPath("~\\productImg\\" + a3);

                FileUpload1.SaveAs(path1);
                FileUpload2.SaveAs(path2);
                FileUpload1.SaveAs(path3);
                string goodtype = ddlType.SelectedValue;
                ///
                YC_Goods goods = new YC_Goods();
                goods.Gtid         = Convert.ToInt32(goodtype);
                goods.Name         = name;
                goods.SCPrice      = Convert.ToDouble(scprice);
                goods.Cxprice      = Convert.ToDouble(cxprice);
                goods.DesImg1Url   = a1;
                goods.DesImg2Url   = a2;
                goods.DesImg3Url   = a3;
                goods.DetailImages = DetailDes;
                goods.AllSize      = txtSize.Text;
                BLL.AdminGoodManager.add(goods);
                ClientScript.RegisterClientScriptBlock(this.GetType(), "xx", "<script>alert(\"上架成功\")</script>");
            }
        }
Пример #4
0
 /// <summary>
 /// 添加
 /// </summary>
 /// <param name="good"></param>
 /// <returns></returns>
 public static int add(YC_Goods good)
 {
     return(Convert.ToInt32(DAL.GoodsServer.add(good)));
 }
Пример #5
0
 //添加商品
 public static object add(YC_Goods good)
 {
     sqltext = " insert into [dbo].[YC_Goods]([GTID],[Name],[SCPrice],[CXPrice],[DesImg1Url],[DesImg2Url],[DesImg3Url],[DetailImages],[AllSize])values('" + good.Gtid + "', '" + good.Name + "', '" + good.SCPrice + "', '" + good.SCPrice + "', '" + good.DesImg1Url + "', '" + good.DesImg2Url + "', '" + good.DesImg3Url + "', '" + good.DetailImages + "','" + good.AllSize + "'); ";
     return(SQLHELPER.ExecuteNonQuery(sqltext));
 }