예제 #1
0
        /// <summary>
        /// Saves the specified save and continue.
        /// </summary>
        /// <param name="saveAndContinue">if set to <c>true</c> [save and continue].</param>
        protected void Save(bool saveAndContinue = false)
        {
            if (!Access.Write)
            {
                return;
            }

            var webSite = DataManager.WebSite.SelectById(SiteId, _webSiteId) ?? new tbl_WebSite();

            webSite.Title        = txtTitle.Text;
            webSite.Description  = txtDescription.Text;
            webSite.SiteDomainID = dcbSiteDomain.SelectedIdNullable;

            if (rauFavIcon.UploadedFiles.Count > 0)
            {
                var fsp = new FileSystemProvider();
                if (!string.IsNullOrEmpty(webSite.FavIcon))
                {
                    fsp.Delete(SiteId, "WebSites", webSite.FavIcon, FileType.Image);
                }

                webSite.FavIcon = fsp.Upload(SiteId, "WebSites", rauFavIcon.UploadedFiles[0].FileName, rauFavIcon.UploadedFiles[0].InputStream, FileType.Image);
            }

            if (webSite.ID == Guid.Empty)
            {
                webSite.SiteID = SiteId;
                DataManager.WebSite.Add(webSite);
            }
            else
            {
                DataManager.WebSite.Update(webSite);
            }

            DataManager.ExternalResource.Update(ucExternalResources.ExternalResourceList, webSite.ID);

            if (!saveAndContinue)
            {
                Response.Redirect(_webSiteId != Guid.Empty ? UrlsData.AP_WebSites() : UrlsData.AP_WebSiteEdit(webSite.ID));
            }
            else
            {
                Response.Redirect(UrlsData.AP_WebSiteEdit(webSite.ID));
            }
        }
예제 #2
0
        /// <summary>
        /// Handles the Load event of the Page control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
        protected void Page_Load(object sender, EventArgs e)
        {
            Access = Access.Check();
            if (!Access.Write)
            {
                lbtnSave.Visible = false;
            }

            Title = "Мини сайты - LeadForce";

            if (Page.RouteData.Values["id"] != null)
            {
                _webSiteId = Guid.Parse(Page.RouteData.Values["id"] as string);
            }

            if (_webSiteId == Guid.Empty)
            {
                rtsTabs.Tabs[1].Visible = false;
            }

            hlCancel.NavigateUrl = UrlsData.AP_WebSites();
            dcbSiteDomain.SiteID = SiteId;

            gridWebSitePage.Where.Add(new GridWhere()
            {
                Column = "WebSiteID", Value = _webSiteId.ToString()
            });
            RadAjaxManager = RadAjaxManager.GetCurrent(Page);
            RadAjaxManager.AjaxSettings.AddAjaxSetting(RadAjaxManager, gridWebSitePage);
            RadAjaxManager.AjaxRequest += RadAjaxManager_AjaxRequest;

            if (!Page.IsPostBack)
            {
                BindData();
            }
        }