Ejemplo n.º 1
0
 private void bind_update(int id, string showHome)
 {
     ProductInfo info = new ProductInfo();
     if (showHome == "True")
         info.showHome = true;
     else
         info.showHome = false;
     ProductDal dal = new ProductDal();
     dal.setShowHome(id, info);
 }
Ejemplo n.º 2
0
        public Productinfo()
        {
            flg_nav = "product";
            int pid = 0;
            gnum(ref pid,"id");
            info = new ProductDal().view(pid);
            pagetitle = info.productName;


            //datarow = get_info("product","id", 1, 8, pid);
            //pagetitle = datarow["productName"].ToString();

            get_productType(info.TypeId);
            page_proup = get_sametypeup();
            page_pronext = get_sametypenext();

        }
Ejemplo n.º 3
0
        /// <summary>
        /// 读取产品信息
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public ProductInfo read(int id)
        {
            ProductInfo pro = new ProductInfo();

            DataSet so = getData("select * from " + queryT("product") + " where id =" + id);

            if (so.Tables.Count == 0)
                return pro;

            if (so.Tables[0].Rows.Count == 0)
                return pro;

            DataTable dt = so.Tables[0];
            DataRow dr = dt.Rows[0];
            //DataColumn dc = dt.Rows[0];

            pro.Id = Int32.Parse(dr["id"].ToString());
            pro.productName = dr["productName"].ToString();

            pro.TypeId = Int32.Parse(dr["TypeId"].ToString());
            pro.productImgUrl = dr["productImgUrl"].ToString();
            pro.productImgUrl_S = dr["productImgUrl_S"].ToString();
            pro.title1 = dr["title1"].ToString();
            pro.title2 = dr["title2"].ToString();

            pro.content = dr["content"].ToString();
            pro.content1 = dr["content1"].ToString();
            pro.content2 = dr["content2"].ToString();
            pro.content3 = dr["content3"].ToString();

            pro.showHome = bool.Parse(dr["showHome"].ToString());

            pro.price = new Price(dr["price"].ToString());
            pro.HitNum = cint(dr["hitNum"].ToString());
            return pro;
        }
Ejemplo n.º 4
0
 /// <summary>
 /// 像下查找产品列表
 /// </summary>
 /// <param name="typeid"></param>
 /// <param name="page"></param>
 /// <param name="pagesize"></param>
 /// <returns></returns>
 public List<ProductInfo> view_list(int typeid, int page, int pagesize)
 {
     List<ProductInfo> list = new List<ProductInfo>();
     string conditions = "typeId in (select id from " + label_table + "productType where id=" + typeid.ToString() + " or parentId=" + typeid.ToString() + ")";
     string sql = "select * from " + label_table + "product where " + conditions + " order by showId asc,id asc";
     DataSet ds = DataSetcmdText(sql, page, pagesize);
     j_recordcount = findcount("product", conditions);
     if (ds.Tables.Count > 0)
     {
         if (ds.Tables[0].Rows.Count > 0)
         {
             foreach (DataRow dr in ds.Tables[0].Rows)
             {
                 ProductInfo info = new ProductInfo();
                 info.Id = int.Parse(dr["id"].ToString());
                 info.productName = dr["productName"].ToString();
                 info.content = dr["content"].ToString();
                 info.productImgUrl = dr["productImgUrl"].ToString();
                 info.productImgUrl_S = dr["productImgUrl_S"].ToString();
                 list.Add(info);
             }
         }
     }
     return list;
 }
Ejemplo n.º 5
0
 /// <summary>
 /// 产品列表
 /// </summary>
 /// <returns></returns>
 public List<ProductInfo> view_list()
 {
     List<ProductInfo> list = new List<ProductInfo>();
     string sql = "select * from " + label_table + "product";
     DataSet ds = DataSetcmdText(sql);
     j_recordcount = findcount("product", "");
     if (ds.Tables.Count > 0)
     {
         if (ds.Tables[0].Rows.Count > 0)
         {
             foreach (DataRow dr in ds.Tables[0].Rows)
             {
                 ProductInfo info = new ProductInfo();
                 info.Id = int.Parse(dr["id"].ToString());
                 info.productName = dr["productName"].ToString();
                 info.content = dr["content"].ToString();
                 info.productImgUrl = dr["productImgUrl"].ToString();
                 info.productImgUrl_S = dr["productImgUrl_S"].ToString();
                 list.Add(info);
             }
         }
     }
     return list;
 }
Ejemplo n.º 6
0
 /// <summary>
 /// 首页显示
 /// </summary>
 /// <param name="id"></param>
 /// <param name="info"></param>
 /// <returns></returns>
 public bool setShowHome(int id, ProductInfo info)
 {
     edit("product", id.ToString(),
         "showHome", 5, 1, info.showHome
         );
     return true;
 }
Ejemplo n.º 7
0
 /// <summary>
 /// 修改产品信息
 /// </summary>
 /// <param name="proinfo"></param>
 public void updateProduct(ProductInfo proinfo)
 {
     DataSetExecuteEditText("product", "id=" + proinfo.Id.ToString(),
         "productName", proinfo.productName,
         "typeId", proinfo.TypeId,
         "content", proinfo.content,
         "productImgUrl", proinfo.productImgUrl,
         "productImgUrl_S", proinfo.productImgUrl_S,
         "title1", proinfo.title1,
         "title2", proinfo.title2,
         "content1", proinfo.content1,
         "content2", proinfo.content2,
         "content3", proinfo.content3
         );
 }
Ejemplo n.º 8
0
 /// <summary>
 /// 创建一条产品信息
 /// </summary>
 /// <param name="proinfo"></param>
 public void createProduct(ProductInfo proinfo)
 {
     DataSetExecuteAddText("product",
         "productName",proinfo.productName,
         "typeId",proinfo.TypeId,
         "content",proinfo.content,
         "productImgUrl",proinfo.productImgUrl,
         "productImgUrl_S",proinfo.productImgUrl_S,
         "title1",proinfo.title1,
         "title2",proinfo.title2,
         "content1",proinfo.content1,
         "content2",proinfo.content2,
         "content3",proinfo.content3
     );
 }
Ejemplo n.º 9
0
        //保存
        protected void Submit1_ServerClick(object sender, EventArgs e)
        {
            ProductInfo proinfo = new ProductInfo();
            
            proinfo.productName = ProductName.Value.ToString();
            proinfo.title1 = title1.Value.ToString();
            proinfo.title2 = "";//title2.Value.ToString();
            proinfo.TypeId = Int32.Parse(typeId.Text);
            proinfo.content = content.Value.ToString();
            proinfo.content1 = content1.Value.ToString();
            proinfo.content2 = content2.Value.ToString();
            proinfo.content3 = content3.Value.ToString();

            Img im = new Img();
            im.savePathName = "products";

            proinfo.productImgUrl = im.saveImage(filePath.Value);


            if (string.IsNullOrEmpty(im.error))
            {
                ProductDal dal = new ProductDal();
                if (app == "edit")
                {
                    proinfo.Id = id;
                    dal.updateProduct(proinfo);
                    editProduct(id);
                }
                else
                {
                    
                    dal.createProduct(proinfo);
                }

                showMessage("保存成功", "manage.aspx");
            }
            else
            {
                showMessage("出现了错误:"+im.error);
            }
        }