Exemple #1
0
        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);
            }
        }