private void LoadTourInfo() { textBoxName.Text = _tour.Name; textBoxNumberOfDays.Text = _tour.NumberOfDay.ToString(); textBoxGrade.Text = _tour.Grade.ToString(); fckEditorActivities.Value = _tour.Activities; fckEditorDetailsIniterary.Value = _tour.DetailsIniterary; fckEditorExclusion.Value = _tour.Exclusion; fckEditorInclusion.Value = _tour.Inclusion; fckEditorNoteForOperator.Value = _tour.NoteForOperator; fckEditorNoteForSale.Value = _tour.NoteForSale; fckEditorSummary.Value = _tour.Summary; fckEditorTourInstruction.Value = _tour.TourInstruction; fckEditorTripHighLight.Value = _tour.TripHighLight; fckEditorWhatToTake.Value = _tour.WhatToTake; chkHalf.Checked = _tour.IsHalf; ddlTourType.SelectedValue = _tour.TourType.Id.ToString(); FileUploaderImage.addCustomJS(FileUploaderAJAX.customJSevent.preLoad, FileHelper.InsertImagePostloadJS("divImage", txtHiddenImage, _tour.Image)); FileUploaderMap.addCustomJS(FileUploaderAJAX.customJSevent.preLoad, FileHelper.InsertImagePostloadJS("divMap", txtHiddenMap, _tour.Map)); if (_tour.TourRegion != null) { ddlTourRegions.SelectedValue = _tour.TourRegion.Id.ToString(); } if (_tour.Provider != null) { ddlProviders.SelectedValue = _tour.Provider.Id.ToString(); } if (_tour.PackageStatus != null) { ddlPackageType.SelectedIndex = (int)_tour.PackageStatus; } }
protected void Page_Load(object sender, EventArgs e) { try { if (!UserIdentity.HasPermission(AccessLevel.Administrator)) { ShowError(Resources.textAccessDenied); panelContent.Visible = false; return; } Title = Resources.titleProviderEdit; if (Request.QueryString["ProviderID"] != null && Convert.ToInt32(Request.QueryString["ProviderID"]) > 0) { _provider = Module.ProviderGetByID(Convert.ToInt32(Request.QueryString["ProviderID"])); } _providerCategories = Module.Provider_CategoryGetByProvider(_provider); _hashtable = new Hashtable(_providerCategories.Count); foreach (Provider_Category item in _providerCategories) { _hashtable.Add(item.Category.Id, item.Id); } if (!IsPostBack) { BindCountry(); ddlTypes.DataSource = Enum.GetNames(typeof(ProviderType)); ddlTypes.DataBind(); LoadInfo(); #region -- Ajax Image -- FileUploaderImage.addCustomJS(FileUploaderAJAX.customJSevent.postUpload, FileHelper.InsertImagePostUploadJS("divImage", textBoxHiddenImage)); FileUploaderImage.addCustomJS(FileUploaderAJAX.customJSevent.postDelete, FileHelper.ClearData("divImage", textBoxHiddenImage)); FileUploaderImage.addCustomJS(FileUploaderAJAX.customJSevent.postHide, FileHelper.ClearData("divImage", textBoxHiddenImage)); #endregion #region -- Ajax Map -- FileUploaderMap.addCustomJS(FileUploaderAJAX.customJSevent.postUpload, FileHelper.InsertImagePostUploadJS("divMap", textBoxHiddenMap)); FileUploaderMap.addCustomJS(FileUploaderAJAX.customJSevent.postDelete, FileHelper.ClearData("divMap", textBoxHiddenMap)); FileUploaderMap.addCustomJS(FileUploaderAJAX.customJSevent.postHide, FileHelper.ClearData("divMap", textBoxHiddenMap)); #endregion } if (FileUploaderImage.IsPosting) { FileHelper.ManageAjaxPost(FileUploaderImage, 0, "Image\\TourManagement\\", HttpPostedFileAJAX.fileType.image); } if (FileUploaderMap.IsPosting) { FileHelper.ManageAjaxPost(FileUploaderMap, 0, "Image\\TourManagement\\", HttpPostedFileAJAX.fileType.image); } } catch (Exception ex) { logger.Error("Error when Page_Load in ProviderEdit", ex); throw; } }
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); } }
private void LoadInfo() { if (_provider != null && _provider.Id > 0) { _provider = Module.ProviderGetByID(Convert.ToInt32(Request.QueryString["ProviderID"])); Title = Resources.titleProviderEdit; textBoxName.Text = _provider.Name; textBoxAddress.Text = _provider.Address; textBoxWebsite.Text = _provider.Website; textBoxTel.Text = _provider.Tel; textBoxMobile.Text = _provider.Mobile; textBoxFax.Text = _provider.Fax; textBoxHiddenMap.Text = _provider.Map; textBoxHiddenImage.Text = _provider.Image; FCKDescription.Value = _provider.Description; ddlTypes.SelectedIndex = (int)_provider.ProviderType; rptCategory.DataSource = Module.ProviderCategoryGetAll(); rptCategory.DataBind(); FileUploaderImage.addCustomJS(FileUploaderAJAX.customJSevent.preLoad, FileHelper.InsertImagePostloadJS("divImage", textBoxHiddenImage, _provider.Image)); FileUploaderMap.addCustomJS(FileUploaderAJAX.customJSevent.preLoad, FileHelper.InsertImagePostloadJS("divMap", textBoxHiddenMap, _provider.Map)); #region - Load Location - Location temp, tmpCountry, tmpRegion, tmpCity; temp = _provider.Location; switch (_provider.Location.Level) { //Nếu Level là 3 thì LocationFrom chính là Country case 3: BindCountry(); ddlCountry.SelectedValue = temp.Id.ToString(); BindRegion(temp.Id); break; //Nếu Level là 4 thì LocationFrom chính là Region case 4: tmpCountry = temp.Parent; BindCountry(); ddlCountry.SelectedValue = tmpCountry.Id.ToString(); BindRegion(tmpCountry.Id); ddlRegion.SelectedValue = temp.Id.ToString(); BindCity(temp.Id); break; //Nếu Level là 5 thì LocationFrom chính là City case 5: tmpRegion = temp.Parent; tmpCountry = tmpRegion.Parent; BindCountry(); ddlCountry.SelectedValue = tmpCountry.Id.ToString(); BindRegion(tmpCountry.Id); ddlRegion.SelectedValue = tmpRegion.Id.ToString(); BindCity(tmpRegion.Id); ddlCity.SelectedValue = temp.Id.ToString(); BindLocation(temp.Id); break; //Nếu Level là 6 thì LocationFrom chính là District case 6: tmpCity = temp.Parent; tmpRegion = tmpCity.Parent; tmpCountry = tmpRegion.Parent; BindCountry(); ddlCountry.SelectedValue = tmpCountry.Id.ToString(); BindRegion(tmpCountry.Id); ddlRegion.SelectedValue = tmpRegion.Id.ToString(); BindCity(tmpRegion.Id); ddlCity.SelectedValue = tmpCity.Id.ToString(); BindLocation(tmpCity.Id); ddlLocation.SelectedValue = temp.Id.ToString(); break; //Hiện tại Không có trường hợp LocationFrom >6 vì khi tạo TransportRoute người dùng chỉ được chọn Location Cấp thấp nhất là 6 default: break; } #endregion } }