/// <summary> /// Handles the OnNodeClick event of the rtvPublicationCategory control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="Telerik.Web.UI.RadTreeNodeEventArgs"/> instance containing the event data.</param> protected void rtvPublicationCategory_OnNodeClick(object sender, RadTreeNodeEventArgs e) { if (Guid.Parse(e.Node.Value) != Guid.Empty) { Response.Redirect(UrlsData.AP_KnowledgeBase(Guid.Parse(e.Node.Value))); } else { Response.Redirect(UrlsData.AP_KnowledgeBase()); } }
protected void BtnUpdate_Click(object sender, EventArgs e) { tbl_Publication publicationData = DataManager.Publication.SelectById(SiteId, _publicationID) ?? new tbl_Publication(); publicationData.Title = txtTitle.Text; publicationData.Code = txtCode.Text; publicationData.Date = rdpDate.SelectedDate; publicationData.AuthorID = (Guid)ucAuthor.SelectedValue; publicationData.PublicationStatusID = Guid.Parse(rcbPublicationStatus.SelectedValue); publicationData.PublicationCategoryID = sccPublicationCategory.SelectedCategoryId; publicationData.PublicationTypeID = Guid.Parse(rcbPublicationType.SelectedValue); publicationData.Noun = txtNoun.Text; publicationData.Text = ucHtmlEditor.Content; publicationData.SiteID = SiteId; publicationData.AccessRecord = int.Parse(ddlAccessRecord.SelectedValue); publicationData.AccessComment = int.Parse(ddlAccessComment.SelectedValue); if (publicationData.AccessRecord == (int)PublicationAccessRecord.Company) { publicationData.AccessCompanyID = ucCompany.SelectedValue; } else { publicationData.AccessCompanyID = null; } if (RadUpload1.UploadedFiles.Count > 0) { byte[] imageData = new byte[RadUpload1.UploadedFiles[0].InputStream.Length]; RadUpload1.UploadedFiles[0].InputStream.Read(imageData, 0, (int)RadUpload1.UploadedFiles[0].InputStream.Length); publicationData.Img = imageData; } var fsp = new FileSystemProvider(); if (!string.IsNullOrEmpty(publicationData.FileName)) { fsp.Delete(CurrentUser.Instance.SiteID, "KnowledgeBases", publicationData.FileName, FileType.Attachment); } string fileName = null; if (RadUpload2.UploadedFiles.Count > 0) { fileName = fsp.Upload(CurrentUser.Instance.SiteID, "KnowledgeBases", RadUpload2.UploadedFiles[0].FileName, RadUpload2.UploadedFiles[0].InputStream, FileType.Attachment); } publicationData.FileName = fileName; if (publicationData.ID == Guid.Empty) { DataManager.Publication.Add(publicationData); } else { DataManager.Publication.Update(publicationData); } RelatedPublication.Save(publicationData.ID); PublicationTerms.Save(publicationData.ID); PublicationComment.Save(publicationData.ID); PublicationMark.Save(publicationData.ID); tagsPublication.SaveTags(publicationData.ID); Response.Redirect(UrlsData.AP_KnowledgeBase()); }