Beispiel #1
0
 /// <summary>
 /// 商品資料登入資料庫
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 protected void btnConfirm_Click(object sender, EventArgs e)
 {
     string sUrl = "";
     if (FileUpload1.PostedFile.FileName.Trim() != "")  //判断上传文件名是否存在
     {
         string extension = Path.GetExtension(FileUpload1.PostedFile.FileName).ToUpper();
         string filename = DateTime.Now.ToString("yyyMMddhhmmss");
         string path = Server.MapPath("") + "/Info/UserCommodity/" + filename + extension;
         this.FileUpload1.PostedFile.SaveAs(path);
         sUrl = "/Info/UserCommodity/" + filename + extension; //保存下上傳的圖片在服務端的地址
         //ShowMsg("上传成功");
     }
     if (tbBrandName.Text.Trim() == "" && tbCommodityCode.Text.Trim() == "" && tbDescription.Text.Trim() == ""
         && tbUrl.Text.Trim() == "" && tbWishPrice.Text.Trim()=="")
     {
         ShowMsg("请先输入商品信息");
     }
     UserCommodityBLL bll = new UserCommodityBLL();
     decimal dWish = 0;
     if (tbWishPrice.Text.Trim() != "" && !decimal.TryParse(tbWishPrice.Text.Trim(), out dWish))
     {
         ShowMsg("输入的价格的格式有误");
     }
     if (bll.AddUserCommodity(tbBrandName.Text.Trim(), tbCommodityCode.Text.Trim()
         , sUrl, Session["UserID"].ToString(), dWish
         , tbDescription.Text.Trim()))
     {
         ShowMsg("商品登录成功");
     }
     else
     {
         ShowMsg("商品登录失败");
     }
 }
Beispiel #2
0
        private void BindChecked()
        {
            UserCommodityBLL bll = new UserCommodityBLL();
            DataSet ds = bll.GetPartCheckdCommodity(Session["Station"].ToString(), Session["UserID"].ToString());
            ds.Tables[0].Rows.Add("00", "0");
            Session["checkedcount"] = ds.Tables[0].Rows.Count;
            dlChecked.DataSource = ds;// bll.GetPartCheckdCommodity(Session["UserID"].ToString());
            dlChecked.DataBind();

            dlChecked.Items[dlChecked.Items.Count - 1].FindControl("ucCheckedCommodity1").Visible = false;
            dlChecked.Items[dlChecked.Items.Count - 1].FindControl("imgAdd").Visible = true;
        }
Beispiel #3
0
 private void BindUnChecked()
 {
     UserCommodityBLL bll = new UserCommodityBLL();
     dlChecking.DataSource = bll.GetPartCheckingCommodity();
     dlChecking.DataBind();
 }