示例#1
0
        protected void Button1_Click(object sender, EventArgs e)
        {
            Watch w = new Watch();

            w.id           = id;
            w.name         = txtName.Text;
            w.categoryid   = int.Parse(listThuongHieu.SelectedValue);
            w.soluong      = int.Parse(txtSoLuong.Text);
            w.gia          = int.Parse(txtGia.Text);
            w.giamgia      = int.Parse(txtGiamGia.Text);
            w.baohanh      = txtBaoHanh.Text;
            w.kieumay      = txtKieuMay.Text;
            w.gioitinh     = listGioiTinh.SelectedValue;
            w.kichco       = txtKichCo.Text;
            w.doday        = txtDoDay.Text;
            w.chatlieuvo   = txtChatLieuVo.Text;
            w.chatlieuday  = txtChatLieuDay.Text;
            w.chatlieukinh = txtChatLieuKinh.Text;
            w.chucnang     = txtChucNang.Text;
            w.dochiunuoc   = txtDoChiuNuoc.Text;
            w.mota         = txtMoTa.Value;
            w.type         = int.Parse(listType.SelectedValue);
            w.anh          = anh;
            if (fileUpload.HasFile)
            {
                string filePath = Server.MapPath("~/Image/Watch/");
                fileUpload.SaveAs(filePath + id + Path.GetExtension(fileUpload.FileName));
                w.anh = Path.GetExtension(fileUpload.FileName);
            }


            xuly.updateWatch(w);
            Response.Redirect(Request.RawUrl);
        }