예제 #1
0
        void PopulateSite(long siteId)
        {
            ResetControls();

            AWAPI_Data.Data.awSite site = _siteLib.Get(siteId);
            if (site == null)
            {
                return;
            }
            _siteId.Text                 = site.siteId.ToString();
            _alias.Text                  = site.alias;
            _title.Text                  = site.title;
            _description.Text            = site.description;
            _link.Text                   = site.link;
            _imageUrl.Text               = site.imageurl;
            _enabled.Checked             = site.isEnabled;
            _maxBlogs.Text               = site.maxBlogs.ToString();
            _maxUsers.Text               = site.maxUsers.ToString();
            _maxContent.Text             = site.maxContents.ToString();
            _grantedIPs.Text             = site.grantedDomains;
            _bannedIPs.Text              = site.bannedDomains;
            _accessKey.Text              = site.accessKey;
            _twitterUsername.Text        = site.twitterUsername;
            _twitterPassword.Text        = site.twitterPassword;
            _fileAmazonS3BucketName.Text = site.fileAmazonS3BucketName;

            if (site.cultureCode != null && _cultureCode.Items.FindByValue(site.cultureCode) != null)
            {
                _cultureCode.SelectedValue = site.cultureCode;
            }

            PopulateSiteEmailTemplates(siteId, site.userConfirmationEmailTemplateId, site.userResetPasswordEmailTemplateId);

            ShowHideControls(true);
        }
예제 #2
0
        void Save()
        {
            long siteId = 0;

            AWAPI_Data.Data.awSite site = new AWAPI_Data.Data.awSite();

            try
            {
                site.alias                  = _alias.Text;
                site.title                  = _title.Text;
                site.description            = _description.Text;
                site.isEnabled              = _enabled.Checked;
                site.link                   = _link.Text;
                site.imageurl               = _imageUrl.Text;
                site.maxBlogs               = Convert.ToInt32(_maxBlogs.Text);
                site.maxUsers               = Convert.ToInt32(_maxUsers.Text);
                site.maxContents            = Convert.ToInt32(_maxContent.Text);
                site.grantedDomains         = _grantedIPs.Text;
                site.bannedDomains          = _bannedIPs.Text;
                site.accessKey              = _accessKey.Text;
                site.twitterUsername        = _twitterUsername.Text;
                site.twitterPassword        = _twitterPassword.Text;
                site.fileAmazonS3BucketName = _fileAmazonS3BucketName.Text;
                if (_userConfirmationEmailTemplate.SelectedIndex > 0)
                {
                    site.userConfirmationEmailTemplateId = Convert.ToInt64(_userConfirmationEmailTemplate.SelectedValue);
                }
                if (_userResetPasswordEmailTemplate.SelectedIndex > 0)
                {
                    site.userResetPasswordEmailTemplateId = Convert.ToInt64(_userResetPasswordEmailTemplate.SelectedValue);
                }

                if (_cultureCode.SelectedValue != "")
                {
                    site.cultureCode = _cultureCode.SelectedValue;
                }

                site.userId = App_Code.SessionInfo.CurrentUser.userId;

                if (_siteId.Text.Trim().Length == 0)
                {
                    siteId = _siteLib.Add(site.userId.Value,
                                          site.alias, site.title, site.description, site.isEnabled, site.link,
                                          site.imageurl, site.maxBlogs, site.maxUsers, site.maxContents, site.cultureCode,
                                          site.grantedDomains, site.bannedDomains, site.accessKey,
                                          site.twitterUsername, site.twitterPassword, site.fileAmazonS3BucketName,
                                          site.userConfirmationEmailTemplateId, site.userResetPasswordEmailTemplateId,
                                          site.pubDate);
                    _siteId.Text = siteId.ToString();
                }
                else
                {
                    siteId = Convert.ToInt64(_siteId.Text);
                    _siteLib.Update(siteId, site.userId.Value,
                                    site.alias, site.title, site.description, site.isEnabled,
                                    site.link, site.imageurl,
                                    site.maxBlogs, site.maxUsers, site.maxContents, site.cultureCode,
                                    site.grantedDomains, site.bannedDomains, site.accessKey,
                                    site.twitterUsername, site.twitterPassword, site.fileAmazonS3BucketName,
                                    site.userConfirmationEmailTemplateId, site.userResetPasswordEmailTemplateId,
                                    site.pubDate);
                }

                ShowHideControls(true);

                PopulateSiteList();

                AdminMaster.WriteMessage(AWAPI.Admin.AdminMaster.MessageType.INFO, "Site has been saved.");
            }
            catch (Exception ex)
            {
                AdminMaster.WriteMessage(AWAPI.Admin.AdminMaster.MessageType.ERROR, ex.Message);
            }
        }