protected void rptTours_ItemDataBound(object sender, RepeaterItemEventArgs e) { if (e.Item.ItemType == ListItemType.Header) { RepeaterOrder.FILE_NAME = "TourList.aspx"; RepeaterOrder.SetOrderLink(e, "Name", Request.QueryString); RepeaterOrder.SetOrderLink(e, "TourType", Request.QueryString); RepeaterOrder.SetOrderLink(e, "NumberOfDay", Request.QueryString); RepeaterOrder.SetOrderLink(e, "LengthTrip", Request.QueryString); } if (e.Item.DataItem is Tour) { Tour tour = (Tour)e.Item.DataItem; #region Name HyperLink hyperLinkView = e.Item.FindControl("hyperLinkView") as HyperLink; if (hyperLinkView != null) { hyperLinkView.Text = tour.Name; if (tour.Provider != null) { hyperLinkView.NavigateUrl = string.Format("TourPackagePriceConfig.aspx?NodeId={0}&SectionId={1}&TourId={2}", Node.Id, Section.Id, tour.Id); } else { hyperLinkView.NavigateUrl = string.Format("TourConfig.aspx?NodeId={0}&SectionId={1}&TourId={2}", Node.Id, Section.Id, tour.Id); } } #endregion #region Start Label labelCityStart = e.Item.FindControl("labelCityStart") as Label; if (labelCityStart != null) { if (tour.CityStart != null) { labelCityStart.Text = tour.CityStart.Name; } else { if (tour.StartFrom != null) { labelCityStart.Text = tour.StartFrom.Name; } } } #endregion #region End Label labelCityEnd = e.Item.FindControl("labelCityEnd") as Label; if (labelCityEnd != null) { if (tour.CityEnd != null) { labelCityEnd.Text = tour.CityEnd.Name; } else { if (tour.EndIn != null) { labelCityEnd.Text = tour.EndIn.Name; } } } Label labelTourType = e.Item.FindControl("labelTourType") as Label; if (labelTourType != null) { if (tour.TourType != null) { labelTourType.Text = tour.TourType.Name; } } #endregion #region Days Label labelNumberOfDays = e.Item.FindControl("labelNumberOfDays") as Label; if (labelNumberOfDays != null) { if (tour.IsHalf) { labelNumberOfDays.Text = "½ day"; } else { if (tour.NumberOfDay > 1) { labelNumberOfDays.Text = tour.NumberOfDay + " days"; } else { labelNumberOfDays.Text = "1 day"; } } } #endregion #region HyperLink Edit HyperLink hplEdit = e.Item.FindControl("hplEdit") as HyperLink; Image imageEdit = e.Item.FindControl("imageEdit") as Image; if (hplEdit != null && imageEdit != null) { if (UserIdentity.CanModify(Section)) { hplEdit.NavigateUrl = string.Format("TourEdit.aspx?NodeId={0}&SectionId={1}&TourId={2}", Node.Id, Section.Id, tour.Id); } else { hplEdit.Visible = false; imageEdit.Visible = false; } } #endregion #region Button Delete ImageButton btnDelete = e.Item.FindControl("btnDelete") as ImageButton; if (btnDelete != null) { if (!UserIdentity.CanDelete(Section)) { btnDelete.Visible = false; } } #endregion } }
protected void Page_Load(object sender, EventArgs e) { try { #region -- Ajax uploader init -- if (!IsPostBack) { #region -- Ajax Map -- FileUploaderMap.addCustomJS(FileUploaderAJAX.customJSevent.postUpload, FileHelper.InsertImagePostUploadJS("divMap", txtHiddenMap)); FileUploaderMap.addCustomJS(FileUploaderAJAX.customJSevent.postDelete, FileHelper.ClearData("divMap", txtHiddenMap)); FileUploaderMap.addCustomJS(FileUploaderAJAX.customJSevent.postHide, FileHelper.ClearData("divMap", txtHiddenMap)); #endregion #region -- Ajax Image -- FileUploaderImage.addCustomJS(FileUploaderAJAX.customJSevent.postUpload, FileHelper.InsertImagePostUploadJS("divImage", txtHiddenImage)); FileUploaderImage.addCustomJS(FileUploaderAJAX.customJSevent.postDelete, FileHelper.ClearData("divImage", txtHiddenImage)); FileUploaderImage.addCustomJS(FileUploaderAJAX.customJSevent.postHide, FileHelper.ClearData("divImage", txtHiddenImage)); #endregion } #endregion #region -- File uploading -- if (FileUploaderImage.IsPosting) { FileHelper.ManageAjaxPost(FileUploaderImage, 0, "Image\\Tour\\", HttpPostedFileAJAX.fileType.image); return; } if (FileUploaderMap.IsPosting) { FileHelper.ManageAjaxPost(FileUploaderMap, 0, "Image\\Tour\\", HttpPostedFileAJAX.fileType.image); return; } #endregion Title = Resources.labelTourEdit; if (!IsPostBack) { BindTourTypes(); BindRegions(); BindProviders(); ddlPackageType.DataSource = Enum.GetNames(typeof(PackageStatus)); ddlPackageType.DataBind(); if (!string.IsNullOrEmpty(Request.QueryString["TourId"]) && Convert.ToInt32(Request.QueryString["TourId"]) > 0) { if (!UserIdentity.CanModify(Section)) { ShowError(Resources.textAccessDenied); panelContent.Visible = false; return; } _tour = Module.TourGetById(Convert.ToInt32(Request.QueryString["TourId"])); LoadTourInfo(); } else { if (!UserIdentity.CanInsert(Section)) { ShowError(Resources.textAccessDenied); panelContent.Visible = false; return; } } BindCountries(); BindCountriesEnd(); } } catch (Exception ex) { logger.Error("Page load error", ex); ShowError(ex.Message); } }