private void BindData() { var rc = new RoleController(); var r = rc.GetRoleById(PortalId, GroupId); lblHeader.Text = r.RoleName; //Implement your edit logic for your module if (!Page.IsPostBack) { if (DocumentId > 0) { var dc = new DocumentsInfoRepository(); var d = dc.GetItem(DocumentId, ModuleId); if (d != null) { txtCohortStartDate.Text = d.CreatedOnDate.ToString("dd/MM/yyyy"); dplAction.SelectedValue = d.Action; FileUploadControl.Visible = false; hypDocumentFile.Visible = true; var documentFile = (FileInfo)FileManager.Instance.GetFile(d.FileId); var fileLink = new FileLinkClickController(); hypDocumentFile.NavigateUrl = fileLink.GetFileLinkClick(documentFile); hypDocumentFile.Text = documentFile.FileName; } } } LocalizeModule(); }
protected void btnSave_Click(object sender, EventArgs e) { PortalSecurity objSecurity = new PortalSecurity(); var d = new DocumentsInfo(); var dc = new DocumentsInfoRepository(); if (Page.IsValid == true) { if (DocumentId > 0) { d = dc.GetItem(DocumentId, ModuleId); if (d != null) { d.CohortStartDate = DateTime.Parse(txtCohortStartDate.Text.ToString()); //d.Action = rdbAction.SelectedValue.ToString(); d.Action = dplAction.SelectedValue.ToString(); FileInfo documentFile = (FileInfo)FileManager.Instance.GetFile(d.FileId); d.GroupId = GroupId; } } else { d = new DocumentsInfo() { CreatedByUserId = UserId, CreatedOnDate = DateTime.UtcNow, CohortStartDate = DateTime.Parse(txtCohortStartDate.Text.ToString()), //Action = rdbAction.SelectedValue.ToString(), Action = dplAction.SelectedValue.ToString(), FileId = UploadFile(GroupId), GroupId = GroupId, }; } d.LastModifiedOnDate = DateTime.Now; d.LastModifiedByUserId = UserId; d.ModuleId = ModuleId; if (d.DocumentId > 0) { dc.UpdateItem(d); } else { dc.CreateItem(d); } //Response.Redirect(DotNetNuke.Common.Globals.NavigateURL()); //Response.Redirect(Globals.NavigateURL(PortalSettings.ActiveTab.TabID, PortalSettings, string.Empty , "groupId=" + GroupId.ToString())); Response.Redirect(Globals.NavigateURL(37, PortalSettings, string.Empty, "groupId=" + GroupId.ToString())); } }
public void rptItemListOnItemCommand(object source, RepeaterCommandEventArgs e) { if (e.CommandName == "Edit") { Response.Redirect(EditUrl(string.Empty, string.Empty, "Edit", "did=" + e.CommandArgument, "groupId=" + GroupId.ToString())); } if (e.CommandName == "Delete") { var dc = new DocumentsInfoRepository(); dc.DeleteItem(Convert.ToInt32(e.CommandArgument), ModuleId); } if (e.CommandName == "Download") { var dc = new DocumentsInfoRepository(); var d = dc.GetItem(Convert.ToInt32(e.CommandArgument), ModuleId); var fc = new FileManager(); var f = fc.GetFile(d.FileId); Response.Redirect(fc.GetUrl(f)); } Response.Redirect(DotNetNuke.Common.Globals.NavigateURL()); }
public DocumentsInfo GetItem(int itemId, int moduleId) { var item = repo.GetItem(itemId, moduleId); return(item); }