Exemple #1
0
 protected void btnTimKiem_Click(object sender, EventArgs e)
 {
     System.Data.DataTable dt = xlsp.TimSanPhamTheoMaSP(txtTimKiem.Text.Trim());
     if (dt.Rows.Count > 0)
     {
         txtMaSP.Text              = dt.Rows[0]["MASP"].ToString();
         txtTenSP.Text             = dt.Rows[0]["TENSP"].ToString();
         drDanhMuc.SelectedValue   = dt.Rows[0]["MADM"].ToString();
         hdImage.Value             = dt.Rows[0]["HINH"].ToString();
         txtDonGia.Text            = dt.Rows[0]["DONGIA"].ToString();
         txtTacGia.Text            = dt.Rows[0]["TACGIA"].ToString();
         blah.ImageUrl             = "~/images/" + dt.Rows[0]["HINH"].ToString();
         txtSoTrang.Text           = dt.Rows[0]["SOTRANG"].ToString();
         txtNXB.Text               = dt.Rows[0]["NXB"].ToString();
         txtMoTa.Text              = dt.Rows[0]["MOTA"].ToString();
         txtSoLuong.Text           = dt.Rows[0]["SOLUONGBAN"].ToString();
         drTrangThai.SelectedIndex = ((bool)dt.Rows[0]["TRANGTHAI"]) == true ? 0 : 1;
     }
 }
Exemple #2
0
        protected void btnThemVaoDM_Click(object sender, EventArgs e)
        {
            try
            {
                if (txtMaDM.Text != null && txtMaDM.Text.Trim() != "")
                {
                    if (xldm.TimDanhMucTheoMaDM(txtMaDM.Text.Trim()).Rows.Count > 0)
                    {
                        XuLySanPham xlsp = new XuLySanPham();
                        if (xlsp.TimSanPhamTheoMaSP(txtMaSP.Text.Trim()).Rows.Count > 0)
                        {
                            xlsp.CapNhatDanhMucCuaSP(txtMaSP.Text.Trim(), txtMaDM.Text.Trim());

                            NapDuLieuChoControls(txtMaDM.Text.Trim());
                        }
                    }
                }
            }catch
            {
                ScriptManager.RegisterStartupScript(this, this.GetType(), "alert", "alert('Thao tác không thành công!');", true);
            }
        }