void AddFile(long[] groupIds, string title, string description, bool isEnabled, System.Web.UI.WebControls.FileUpload fileUpload, string size) { if (fileUpload == null || !fileUpload.HasFile) { AdminMaster.WriteMessage(AWAPI.Admin.AdminMaster.MessageType.ERROR, "Select a file to upload."); } else if (title.Trim().Length == 0) { AdminMaster.WriteMessage(AWAPI.Admin.AdminMaster.MessageType.ERROR, "File title is required."); } else { //byte[] bytes = new byte[fileUpload.PostedFile.InputStream.Length]; //fileUpload.PostedFile.InputStream.Read(bytes, 0, (int)fileUpload.PostedFile.InputStream.Length); //string content = Convert.ToBase64String(bytes); long id = _fileLib.Upload(App_Code.SessionInfo.CurrentSite.siteId, groupIds, App_Code.SessionInfo.CurrentUser.userId, title, description, fileUpload.PostedFile.FileName, fileUpload.PostedFile.InputStream, isEnabled, size); _fileId.Text = id.ToString(); ShowHideControl(btnDeleteFile_, true); ShowHideControl(lblDeleteFile_, true); PopulateFileList(); AdminMaster.WriteMessage(AWAPI.Admin.AdminMaster.MessageType.INFO, "File has been saved."); } }
void Save() { AWAPI_Data.CustomEntities.UserExtended usr = _userLib.Get(App_Code.SessionInfo.CurrentUser.userId); usr.username = _userName.Text; usr.firstName = _firstName.Text; usr.lastName = _lastName.Text; usr.email = _email.Text; usr.imageurl = _imageUrl.Text; usr.link = ""; usr.password = _password.Text.Trim(); usr.description = _description.Text; usr.gender = _gender.SelectedValue; usr.birthday = AWAPI_Common.library.MiscLibrary.ConvertStringToDate(_birthday.Text); usr.tel = _tel.Text; usr.tel2 = _tel2.Text; usr.address = _address.Text; usr.city = _city.Text; usr.state = _province.Text; usr.postalcode = _postalCode.Text; usr.country = _country.Text; _userLib.Update(usr.userId, usr.username, usr.firstName, usr.lastName, usr.email, usr.password, usr.description, usr.isEnabled, usr.isSuperAdmin, usr.link, usr.imageurl, usr.gender, usr.birthday, usr.tel, usr.tel2, usr.address, usr.city, usr.state, usr.postalcode, usr.country); _image.ImageUrl = AWAPI_BusinessLibrary.library.FileLibrary.GetUrl(usr.imageurl, "150x150"); // user.imageurl + "&size=150x150"; App_Code.SessionInfo.CurrentUser = _userLib.Get(usr.userId); AdminMaster.WriteMessage(AWAPI.Admin.AdminMaster.MessageType.INFO, "Profile has been updated."); }
void DeleteFile(long fileId) { _fileLib.Delete(fileId); ResetControls(); PopulateFileList(); AdminMaster.WriteMessage(AWAPI.Admin.AdminMaster.MessageType.INFO, "File has been deleted."); }
void Save() { long pollId = 0; AWAPI_Data.Data.awPoll poll = new AWAPI_Data.Data.awPoll(); try { poll.title = _title.Text; poll.description = _description.Text; poll.answeredQuestion = _answeredQuestion.Text; poll.isEnabled = _isEnabled.Checked; poll.isPublic = true; //_isPublic.Checked; poll.isMultipleChoice = _isMultipleChoice.Checked; poll.pubDate = AWAPI_Common.library.MiscLibrary.ConvertStringToDate(_publishStartDate.Text); //poll.pubEndDate = AWAPI_Common.library.MiscLibrary.ConvertStringToDate(_publishEndDate.Text, true); poll.siteId = App_Code.SessionInfo.CurrentSite.siteId; poll.userId = App_Code.SessionInfo.CurrentUser.userId; if (_id.Text.Trim() != "" && //if content is selected !String.IsNullOrEmpty(_culture.SelectedValue) && !String.IsNullOrEmpty(App_Code.SessionInfo.CurrentSite.cultureCode) && App_Code.SessionInfo.CurrentSite.cultureCode != _culture.SelectedValue) { _pollLibrary.UpdatePollForCulture(Convert.ToInt64(_id.Text), _culture.SelectedValue, poll.description, poll.answeredQuestion); } else { if (_id.Text.Trim().Length == 0) { pollId = _pollLibrary.AddPoll(poll.siteId, poll.userId, poll.title, poll.description, poll.answeredQuestion, poll.isEnabled, poll.isPublic, poll.isMultipleChoice, poll.pubDate, poll.pubEndDate); _id.Text = pollId.ToString(); } else { pollId = Convert.ToInt64(_id.Text); _pollLibrary.UpdatePoll(pollId, poll.title, poll.description, poll.answeredQuestion, poll.isEnabled, poll.isPublic, poll.isMultipleChoice, poll.pubDate, poll.pubEndDate); } } ShowHideControls(true); PopulateList(); AdminMaster.WriteMessage(AWAPI.Admin.AdminMaster.MessageType.INFO, "Poll has been saved."); } catch (Exception ex) { AdminMaster.WriteMessage(AWAPI.Admin.AdminMaster.MessageType.ERROR, ex.Message); } }
protected void btnNewContent_Click(object sender, EventArgs e) { if (CurrentBlogId <= 0) { AdminMaster.WriteMessage(AWAPI.Admin.AdminMaster.MessageType.ERROR, "Please select a blog before adding new post."); return; } Response.Redirect("blogpostdetail.aspx?blogid=" + CurrentBlogId); }
void DeleteChoice() { Int64 pollId = Convert.ToInt64(_choiceId.Text); _pollLibrary.DeletePollChoice(pollId); ResetChoiceControls(); PopulateChoiceList(); AdminMaster.WriteMessage(AWAPI.Admin.AdminMaster.MessageType.INFO, "Poll choice has been deleted."); }
protected void btnSave_Click(object sender, ImageClickEventArgs e) { try { Save(); } catch (Exception ex) { AdminMaster.WriteMessage(AWAPI.Admin.AdminMaster.MessageType.ERROR, ex.Message); } }
protected void btnDeleteConfiguration__Click(object sender, ImageClickEventArgs e) { long configurationId = Convert.ToInt64(_configurationId.Text); if (AWAPI_BusinessLibrary.library.ConfigurationLibrary.CurrentConfigurationId == configurationId) { AdminMaster.WriteMessage(AWAPI.Admin.AdminMaster.MessageType.INFO, "The configuration you want to delete has been set for the admin panel.<br/>Please update the web.config to delete the configuration."); } else { _configLib.Delete(configurationId); ResetControls(); } }
void Save() { long blogId = 0; awBlog blog = new awBlog(); blog.alias = _alias.Text.ToLower(); blog.title = _blogTitle.Text; blog.description = _blogDescription.Value; blog.siteId = App_Code.SessionInfo.CurrentSite.siteId; blog.userId = App_Code.SessionInfo.CurrentUser.userId; blog.imageurl = _blogImageUrl.Text; blog.isEnabled = _blogIsEnabled.Checked; blog.blogPostPage = _blogPostPage.Text; blog.enableCommentEmailNotifier = _enableCommentEmailNotifier.Checked; blog.commentEmailTo = _commentEmailTo.Text; if (_emailTemplate.SelectedIndex > 0) { blog.commentEmailTemplateId = Convert.ToInt64(_emailTemplate.SelectedValue); } else { blog.commentEmailTemplateId = null; } if (_blogId.Text.Trim().Length == 0) { blogId = _blogLib.AddBlog(blog.siteId, blog.userId, blog.alias, blog.title, blog.description, blog.imageurl, blog.isEnabled, blog.enableCommentEmailNotifier, blog.commentEmailTo, blog.commentEmailTemplateId, blog.blogPostPage); _blogId.Text = blogId.ToString(); } else { blogId = Convert.ToInt64(_blogId.Text); _blogLib.UpdateBlog(blogId, blog.alias, blog.title, blog.description, blog.isEnabled, blog.imageurl, blog.enableCommentEmailNotifier, blog.commentEmailTo, blog.commentEmailTemplateId, blog.blogPostPage); } _blogImage.ImageUrl = blog.imageurl + "&size=150x150"; ShowHideContentButtons(true); PopulateBlogs(); AdminMaster.WriteMessage(AWAPI.Admin.AdminMaster.MessageType.INFO, "Blog has been saved."); }
void Save() { long configurationId = _configurationId.Text == "" ? 0 : Convert.ToInt64(_configurationId.Text); AWAPI_Data.Data.awConfiguration config = new AWAPI_Data.Data.awConfiguration(); try { config.alias = _alias.Text; config.title = _title.Text; config.description = _description.Text; config.fileServiceUrl = _fileServiceUrl.Text; config.contentServiceUrl = _contentServiceUrl.Text; config.blogServiceUrl = _blogServiceUrl.Text; config.pollServiceUrl = _pollServiceUrl.Text; config.automatedTaskServiceUrl = _automatedTaskServiceUrl.Text; config.twitterServiceUrl = _twitterServiceUrl.Text; config.weatherServiceUrl = _weatherServiceUrl.Text; config.adminBaseUrl = _adminBaseUrl.Text; config.fileDirectory = _fileDirectory.Text; config.fileMimeXMLPath = _fileMimeXMLPath.Text; config.fileSaveOnAmazonS3 = _fileSaveOnAmazonS3.Checked; config.fileAmazonS3AccessKey = _fileAmazonS3AccessKey.Text; config.fileAmazonS3BucketName = _fileAmazonS3BucketName.Text; config.fileAmazonS3SecreyKey = _fileAmazonS3SecreyKey.Text; config.smtpServer = _smtpServer.Text; configurationId = _configLib.Save(configurationId, config.alias, config.title, config.description, config.fileServiceUrl, config.contentServiceUrl, config.blogServiceUrl, config.pollServiceUrl, config.automatedTaskServiceUrl, config.twitterServiceUrl, config.weatherServiceUrl, config.adminBaseUrl, config.fileDirectory, config.fileMimeXMLPath, config.fileSaveOnAmazonS3, config.fileAmazonS3BucketName, config.fileAmazonS3AccessKey, config.fileAmazonS3SecreyKey, config.smtpServer); _configurationId.Text = configurationId.ToString(); ShowHideControls(true); PopulateList(); AdminMaster.WriteMessage(AWAPI.Admin.AdminMaster.MessageType.INFO, "Configiration has been saved."); } catch (Exception ex) { AdminMaster.WriteMessage(AWAPI.Admin.AdminMaster.MessageType.ERROR, ex.Message); } }
void SaveChoice() { Int64 pollId = Convert.ToInt64(_id.Text); Int64 id = 0; AWAPI_Data.Data.awPollChoice pc = new AWAPI_Data.Data.awPollChoice(); if (_choiceTitle.Text.Trim() == "") { AdminMaster.WriteMessage(AWAPI.Admin.AdminMaster.MessageType.ERROR, "Choice title is required."); return; } try { pc.title = _choiceTitle.Text; pc.description = _choiceDescription.Text; pc.sortOrder = Convert.ToInt32(_choiceSortOrder.Text); if (_choiceId.Text.Trim() != "" && !String.IsNullOrEmpty(_culture.SelectedValue) && !String.IsNullOrEmpty(App_Code.SessionInfo.CurrentSite.cultureCode) && App_Code.SessionInfo.CurrentSite.cultureCode != _culture.SelectedValue) { _pollLibrary.UpdatePollChoiceForCulture(Convert.ToInt64(_choiceId.Text), _culture.SelectedValue, pc.title, pc.description); } else { if (_choiceId.Text.Trim() == "") { id = _pollLibrary.AddPollChoice(pollId, pc.title, pc.description, pc.sortOrder); } else { id = Convert.ToInt64(_choiceId.Text); _pollLibrary.UpdatePollChoice(id, pc.title, pc.description, pc.sortOrder); } _choiceId.Text = id.ToString(); } ShowHideChoiceControls(true); PopulateChoiceList(); AdminMaster.WriteMessage(AWAPI.Admin.AdminMaster.MessageType.INFO, "Poll choice has been saved."); } catch (Exception ex) { AdminMaster.WriteMessage(AWAPI.Admin.AdminMaster.MessageType.ERROR, ex.Message); } }
protected void btnDeleteUser_Click(object sender, ImageClickEventArgs e) { try { _userLib.Delete(Convert.ToInt64(_userId.Text), App_Code.SessionInfo.CurrentUser.userId); PopulateUsers(); ResetControls(); AdminMaster.WriteMessage(AWAPI.Admin.AdminMaster.MessageType.INFO, "User has been deleted successfully."); } catch (Exception ex) { AdminMaster.WriteMessage(AWAPI.Admin.AdminMaster.MessageType.ERROR, ex.Message); } }
void UpdateFile(long[] groupIds, long fileId, string title, string description, bool isEnabled, System.Web.UI.WebControls.FileUpload fileUpload, string size) { if (title.Trim().Length == 0) { AdminMaster.WriteMessage(AWAPI.Admin.AdminMaster.MessageType.ERROR, "File title is required."); } else { if (fileUpload.HasFile) { _fileLib.Update(Convert.ToInt64(_fileId.Text), groupIds, title, description, fileUpload.PostedFile.FileName, fileUpload.PostedFile.InputStream, isEnabled, size); } else { _fileLib.Update(Convert.ToInt64(_fileId.Text), groupIds, title, description, fileUpload.PostedFile.FileName, null, isEnabled, ""); } PopulateFileList(); AdminMaster.WriteMessage(AWAPI.Admin.AdminMaster.MessageType.INFO, "File has been saved."); } }
void ShowHideForSuperAdmin() { bool show = true; //If current isn't super admin, and the user is super admin //then the current user cannot save/delete/update the superadmin if (!App_Code.SessionInfo.CurrentUser.isSuperAdmin && _isSuperAdmin.Checked) { show = false; AdminMaster.WriteMessage(AWAPI.Admin.AdminMaster.MessageType.WARNING, "You cannot update SuperAdmin."); } ShowHideControl(btnSaveUser_, show); ShowHideControl(lblSaveUser_, show); if (!String.IsNullOrEmpty(_userId.Text)) { ShowHideControl(btnDeleteUser_, show); ShowHideControl(lblDeleteUser_, show); ShowHideControl(hplPopupAssignRole_, show); ShowHideControl(lblPopupAssignRole_, show); } }
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); } }
void Save() { System.Collections.ArrayList groupIds = new System.Collections.ArrayList(); long contestId = 0; AWAPI_Data.Data.awContest contest = new AWAPI_Data.Data.awContest(); try { contest.title = _title.Text; contest.description = _description.Text; contest.isEnabled = _isEnabled.Checked; contest.maxEntry = Convert.ToInt32(_maxEntry.Text); contest.entryPerUser = Convert.ToInt32(_entryPerUser.Text); contest.entryPerUserPeriodType = _entryPerUserPeriodType.SelectedValue; contest.entryPerUserPeriodValue = Convert.ToInt32(_entryPerUserPeriodValue.Text); contest.numberOfWinners = Convert.ToInt32(_numberOfWinners.Text); contest.pubDate = AWAPI_Common.library.MiscLibrary.ConvertStringToDate(_publishStartDate.Text); contest.pubEndDate = AWAPI_Common.library.MiscLibrary.ConvertStringToDate(_publishEndDate.Text, true); contest.sendEmailToModeratorRecipes = _sendEmailToModeratorRecipes.Text; if (_sendEmailToModeratorTemplate.SelectedIndex > 0) { contest.sendEmailToModeratorTemplateId = Convert.ToInt64(_sendEmailToModeratorTemplate.SelectedValue.ToString()); } if (_sendEmailAfterSubmissionTemplate.SelectedIndex > 0) { contest.sendEmailAfterSubmissionTemplateId = Convert.ToInt64(_sendEmailAfterSubmissionTemplate.SelectedValue.ToString()); } if (_sendEmailAfterApproveEntryEmailTemplate.SelectedIndex > 0) { contest.sendEmailAfterApproveEntryTemplateId = Convert.ToInt64(_sendEmailAfterApproveEntryEmailTemplate.SelectedValue.ToString()); } if (_sendEmailAfterDeleteEntryEmailTemplate.SelectedIndex > 0) { contest.sendEmailAfterDeleteEntryTemplateId = Convert.ToInt64(_sendEmailAfterDeleteEntryEmailTemplate.SelectedValue.ToString()); } contest.siteId = App_Code.SessionInfo.CurrentSite.siteId; contest.userId = App_Code.SessionInfo.CurrentUser.userId; if (_id.Text.Trim().Length == 0) { contestId = _contestLibrary.AddContest(contest.siteId, contest.userId.Value, contest.title, contest.description, contest.isEnabled, contest.maxEntry, contest.entryPerUser, contest.entryPerUserPeriodValue, contest.entryPerUserPeriodType, contest.numberOfWinners, contest.pubDate, contest.pubEndDate, contest.sendEmailToModeratorRecipes, contest.sendEmailToModeratorTemplateId, contest.sendEmailAfterSubmissionTemplateId, contest.sendEmailAfterApproveEntryTemplateId, contest.sendEmailAfterDeleteEntryTemplateId); _id.Text = contestId.ToString(); } else { contestId = Convert.ToInt64(_id.Text); _contestLibrary.UpdateContest(contestId, contest.title, contest.description, contest.isEnabled, contest.maxEntry, contest.entryPerUser, contest.entryPerUserPeriodValue, contest.entryPerUserPeriodType, contest.numberOfWinners, contest.pubDate, contest.pubEndDate, contest.sendEmailToModeratorRecipes, contest.sendEmailToModeratorTemplateId, contest.sendEmailAfterSubmissionTemplateId, contest.sendEmailAfterApproveEntryTemplateId, contest.sendEmailAfterDeleteEntryTemplateId); } //add contest to group foreach (ListItem li in _contestGroupList.Items) { if (li.Selected) { groupIds.Add(Convert.ToInt64(li.Value)); } } if (groupIds.Count > 0) { _contestLibrary.AddContestToGroups((long[])groupIds.ToArray(typeof(long)), contestId); } ShowHideControls(true); PopulateList(); AdminMaster.WriteMessage(AWAPI.Admin.AdminMaster.MessageType.INFO, "Contest has been saved."); } catch (Exception ex) { AdminMaster.WriteMessage(AWAPI.Admin.AdminMaster.MessageType.ERROR, ex.Message); } }
protected void btnDelete_Click(object sender, ImageClickEventArgs e) { DeleteBlog(Convert.ToInt64(_blogId.Text)); AdminMaster.WriteMessage(AWAPI.Admin.AdminMaster.MessageType.INFO, "Blog has been deleted."); }
protected void btnSaveContent_Click(object sender, ImageClickEventArgs e) { long contentId = _contentId.Text.Trim().Length == 0 ? 0 : Convert.ToInt64(_contentId.Text); bool newContent = false; awContent content = new awContent(); content.alias = _alias.Text; content.title = _title.Text; content.description = _description.Value; content.link = ""; content.imageurl = _contentImageUrl.Text; content.userId = App_Code.SessionInfo.CurrentUser.userId; content.contentType = AWAPI_Common.values.TypeValues.ContentTypes.content.ToString(); content.parentContentId = Convert.ToInt64(_contentParentList.SelectedValue); if (contentId != 0 && //if content is selected !String.IsNullOrEmpty(_culture.SelectedValue) && !String.IsNullOrEmpty(App_Code.SessionInfo.CurrentSite.cultureCode) && App_Code.SessionInfo.CurrentSite.cultureCode != _culture.SelectedValue) { _contentLib.SaveContentLanguage(Convert.ToInt64(_contentId.Text), _culture.SelectedValue.ToLower(), content.title, content.description, content.link, content.imageurl, content.userId); } else { content.eventStartDate = AWAPI_Common.library.MiscLibrary.ConvertStringToDate(_contentEventStartDate.Text); content.eventEndDate = AWAPI_Common.library.MiscLibrary.ConvertStringToDate(_contentEventEndDate.Text, true); content.pubDate = AWAPI_Common.library.MiscLibrary.ConvertStringToDate(_contentPublishStartDate.Text); content.pubEndDate = AWAPI_Common.library.MiscLibrary.ConvertStringToDate(_contentPublishEndDate.Text, true); content.siteId = App_Code.SessionInfo.CurrentSite.siteId; if (_contentSortOrder.Text.Trim() != "") { content.sortOrder = Convert.ToInt32(_contentSortOrder.Text); } content.isEnabled = cbStatusContent_.Checked; content.isCommentable = _contentIsCommentable.Checked; if (contentId == 0) { newContent = true; contentId = _contentLib.Add(content.alias, content.title, content.description, content.contentType, content.siteId, content.userId, content.parentContentId, content.eventStartDate, content.eventEndDate, content.link, content.imageurl, content.sortOrder, content.isEnabled, content.isCommentable, content.pubDate, content.pubEndDate); _contentId.Text = contentId.ToString(); } else { contentId = Convert.ToInt64(_contentId.Text); _contentLib.Update(contentId, content.alias, content.title, content.description, content.contentType, content.userId, content.parentContentId, content.eventStartDate, content.eventEndDate, content.link, content.imageurl, content.sortOrder, content.isEnabled, content.isCommentable, content.pubDate, content.pubEndDate); } } SaveContentsTags(contentId); SaveCustomFields(contentId); SetImage(content.imageurl); ShowHideContentButtons(true, content.contentType); PopulateContentList(); PopulateContentParentList(content.contentId); PopulateContentsTags(contentId); if (newContent) { PopulateCustomFields(contentId, content.parentContentId); } _contentParentList.SelectedValue = content.parentContentId.ToString(); AdminMaster.WriteMessage(AWAPI.Admin.AdminMaster.MessageType.INFO, "Content has been saved."); HighlightContentNode("saved", new TreeNode(content.alias, content.contentId.ToString()), twContent.Nodes); }
protected void Save() { long blogPostId = 0; if (_blogId <= 0) { AdminMaster.WriteMessage(AWAPI.Admin.AdminMaster.MessageType.ERROR, "Blog hasn't been selected. Please click on 'blog posts' to select a blog before creating a blog post."); return; } awBlogPost blogPost = new awBlogPost(); blogPost.userId = App_Code.SessionInfo.CurrentUser.userId; if (_authorList.SelectedIndex == 0) { blogPost.authorUserId = blogPost.userId; } else { blogPost.authorUserId = Convert.ToInt64(_authorList.SelectedValue); } blogPost.title = _title.Text; blogPost.description = _description.Value; blogPost.summary = _summary.Text; blogPost.geoTag = ""; blogPost.pubDate = AWAPI_Common.library.MiscLibrary.ConvertStringToDate(_pubDate.Text); blogPost.pubEndDate = AWAPI_Common.library.MiscLibrary.ConvertStringToDate(_pubEndDate.Text, true); blogPost.blogId = _blogId; blogPost.imageurl = _imageUrl.Text; blogPost.isPublished = _isPublished.Checked; blogPost.isCommentable = _isCommentable.Checked; if (_id.Text.Trim().Length == 0) { blogPostId = _blogLib.AddBlogPost(blogPost.blogId, blogPost.userId, blogPost.authorUserId, blogPost.title, blogPost.description, blogPost.summary, blogPost.imageurl, blogPost.geoTag, blogPost.isPublished, blogPost.isCommentable, blogPost.pubDate, blogPost.pubEndDate); _id.Text = blogPostId.ToString(); } else { blogPostId = Convert.ToInt64(_id.Text); _blogLib.UpdateBlogPost(blogPostId, blogPost.userId, blogPost.authorUserId, blogPost.title, blogPost.description, blogPost.summary, blogPost.imageurl, blogPost.geoTag, blogPost.isPublished, blogPost.isCommentable, blogPost.pubDate, blogPost.pubEndDate); } SetImage(blogPost.imageurl); //Save tags and the tags SaveCategories(blogPostId); SaveTags(blogPostId); //Repopulate tags PopulateTags(); //Check Tags and the Categories SelectCategories(blogPostId); SelectTags(blogPostId); ShowHideContentButtons(true); AdminMaster.WriteMessage(AWAPI.Admin.AdminMaster.MessageType.INFO, "Blog post has been saved."); }
protected void btnDelete_Click(object sender, ImageClickEventArgs e) { DeleteBlogPost(Convert.ToInt64(_id.Text)); PopulateBlogPostList(); AdminMaster.WriteMessage(AWAPI.Admin.AdminMaster.MessageType.INFO, "Blog post has been deleted."); }
void Save() { AWAPI_Data.CustomEntities.UserExtended usr = new AWAPI_Data.CustomEntities.UserExtended(); long userId = 0; if (_userId.Text.Trim().Length > 0) { userId = Convert.ToInt64(_userId.Text); } //if this is a new tag, then password must be entered. if (userId == 0 && _password.Text.Trim() == "") { AdminMaster.WriteMessage(AWAPI.Admin.AdminMaster.MessageType.ERROR, "Password is required in order to create a tag."); return; } //at least one poll must be checked bool siteAdded = false; foreach (ListItem li in _siteList.Items) { if (li.Selected) { siteAdded = true; break; } } if (!siteAdded) { AdminMaster.WriteMessage(AWAPI.Admin.AdminMaster.MessageType.ERROR, "At least one site must be selected."); return; } usr.username = _userName.Text; usr.firstName = _firstName.Text; usr.lastName = _lastName.Text; usr.email = _email.Text; usr.imageurl = _imageUrl.Text; usr.link = ""; usr.password = _password.Text; usr.description = _description.Text; usr.isEnabled = _enabled.Checked; usr.isSuperAdmin = _isSuperAdmin.Checked; usr.gender = _gender.SelectedValue; usr.birthday = AWAPI_Common.library.MiscLibrary.ConvertStringToDate(_birthday.Text); usr.tel2 = _tel.Text; usr.tel2 = _tel2.Text; usr.address = _address.Text; usr.city = _city.Text; usr.state = _province.Text; usr.postalcode = _postalCode.Text; usr.country = _country.Text; if (userId == 0) { userId = _userLib.Add(usr.username, usr.firstName, usr.lastName, usr.email, usr.password, usr.description, usr.isEnabled, usr.isSuperAdmin, usr.link, usr.imageurl, usr.gender, usr.birthday, usr.tel, usr.tel2, usr.address, usr.city, usr.state, usr.postalcode, usr.country); _userId.Text = userId.ToString(); } else { _userLib.Update(userId, usr.username, usr.firstName, usr.lastName, usr.email, usr.password, usr.description, usr.isEnabled, usr.isSuperAdmin, usr.link, usr.imageurl, usr.gender, usr.birthday, usr.tel, usr.tel2, usr.address, usr.city, usr.state, usr.postalcode, usr.country); } //add tag to the poll foreach (ListItem li in _siteList.Items) { long siteId = Convert.ToInt64(li.Value); //delete if if (!li.Selected) { _userLib.DeleteUserFromSite(siteId, userId); } else { AWAPI_Data.Data.awSiteUser su = _userLib.GetUserFromSite(siteId, userId); if (su == null) { _userLib.AddUserToSite(siteId, userId, true); } } } _image.ImageUrl = AWAPI_BusinessLibrary.library.FileLibrary.GetUrl(usr.imageurl, "150x150"); ShowHideControls(true); PopulateUsers(); AdminMaster.WriteMessage(AWAPI.Admin.AdminMaster.MessageType.INFO, "User has been saved."); }