protected void btnDel_Click(object sender, EventArgs e) { LinkButton lbt = (LinkButton)sender; HiddenField h = (HiddenField)lbt.FindControl("hfID"); clsTour tl = new clsTour(); tl.Id = Convert.ToInt32(h.Value); clsBSTour t = new clsBSTour(); if (t.Del(tl)) { lblMes.Text = "<script>alert('Tàu đã được xóa');</script>"; mtvTour.ActiveViewIndex = 0; GridView1.DataBind(); } else { lblMes.Text = "<script>alert('Lỗi, không thể xóa !');</script>"; } }
protected void Page_Load(object sender, EventArgs e) { try { IOBusiness.clsBSDetail obj = new IOBusiness.clsBSDetail(); List<clsDetail> objD = new List<clsDetail>(); objD=obj.GetByTour(Convert.ToInt32(Request.QueryString["id"])); foreach (IOEntity.clsDetail item in objD) { IOBusiness.clsBSTypeDetail type = new IOBusiness.clsBSTypeDetail(); IOEntity.clsTypeDetail typeobj = new IOEntity.clsTypeDetail(); typeobj = type.GetById(item.TypeDetail.Id); AjaxControlToolkit.TabPanel tab = new AjaxControlToolkit.TabPanel(); tab.HeaderText = typeobj.TieuDe; Label lb = new Label(); lb.Text = item.NoiDung; tab.Controls.Add(lb); this.TabContainer1.Tabs.AddAt(0,tab); //this.TabContainer1.Tabs[1] } this.TabContainer1.Tabs.RemoveAt(objD.Count); clsBSTour objtour = new clsBSTour(); clsTour t = new clsTour(); t = objtour.GetById(Convert.ToInt32(Request.QueryString["id"])); this.lblTour.Text = t.TieuDe; this.Label1.Text = t.TieuDe; this.DataList2.DataSource = objtour.GetByLoai(t.TheLoai.Id, Convert.ToInt32(Request.QueryString["id"])); DataList2.DataBind(); if (!Page.IsPostBack) { BindCountry(); } } catch (Exception) { throw; } }
protected void btnCreate_Click(object sender, EventArgs e) { mtvTour.ActiveViewIndex = 1; clsTour tl = new clsTour(); tl.MyTheLoai = Convert.ToInt32(cbxTheLoai.SelectedValue); tl.TieuDe = txtTieuDe.Text; tl.GhiChu = txtGhiChu.Text; tl.Hot = ckbHot.Checked; tl.Stt = Convert.ToInt32(txtViTri.Text); tl.SearchID = Convert.ToInt32(cbxSearch.SelectedValue); if (fileUpload.HasFile) { tl.HinhAnh = fileUpload.FileName; } else { tl.HinhAnh = "demo.jpg"; } clsBSTour bsTL = new clsBSTour(); if (bsTL.Insert(tl)) { if (fileUpload.HasFile == true) { String file = fileUpload.FileName; fileUpload.SaveAs(Server.MapPath("~/Images/HinhAnh/") + file); } lblMes.Text = "<script>alert('Tàu đã được tạo');</script>"; mtvTour.ActiveViewIndex = 0; GridView1.DataBind(); } else { lblMes.Text = "<script>alert('Lỗi, vui lòng kiểm tra dữ liệu !');</script>"; } }
protected void btnEditSave_Click(object sender, EventArgs e) { mtvTour.ActiveViewIndex = 2; clsTour tl = new clsTour(); tl.MyTheLoai = Convert.ToInt32(cbxTheLoaiEdit.SelectedValue); tl.TieuDe = txtTieuDeEdit.Text; tl.GhiChu = txtGhiChuEdit.Text; tl.Hot = ckbHotEdit.Checked; tl.Stt = Convert.ToInt32(txtViTriEdit.Text); tl.Id = Convert.ToInt32(hfID.Value); tl.SearchID = Convert.ToInt32(cbxS.SelectedValue); if (btnIGM.Visible == false) { if (fileUploadEdit.FileName == null) { tl.HinhAnh = hfImage.Value; } else { tl.HinhAnh = fileUploadEdit.FileName; if (fileUploadEdit.HasFile) { fileUploadEdit.SaveAs(Server.MapPath("~/Images/HinhAnh/") + fileUploadEdit.FileName); } } } else { tl.HinhAnh = hfImage.Value; } clsBSTour bsTL = new clsBSTour(); if (bsTL.Edit(tl)) { lblMes.Text = "<script>alert('Tàu đã được sửa');</script>"; mtvTour.ActiveViewIndex = 0; GridView1.DataBind(); } else { lblMes.Text = "<script>alert('Lỗi, vui lòng kiểm tra dữ liệu !');</script>"; } }