private void tenhang_PreviewClick(object sender, PreviewMouseEventArgs e) { DataTable temp = new DataTable(); gencon gen = new gencon(); baocaotonkho bctk = new baocaotonkho(); temp = gen.GetTable("select a.StockID from Stock a, Stock b where a.StockID=b.Parent and a.StockCode='" + e.Brick.Text.Substring(0, 2) + "'"); if (temp.Rows.Count > 1) { string makho = gen.GetString("select BranchID from Stock where StockCode='" + e.Brick.Text.Substring(0, 2) + "'"); bctk.inbctktong(ngaychungtu, "tsbtbctktttdv", makho); } else { string makho = gen.GetString("select StockID from Stock where StockCode='" + e.Brick.Text.Substring(0, 2) + "'"); bctk.inbctktong(ngaychungtu, "tsbtbctktsl", makho); } }