Rank: Member Groups: Member
Joined: 3/8/2011 Posts: 19
|
I have a form where there is a splitter -> Grid -> on row click a context menu opens which has multiple options. every option opens a dialog. In development environment this dialog is working fine. But when I publish it on server the dialog opens but the controls like textbox, button are inactive. there is some issue which i can not trace. Please check the issue. it is very urgent. following is the code
Code: HTML/ASPX
<%@ Page Title="" Language="vb" AutoEventWireup="false" MasterPageFile="~/Main.Master" CodeBehind="DocLibrary.aspx.vb" Inherits="NMDC_EDMS.DocLibrary" %>
<%@ Register Assembly="EO.Web" Namespace="EO.Web" TagPrefix="eo" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
<div class="post">
<h2>Document Library</h2>
<p class="meta"><asp:Label ID="lblProjectName" runat="server"></asp:Label></p>
</div>
<div class="entry">
<eo:Splitter runat="server" Width="780px" Height="650px" id="Splitter1" BorderStyle="Solid" DividerSize="6"
BorderWidth="1px" BorderColor="#3B619C" ControlSkinID="None" DividerImage="00080201" >
<eo:SplitterPane id="SplitterPane1" Width="150px" runat="server" ScrollBars="Auto" >
<div style="PADDING-RIGHT: 5px; PADDING-LEFT: 5px; PADDING-BOTTOM: 5px; PADDING-TOP: 5px">
<eo:TreeView id="ExplorerTree" style="PADDING-RIGHT: 5px; PADDING-LEFT: 5px; PADDING-BOTTOM: 5px; PADDING-TOP: 5px;"
runat="server" Height="577px" ControlSkinID="None" AutoScroll="false" OnItemClick="FolderExplorerTree_Click" RaisesServerEvent="true" >
<LookNodes>
<eo:TreeNode ImageUrl="00030301" DisabledStyle-CssText="background-color:transparent;border-bottom-style:none;border-left-style:none;border-right-style:none;border-top-style:none;color:Gray;padding-bottom:1px;padding-left:1px;padding-right:1px;padding-top:1px;"
CollapsedImageUrl="00030301" ItemID="_Default" NormalStyle-CssText="PADDING-RIGHT: 1px; PADDING-LEFT: 1px; PADDING-BOTTOM: 1px; COLOR: black; BORDER-TOP-STYLE: none; PADDING-TOP: 1px; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none; BACKGROUND-COLOR: transparent; BORDER-BOTTOM-STYLE: none"
ExpandedImageUrl="00030302" SelectedStyle-CssText="background-color:#316ac5;border-bottom-color:#999999;border-bottom-style:solid;border-bottom-width:1px;border-left-color:#999999;border-left-style:solid;border-left-width:1px;border-right-color:#999999;border-right-style:solid;border-right-width:1px;border-top-color:#999999;border-top-style:solid;border-top-width:1px;color:White;padding-bottom:0px;padding-left:0px;padding-right:0px;padding-top:0px;"></eo:TreeNode>
</LookNodes>
<TopGroup Style-CssText="border-bottom-color:#999999;border-bottom-style:none;border-bottom-width:1px;border-left-color:#999999;border-left-style:none;border-left-width:1px;border-right-color:#999999;border-right-style:none;border-right-width:1px;border-top-color:#999999;border-top-style:none;border-top-width:1px;color:black;cursor:hand;font-family:Tahoma;font-size:8pt;padding-bottom:2px;padding-left:2px;padding-right:2px;padding-top:2px;"></TopGroup>
</eo:TreeView>
</div>
</eo:SplitterPane>
<eo:SplitterPane id="SplitterPane2" runat="server" ScrollBars="Auto">
<div style="PADDING-RIGHT: 5px; PADDING-LEFT: 5px; PADDING-BOTTOM: 5px; PADDING-TOP: 0px">
<script type="text/javascript">
var g_itemIndex = -1;
var g_cellIndex = -1;
function ShowGridContextMenu(e, grid, item, cell)
{
//Save the target cell index
g_itemIndex = item.getIndex();
g_cellIndex = cell.getColIndex();
//Show the context menu
var menu = eo_GetObject("<%=mnuContextGrid.ClientID%>");
eo_ShowContextMenu(e, "<%=mnuContextGrid.ClientID%>");
//Return true to indicate that we have
//displayed a context menu
return true;
}
function OnItemCommand(grid, itemIndex, colIndex, commandName) {
var item = grid.getItem(itemIndex);
var cell = item.getCell(0);
// window.alert("Topic:" + cell.getValue());
window.open('/DocumentFileShare/ShowFile.aspx?DocId=' + cell.getValue().toString()
,'mywindow', 'location=0,status=1,scrollbars=2,width=300,height=300,resizable=yes');
}
</script>
<eo:CallbackPanel id="CallbackPanel1" runat="server" Height="230px" Width="100%" Triggers="{ControlID:Grid1;Parameter:},{ControlID:ExplorerTree;Parameter:}"
LoadingHTML="Loading..." GroupName="DocGrid">
<eo:Grid id="Grid1" Height="530px" Width="100%" runat="server" RunningMode="Server" ClientSideOnItemCommand="OnItemCommand"
FixedColumnCount="0" BorderColor="#7F9DB9" BorderWidth="1px" ColumnHeaderDescImage="00050105"
ColumnHeaderAscImage="00050104" GoToBoxVisible="True" GridLineColor="220, 223, 228" GridLines="Both"
ColumnHeaderDividerImage="00050103" Font-Size="8pt" Font-Names="Tahoma" ScrollBars="None" ForeColor="Black" ClientSideOnContextMenu="ShowGridContextMenu"
>
<FooterStyle CssText="padding-bottom:4px;padding-left:4px;padding-right:4px;padding-top:4px;"></FooterStyle>
<ItemStyles>
<eo:GridItemStyleSet>
<ItemHoverStyle CssText="background-color: whitesmoke"></ItemHoverStyle>
<SelectedStyle CssText="background-color:#FFF68F;"></SelectedStyle>
<CellStyle CssText="padding-left:8px;padding-top:2px;"></CellStyle>
<ItemStyle CssText="background-color: white"></ItemStyle>
<FixedColumnCellStyle CssText="border-right: #d6d2c2 1px solid; padding-right: 10px; border-top: #faf9f4 1px solid; border-left: #faf9f4 1px solid; border-bottom: #d6d2c2 1px solid; background-color: #ebeadb; text-align: right"></FixedColumnCellStyle>
</eo:GridItemStyleSet>
</ItemStyles>
<GoToBoxStyle CssText="BORDER-RIGHT: #7f9db9 1px solid; BORDER-TOP: #7f9db9 1px solid; BORDER-LEFT: #7f9db9 1px solid; WIDTH: 40px; BORDER-BOTTOM: #7f9db9 1px solid"></GoToBoxStyle>
<ContentPaneStyle CssText="border-bottom-color:#7f9db9;border-bottom-style:solid;border-bottom-width:1px;border-left-color:#7f9db9;border-left-style:solid;border-left-width:1px;border-right-color:#7f9db9;border-right-style:solid;border-right-width:1px;border-top-color:#7f9db9;border-top-style:solid;border-top-width:1px;"></ContentPaneStyle>
<Columns>
<eo:StaticColumn DataField="DocId" HeaderText="" Visible="false" >
</eo:StaticColumn>
<eo:ButtonColumn DataField="FileName" HeaderText="File Name" CommandName="Detail" Width="150" ></eo:ButtonColumn>
<eo:StaticColumn DataField="DocRefNo" HeaderText="Doc. Ref No" >
</eo:StaticColumn>
<eo:StaticColumn DataField="DocTypeName" HeaderText="Document Type" >
</eo:StaticColumn>
<eo:StaticColumn DataField="Version" HeaderText="Rev No" Width="45" >
</eo:StaticColumn>
<eo:StaticColumn DataField="DocUpdatedBy" HeaderText="Updated By" >
</eo:StaticColumn>
<eo:StaticColumn DataField="DocUpdatedDate" HeaderText="Updated On" >
</eo:StaticColumn>
</Columns>
<ColumnHeaderStyle CssText="background-image:url('00050101');padding-left:8px;padding-top:3px;"></ColumnHeaderStyle>
</eo:Grid>
</eo:CallbackPanel>
<eo:ContextMenu ID="mnuContextGrid" Width="144px" runat="server" ControlSkinID="None"
OnItemClick="mnuContextGrid_ItemClick" >
<TopGroup Style-CssText="cursor:hand;font-family:Verdana;font-size:11px;">
<Items>
<eo:MenuItem Text-Html="Open File" ItemID="mnuContextGridOpenFile" RaisesServerEvent="True">
</eo:MenuItem>
<eo:MenuItem Text-Html="View/Edit Properties" ItemID="mnuContextGridViewProp" RaisesServerEvent="True">
</eo:MenuItem>
<eo:MenuItem RaisesServerEvent="True" Text-Html="Send link as Email" ItemID="mnuContextGridSendEmailLink">
</eo:MenuItem>
<eo:MenuItem IsSeparator="True">
</eo:MenuItem>
<eo:MenuItem Text-Html="Revision History" ItemID="mnuContextGridRevisionHistory" RaisesServerEvent="True" >
</eo:MenuItem>
<eo:MenuItem Text-Html="Upload Revised Version" ItemID="mnuContextGridUploadRevision" RaisesServerEvent="True" >
</eo:MenuItem>
<eo:MenuItem IsSeparator="True">
</eo:MenuItem>
<eo:MenuItem Text-Html="Delete" ItemID="mnuContextGridDeleteDoc" RaisesServerEvent="True" >
</eo:MenuItem>
</Items>
</TopGroup>
<LookItems>
<eo:MenuItem IsSeparator="True" ItemID="_Separator" NormalStyle-CssText="background-color:#E0E0E0;height:1px;width:1px;">
</eo:MenuItem>
<eo:MenuItem HoverStyle-CssText="color:#F7B00A;padding-left:5px;padding-right:5px;"
ItemID="_Default" NormalStyle-CssText="padding-left:5px;padding-right:5px;">
<SubMenu ExpandEffect-Type="GlideTopToBottom" Style-CssText="border-right: #e0e0e0 1px solid; padding-right: 3px; border-top: #e0e0e0 1px solid; padding-left: 3px; font-size: 12px; padding-bottom: 3px; border-left: #e0e0e0 1px solid; cursor: hand; color: #606060; padding-top: 3px; border-bottom: #e0e0e0 1px solid; font-family: arial; background-color: #f7f8f9"
CollapseEffect-Type="GlideTopToBottom" OffsetX="3" ShadowDepth="0" OffsetY="-4"
ItemSpacing="5">
</SubMenu>
</eo:MenuItem>
</LookItems>
</eo:ContextMenu>
<eo:Dialog runat="server" id="ReviseDocDialog" ControlSkinID="None" Width="500px" HeaderHtml='"padding-top:5px">Upload Document Revision</ div>'
Height="312px" BackColor="#ECE9D8" CloseButtonUrl="00020440" ForeColor="Black" AcceptButton="ReviseDocDialogbtnCloseDialog" AcceptButtonPostBack="true"
HeaderImageUrl="00020441" HeaderImageHeight="27" AllowResize="True" MinHeight="100" MinWidth="150" IsModal="true" >
< FooterStyleActive CssText="background-color:#f0f0f0;padding-right: 4px; padding-left: 4px; font-size: 8pt; padding-bottom: 4px; padding-top: 4px; font-family: tahoma"></ FooterStyleActive>
< HeaderStyleActive CssText="background-image:url(00020442);color:#444444;font-family:'trebuchet ms';font-size:10pt;font-weight:bold;padding-a:0px;padding-b:0px;padding-bottom:7px;padding-c:0px;padding-d:0px;padding-left:8px;padding-right:0px;padding-top:0px;"></ HeaderStyleActive>
< ContentStyleActive CssText="background-color:#f0f0f0;font-family:tahoma;font-size:9pt;padding-bottom:4px;padding-left:4px;padding-right:4px;padding-top:4px;"></ ContentStyleActive>
< BorderImages BottomBorder="00020409,00020429" RightBorder="00020407,00020427" TopRightCornerBottom="00020405,00020425"
TopRightCorner="00020403,00020423" LeftBorder="00020406,00020426" TopLeftCorner="00020401,00020421"
BottomRightCorner="00020410,00020430" TopLeftCornerBottom="00020404,00020424" BottomLeftCorner="00020408,00020428"
TopBorder="00020402,00020422"></ BorderImages>
< ContentTemplate>
< center>
< eo:CallbackPanel ID="Dialogcbpnl" runat="server" Triggers="{ControlID:ReviseDocDialogbtnSaveRevision;parameter:}" >
< asp:CustomValidator ID="vldtr" runat="server" Font-Size="10px" ForeColor="Red"></ asp:CustomValidator>
< table cellpadding="2px" cellspacing="2px" style="vertical-align:middle; text-align:left; width:100%; border-bottom-style:double; border-bottom-color:#D8DBCD; border-left-style:double; border-left-color:#D8DBCD; border-right-style:double; border-right-color:#D8DBCD; border-top-style:double; border-top-color:#D8DBCD;">
< tr>
< td>
< strong>Project</ strong>
</ td>
< td>
< asp:Label ID="ReviseDocDialoglblProjName" runat="server" ></ asp:Label>
</ td>
< td>
< strong>Doc Ref No</ strong>
</ td>
< td>
< asp:Label ID="ReviseDocDialoglblDocRefNo" runat="server" ></ asp:Label>
</ td>
</ tr>
< tr>
< td>
< strong>Discipline</ strong>
</ td>
< td>
< asp:Label ID="ReviseDocDialoglblDisciplineName" runat="server" ></ asp:Label>
</ td>
< td>
< strong>Document Type</ strong>
</ td>
< td>
< asp:Label ID="ReviseDocDialoglblDocTypeName" runat="server" ></ asp:Label>
</ td>
</ tr>
< tr>
< td>
< strong>File Path</ strong>
</ td>
< td>
< asp:Label ID="ReviseDocDialoglblSubFolderPath" runat="server" ></ asp:Label>
</ td>
< td>
< strong>File Name</ strong>
</ td>
< td>
< asp:Label ID="ReviseDocDialoglblFileName" runat="server" ></ asp:Label>
</ td>
</ tr>
< tr>
< td>
< strong>Version No</ strong>
</ td>
< td>
< asp:Label ID="ReviseDocDialoglblVersion" runat="server" ></ asp:Label>
</ td>
< td>
< strong>Last Updated Date</ strong>
</ td>
< td>
< asp:Label ID="ReviseDocDialoglblLastUpdatedDate" runat="server" ></ asp:Label>
</ td>
</ tr>
< tr>
< td>
< strong>Upload New File</ strong>
</ td>
< td colspan="3">
< eo:AJAXUploader ID="ReviseDocDialogFileUploader" runat="server" AutoUpload="True" MaxDataSize="100000"
TempFileLocation="~/eo_upload" Width="400px" MaxFileCount="1" EnableViewState="true" >
< LayoutTemplate>
< table border="0" cellpadding="0" cellspacing="0" width="400px">
< tr>
< td>
< asp:PlaceHolder runat="server" id="InputPlaceHolder">Input Box Place Holder
</ asp:PlaceHolder>
</ td>
</ tr>
< tr>
< td align="right">
< asp:Button runat="server" ID="UploadButton" Text="Upload" Visible="False" />
</ td>
</ tr>
< tr>
< td>
< eo:ProgressBar runat="server" id="ProgressBar" ControlSkinID="Windows_XP" />
</ td>
</ tr>
< tr>
< td>
< asp:PlaceHolder runat="server" id="ProgressTextPlaceHolder">Progress Text Place Holder
</ asp:PlaceHolder>
</ td>
</ tr>
< tr>
< td align="right">
< asp:Button runat="server" ID="CancelButton" Text="Cancel" Visible="False" />
</ td>
< tr>
< td>
< asp:PlaceHolder runat="server" id="PostedFilesPlaceHolder">Posted Files Place Holder
</ asp:PlaceHolder>
</ td>
</ tr>
< tr>
< td align="right">
< asp:Button runat="server" ID="DeleteButton" Text="Delete Selected Files" />
</ td>
</ tr>
</ table>
</ LayoutTemplate>
</ eo:AJAXUploader>
</ td>
</ tr>
</ table>
< br />
< center>
< asp:LinkButton ID="ReviseDocDialogbtnSaveRevision" Text="Click here to Save" Font-Underline="true" runat="server" />
</ center>
< asp:Label ID="ReviseDocDialoglblFinalMessage" runat="server" ForeColor="Green" Font-Size="14px"></ asp:Label>
</ eo:CallbackPanel>
</ center>
</ ContentTemplate>
< FooterTemplate>
< center>
< asp:Button ID="ReviseDocDialogbtnCloseDialog" runat="server" Text="Close" />
</ center>
</ FooterTemplate>
</ eo:Dialog>
< eo:Dialog runat="server" id="RevisionHistoryDialog" ControlSkinID="None" Width="500px" HeaderHtml='"padding-top:5px">Document Revision History</ div>'
Height="312px" BackColor="#ECE9D8" CloseButtonUrl="00020440" ForeColor="Black"
HeaderImageUrl="00020441" HeaderImageHeight="27" AcceptButton="btnOk321312" AcceptButtonPostBack="true" IsModal="true" >
< FooterStyleActive CssText="background-color:#f0f0f0;padding-right: 4px; padding-left: 4px; font-size: 8pt; padding-bottom: 4px; padding-top: 4px; font-family: tahoma"></ FooterStyleActive>
< HeaderStyleActive CssText="background-image:url(00020442);color:#444444;font-family:'trebuchet ms';font-size:10pt;font-weight:bold;padding-a:0px;padding-b:0px;padding-bottom:7px;padding-c:0px;padding-d:0px;padding-left:8px;padding-right:0px;padding-top:0px;"></ HeaderStyleActive>
< ContentStyleActive CssText="background-color:#f0f0f0;font-family:tahoma;font-size:9pt;padding-bottom:4px;padding-left:4px;padding-right:4px;padding-top:4px;"></ ContentStyleActive>
< BorderImages BottomBorder="00020409,00020429" RightBorder="00020407,00020427" TopRightCornerBottom="00020405,00020425"
TopRightCorner="00020403,00020423" LeftBorder="00020406,00020426" TopLeftCorner="00020401,00020421"
BottomRightCorner="00020410,00020430" TopLeftCornerBottom="00020404,00020424" BottomLeftCorner="00020408,00020428"
TopBorder="00020402,00020422"></ BorderImages>
< ContentTemplate>
< center>
< script type="text/javascript">
function ViewRevisedFile(grid, itemIndex, colIndex, commandName) {
var item = grid.getItem(itemIndex);
var cell = item.getCell(0);
// window.alert("Topic:" + cell.getValue());
window.open('/DocumentFileShare/ShowFile.aspx?DocId=' + cell.getValue().toString()
, 'mywindow', 'location=0,status=1,scrollbars=2,width=300,height=300,resizable=yes');
}
</ script>
< table cellpadding="2px" cellspacing="2px" style="vertical-align:middle; text-align:left; width:100%; border-bottom-style:double; border-bottom-color:#D8DBCD; border-left-style:double; border-left-color:#D8DBCD; border-right-style:double; border-right-color:#D8DBCD; border-top-style:double; border-top-color:#D8DBCD;">
< tr>
< td>
< strong>Project</ strong>
</ td>
< td>
< asp:Label ID="RevisionHistoryDialoglblProjName" runat="server" ></ asp:Label>
</ td>
< td>
< strong>Doc Ref No</ strong>
</ td>
< td>
< asp:Label ID="RevisionHistoryDialoglblDocRefNo" runat="server" ></ asp:Label>
</ td>
</ tr>
< tr>
< td>
< strong>Discipline</ strong>
</ td>
< td>
< asp:Label ID="RevisionHistoryDialoglblDisciplineName" runat="server" ></ asp:Label>
</ td>
< td>
< strong>Document Type</ strong>
</ td>
< td>
< asp:Label ID="RevisionHistoryDialoglblDocTypeName" runat="server" ></ asp:Label>
</ td>
</ tr>
< tr>
< td>
< strong>File Path</ strong>
</ td>
< td>
< asp:Label ID="RevisionHistoryDialoglblSubFolderPath" runat="server" ></ asp:Label>
</ td>
< td>
< strong>File Name</ strong>
</ td>
< td>
< asp:Label ID="RevisionHistoryDialoglblFileName" runat="server" ></ asp:Label>
</ td>
</ tr>
< tr>
< td>
< strong>Version No</ strong>
</ td>
< td>
< asp:Label ID="RevisionHistoryDialoglblVersion" runat="server" ></ asp:Label>
</ td>
< td>
< strong>Last Updated Date</ strong>
</ td>
< td>
< asp:Label ID="RevisionHistoryDialoglblLastUpdatedDate" runat="server" ></ asp:Label>
</ td>
</ tr>
</ table>
< center>
< asp:LinkButton ID="btnOk321312" Text="Ok" runat="server" />
</ center>
< eo:Grid id="RevisionHistoryGrid" Height="100px" Width="200px" runat="server" RunningMode="Server" ClientSideOnItemCommand="ViewRevisedFile"
FixedColumnCount="0" BorderColor="#7F9DB9" BorderWidth="1px" ColumnHeaderDescImage="00050105"
ColumnHeaderAscImage="00050104" GoToBoxVisible="True" GridLineColor="220, 223, 228" GridLines="Both"
ColumnHeaderDividerImage="00050103" Font-Size="8pt" Font-Names="Tahoma" ScrollBars="None" ForeColor="Black" >
< FooterStyle CssText="padding-bottom:4px;padding-left:4px;padding-right:4px;padding-top:4px;"></ FooterStyle>
< ItemStyles>
< eo:GridItemStyleSet>
< ItemHoverStyle CssText="background-color: whitesmoke"></ ItemHoverStyle>
< SelectedStyle CssText="background-color:#FFF68F;"></ SelectedStyle>
< CellStyle CssText="padding-left:8px;padding-top:2px;"></ CellStyle>
< ItemStyle CssText="background-color: white"></ ItemStyle>
< FixedColumnCellStyle CssText="border-right: #d6d2c2 1px solid; padding-right: 10px; border-top: #faf9f4 1px solid; border-left: #faf9f4 1px solid; border-bottom: #d6d2c2 1px solid; background-color: #ebeadb; text-align: right"></ FixedColumnCellStyle>
</ eo:GridItemStyleSet>
</ ItemStyles>
< GoToBoxStyle CssText="BORDER-RIGHT: #7f9db9 1px solid; BORDER-TOP: #7f9db9 1px solid; BORDER-LEFT: #7f9db9 1px solid; WIDTH: 40px; BORDER-BOTTOM: #7f9db9 1px solid"></ GoToBoxStyle>
< ContentPaneStyle CssText="border-bottom-color:#7f9db9;border-bottom-style:solid;border-bottom-width:1px;border-left-color:#7f9db9;border-left-style:solid;border-left-width:1px;border-right-color:#7f9db9;border-right-style:solid;border-right-width:1px;border-top-color:#7f9db9;border-top-style:solid;border-top-width:1px;"></ ContentPaneStyle>
< Columns>
< eo:StaticColumn DataField="DocId" HeaderText="" Visible="false" >
</ eo:StaticColumn>
< eo:ButtonColumn DataField="Version" CommandName="Detail" HeaderText="Rev No" Width="45" >
</ eo:ButtonColumn>
< eo:StaticColumn DataField="RevisionBy" HeaderText="Revised By" >
</ eo:StaticColumn>
< eo:StaticColumn DataField="RevisionDate" HeaderText="Revised On" >
</ eo:StaticColumn>
</ Columns>
< ColumnHeaderStyle CssText="background-image:url('00050101');padding-left:8px;padding-top:3px;"></ ColumnHeaderStyle>
</ eo:Grid>
</ center>
</ ContentTemplate>
</ eo:Dialog>
< eo:Dialog runat="server" id="DeleteDocDialog" ControlSkinID="None" Width="500px" HeaderHtml='"padding-top:5px">Delete Document</ div>'
Height="200px" BackColor="#ECE9D8" CloseButtonUrl="00020440" ForeColor="Black" AcceptButton="btnDeleteDocYes" AcceptButtonPostBack="true" CancelButton ="btnDeleteDocNo" CancelButtonPostBack="false"
HeaderImageUrl="00020441" HeaderImageHeight="27" AllowResize="True" MinHeight="100" MinWidth="150" IsModal="true" >
< FooterStyleActive CssText="background-color:#f0f0f0;padding-right: 4px; padding-left: 4px; font-size: 8pt; padding-bottom: 4px; padding-top: 4px; font-family: tahoma"></ FooterStyleActive>
< HeaderStyleActive CssText="background-image:url(00020442);color:#444444;font-family:'trebuchet ms';font-size:10pt;font-weight:bold;padding-a:0px;padding-b:0px;padding-bottom:7px;padding-c:0px;padding-d:0px;padding-left:8px;padding-right:0px;padding-top:0px;"></ HeaderStyleActive>
< ContentStyleActive CssText="background-color:#f0f0f0;font-family:tahoma;font-size:9pt;padding-bottom:4px;padding-left:4px;padding-right:4px;padding-top:4px;"></ ContentStyleActive>
< BorderImages BottomBorder="00020409,00020429" RightBorder="00020407,00020427" TopRightCornerBottom="00020405,00020425"
TopRightCorner="00020403,00020423" LeftBorder="00020406,00020426" TopLeftCorner="00020401,00020421"
BottomRightCorner="00020410,00020430" TopLeftCornerBottom="00020404,00020424" BottomLeftCorner="00020408,00020428"
TopBorder="00020402,00020422"></ BorderImages>
< ContentTemplate>
< center>
< script type="text/javascript">
function ViewRevisedFile(grid, itemIndex, colIndex, commandName) {
var item = grid.getItem(itemIndex);
var cell = item.getCell(0);
// window.alert("Topic:" + cell.getValue());
window.open('/DocumentFileShare/ShowFile.aspx?DocId=' + cell.getValue().toString()
, 'mywindow', 'location=0,status=1,scrollbars=2,width=300,height=300,resizable=yes');
}
</ script>
< table cellpadding="2px" cellspacing="2px" style="vertical-align:middle; text-align:left; width:100%; border-bottom-style:double; border-bottom-color:#D8DBCD; border-left-style:double; border-left-color:#D8DBCD; border-right-style:double; border-right-color:#D8DBCD; border-top-style:double; border-top-color:#D8DBCD;">
< tr>
< td>
< strong>Project</ strong>
</ td>
< td>
< asp:Label ID="DeleteDocDialoglblProjName" runat="server" ></ asp:Label>
</ td>
< td>
< strong>Doc Ref No</ strong>
</ td>
< td>
< asp:Label ID="DeleteDocDialoglblDocRefNo" runat="server" ></ asp:Label>
</ td>
</ tr>
< tr>
< td>
< strong>Discipline</ strong>
</ td>
< td>
< asp:Label ID="DeleteDocDialoglblDisciplineName" runat="server" ></ asp:Label>
</ td>
< td>
< strong>Document Type</ strong>
</ td>
< td>
< asp:Label ID="DeleteDocDialoglblDocTypeName" runat="server" ></ asp:Label>
</ td>
</ tr>
< tr>
< td>
< strong>File Path</ strong>
</ td>
< td>
< asp:Label ID="DeleteDocDialoglblSubFolderPath" runat="server" ></ asp:Label>
</ td>
< td>
< strong>File Name</ strong>
</ td>
< td>
< asp:Label ID="DeleteDocDialoglblFileName" runat="server" ></ asp:Label>
</ td>
</ tr>
< tr>
< td>
< strong>Version No</ strong>
</ td>
< td>
< asp:Label ID="DeleteDocDialoglblVersion" runat="server" ></ asp:Label>
</ td>
< td>
< strong>Last Updated Date</ strong>
</ td>
< td>
< asp:Label ID="DeleteDocDialoglblLastUpdatedDate" runat="server" ></ asp:Label>
</ td>
</ tr>
</ table>
< center>
< asp:Label ID="lblConfirmation" Text="Are you sure you want to Delete this Document?" runat="server" ForeColor="Red" Font-Size="14px"></ asp:Label>
< br />
< asp:Button ID="btnDeleteDocYes" Text="Yes" runat="server" />
< asp:Button ID="btnDeleteDocNo" Text="No" runat="server" />
</ center>
</ center>
</ ContentTemplate>
</ eo:Dialog>
< eo:Dialog runat="server" id="DocPropDialog" ControlSkinID="None" Width="550px" HeaderHtml='"padding-top:5px">View/Edit Document Properties</ div>'
Height="300px" BackColor="#ECE9D8" CloseButtonUrl="00020440" ForeColor="Black" CancelButton="DocPropDialogbtnClose" CancelButtonPostBack="true"
HeaderImageUrl="00020441" HeaderImageHeight="27" AllowResize="True" MinHeight="100" MinWidth="150" IsModal="true" >
< FooterStyleActive CssText="background-color:#f0f0f0;padding-right: 4px; padding-left: 4px; font-size: 8pt; padding-bottom: 4px; padding-top: 4px; font-family: tahoma"></ FooterStyleActive>
< HeaderStyleActive CssText="background-image:url(00020442);color:#444444;font-family:'trebuchet ms';font-size:10pt;font-weight:bold;padding-a:0px;padding-b:0px;padding-bottom:7px;padding-c:0px;padding-d:0px;padding-left:8px;padding-right:0px;padding-top:0px;"></ HeaderStyleActive>
< ContentStyleActive CssText="background-color:#f0f0f0;font-family:tahoma;font-size:9pt;padding-bottom:4px;padding-left:4px;padding-right:4px;padding-top:4px;"></ ContentStyleActive>
< BorderImages BottomBorder="00020409,00020429" RightBorder="00020407,00020427" TopRightCornerBottom="00020405,00020425"
TopRightCorner="00020403,00020423" LeftBorder="00020406,00020426" TopLeftCorner="00020401,00020421"
BottomRightCorner="00020410,00020430" TopLeftCornerBottom="00020404,00020424" BottomLeftCorner="00020408,00020428"
TopBorder="00020402,00020422"></ BorderImages>
< ContentTemplate>
< center>
< eo:CallbackPanel ID="cbpnl34324" runat="server" Triggers="{ControlID:DocPropDialogbtnSave;Parameter:}">
< asp:CustomValidator ID="DocPropDialogvldtr" runat="server" Font-Size="10px" ForeColor="Red"></ asp:CustomValidator>
< table cellpadding="2px" cellspacing="2px" style="vertical-align:middle; text-align:left; border-bottom-style:double; border-bottom-color:#D8DBCD; border-left-style:double; border-left-color:#D8DBCD; border-right-style:double; border-right-color:#D8DBCD; border-top-style:double; border-top-color:#D8DBCD;">
< tr>
< td>
< strong>Project</ strong>
</ td>
< td>
< asp:Label ID="DocPropDialoglblProjName" runat="server" ></ asp:Label>
</ td>
< td>
< strong>Doc Ref No</ strong>
</ td>
< td>
< asp:TextBox ID="DocPropDialogtxtBoxDocRefNo" runat="server"></ asp:TextBox>
</ td>
</ tr>
< tr>
< td>
< strong>Document Date</ strong>
</ td>
< td>
< eo:DatePicker ID="DocPropDialogdtpDocDate" runat="server" PickerFormat="dd/MM/yyyy"
ControlSkinID="None" DayCellHeight="16" DayCellWidth="22"
DayHeaderFormat="Short" DisabledDates="" MonthSelectorVisible="True"
SelectedDates="" TitleLeftArrowDownImageUrl="00040103"
TitleLeftArrowImageUrl="00040101" TitleRightArrowDownImageUrl="00040104"
TitleRightArrowImageUrl="00040102"
WeekSelectorVisible="True">
< CalendarStyle CssText="border-bottom-color:Black;border-bottom-style:solid;border-bottom-width:1px;border-left-color:Black;border-left-style:solid;border-left-width:1px;border-right-color:Black;border-right-style:solid;border-right-width:1px;border-top-color:Black;border-top-style:solid;border-top-width:1px;padding-bottom:5px;padding-left:5px;padding-right:5px;padding-top:5px;background-color:white" />
< TitleStyle CssText="PADDING-RIGHT: 3px; PADDING-LEFT: 3px; FONT-WEIGHT: bold; FONT-SIZE: 8pt; PADDING-BOTTOM: 3px; COLOR: white; PADDING-TOP: 3px; FONT-FAMILY: Tahoma; BACKGROUND-COLOR: #0054e3" />
< MonthStyle CssText="MARGIN: 0px 4px; cursor:hand" />
< DayHeaderStyle CssText="FONT-SIZE: 11px; COLOR: #0054e3; BORDER-BOTTOM: black 1px solid; FONT-FAMILY: Tahoma" />
< DayStyle CssText="FONT-SIZE: 8pt; FONT-FAMILY: Tahoma; text-decoration:none" />
< DayHoverStyle CssText="FONT-SIZE: 8pt; FONT-FAMILY: Tahoma; text-decoration:underline" />
< TodayStyle CssText="background-image:url('00040106');" />
< SelectedDayStyle CssText="FONT-SIZE: 8pt; FONT-FAMILY: Tahoma; background-image:url('00040105');color:white;" />
< DisabledDayStyle CssText="FONT-SIZE: 8pt; FONT-FAMILY: Tahoma; COLOR: gray" />
< FooterTemplate>
< div style="FONT-WEIGHT: bold; FONT-SIZE: 11px; FONT-FAMILY: Tahoma"">
< img src="{img:00040106}" alt="a"> Today: {var:today:MM/dd/yyyy} </ img></ div>
</ FooterTemplate>
</ eo:DatePicker>
</ td>
< td>
< strong>Document Title</ strong>
</ td>
< td>
< asp:TextBox ID="DocPropDialogtxtBoxDocTitle" runat="server"></ asp:TextBox>
</ td>
</ tr>
< tr>
< td>
< strong>Discipline</ strong>
</ td>
< td>
< asp:Label ID="DocPropDialoglblDisciplineName" runat="server" ></ asp:Label>
</ td>
< td>
< strong>Document Type</ strong>
</ td>
< td>
< asp:Label ID="DocPropDialoglblDocTypeName" runat="server" ></ asp:Label>
</ td>
</ tr>
< tr>
< td>
< strong>Confidential</ strong>
</ td>
< td>
< asp:RadioButtonList ID="DocPropDialogrdConfidential" runat="server" RepeatDirection="Horizontal">
< asp:ListItem Text ="No" Value="No" Selected="True"></ asp:ListItem>
< asp:ListItem Text ="Yes" Value="Yes" ></ asp:ListItem>
</ asp:RadioButtonList>
</ td>
< td>
< strong>Remarks</ strong>
</ td>
< td>
< asp:TextBox ID="DocPropDialogtxtBoxRemarks" runat="server" ></ asp:TextBox>
</ td>
</ tr>
< tr>
< td>
< strong>Project Area</ strong>
</ td>
< td>
< asp:DropDownList ID="DocPropDialogcmbProjArea" runat="server" ></ asp:DropDownList>
</ td>
< td>
< strong>Work Package</ strong>
</ td>
< td>
< asp:DropDownList ID="DocPropDialogcmbProjWrkPack" runat="server" ></ asp:DropDownList>
</ td>
</ tr>
< tr>
< td>
< strong>File Path</ strong>
</ td>
< td>
< asp:Label ID="DocPropDialoglblSubFolderPath" runat="server" ></ asp:Label>
</ td>
< td>
< strong>File Name</ strong>
</ td>
< td>
< asp:Label ID="DocPropDialoglblFileName" runat="server" ></ asp:Label>
</ td>
</ tr>
< tr>
< td>
< strong>Version No</ strong>
</ td>
< td>
< asp:Label ID="DocPropDialoglblVersion" runat="server" ></ asp:Label>
</ td>
< td>
< strong>Last Updated Date</ strong>
</ td>
< td>
< asp:Label ID="DocPropDialoglblLastUpdatedDate" runat="server" ></ asp:Label>
</ td>
</ tr>
</ table>
< br />
< panel id="DocPropDialogSavePnl" runat="server">
< center>
< asp:LinkButton ID="DocPropDialogbtnSave" Text="Click here to Save" runat="server" Font-Underline="true" />
< asp:Label ID="DocPropDialoglblConfirmation" runat="server" ForeColor="Green" Font-Size="14px"></ asp:Label>
</ center>
</ panel>
</ eo:CallbackPanel>
</ center>
</ ContentTemplate>
< FooterTemplate>
< center>
< asp:Button ID="DocPropDialogbtnClose" runat="server" Text="Close" />
</ center>
</ FooterTemplate>
</ eo:Dialog>
< eo:Dialog runat="server" id="EmailLinkDialog" ControlSkinID="None" Width="650px" HeaderHtml='"padding-top:5px">Send Email Link of the Document</ div>'
Height="100px" BackColor="#ECE9D8" CloseButtonUrl="00020440" ForeColor="Black" CancelButton="EmailLinkDialogbtnClose"
HeaderImageUrl="00020441" HeaderImageHeight="27" AllowResize="True" MinHeight="100" MinWidth="150" IsModal="true" >
< FooterStyleActive CssText="background-color:#f0f0f0;padding-right: 4px; padding-left: 4px; font-size: 8pt; padding-bottom: 4px; padding-top: 4px; font-family: tahoma"></ FooterStyleActive>
< HeaderStyleActive CssText="background-image:url(00020442);color:#444444;font-family:'trebuchet ms';font-size:10pt;font-weight:bold;padding-a:0px;padding-b:0px;padding-bottom:7px;padding-c:0px;padding-d:0px;padding-left:8px;padding-right:0px;padding-top:0px;"></ HeaderStyleActive>
< ContentStyleActive CssText="background-color:#f0f0f0;font-family:tahoma;font-size:9pt;padding-bottom:4px;padding-left:4px;padding-right:4px;padding-top:4px;"></ ContentStyleActive>
< BorderImages BottomBorder="00020409,00020429" RightBorder="00020407,00020427" TopRightCornerBottom="00020405,00020425"
TopRightCorner="00020403,00020423" LeftBorder="00020406,00020426" TopLeftCorner="00020401,00020421"
BottomRightCorner="00020410,00020430" TopLeftCornerBottom="00020404,00020424" BottomLeftCorner="00020408,00020428"
TopBorder="00020402,00020422"></ BorderImages>
< ContentTemplate>
< center>
< table cellpadding="2px" cellspacing="2px" style="vertical-align:middle; text-align:left; width:100%; border-bottom-style:double; border-bottom-color:#D8DBCD; border-left-style:double; border-left-color:#D8DBCD; border-right-style:double; border-right-color:#D8DBCD; border-top-style:double; border-top-color:#D8DBCD;">
< tr>
< td>
< strong>Project</ strong>
</ td>
< td>
< asp:Label ID="EmailLinkDialoglblProjName" runat="server" ></ asp:Label>
</ td>
< td>
< strong>Doc Ref No</ strong>
</ td>
< td>
< asp:Label ID="EmailLinkDialoglblDocRefNo" runat="server" ></ asp:Label>
</ td>
</ tr>
< tr>
< td>
< strong>Discipline</ strong>
</ td>
< td>
< asp:Label ID="EmailLinkDialoglblDisciplineName" runat="server" ></ asp:Label>
</ td>
< td>
< strong>Document Type</ strong>
</ td>
< td>
< asp:Label ID="EmailLinkDialoglblDocTypeName" runat="server" ></ asp:Label>
</ td>
</ tr>
< tr>
< td>
< strong>File Path</ strong>
</ td>
< td>
< asp:Label ID="EmailLinkDialoglblSubFolderPath" runat="server" ></ asp:Label>
</ td>
< td>
< strong>File Name</ strong>
</ td>
< td>
< asp:Label ID="EmailLinkDialoglblFileName" runat="server" ></ asp:Label>
</ td>
</ tr>
< tr>
< td>
< strong>Version No</ strong>
</ td>
< td>
< asp:Label ID="EmailLinkDialoglblVersion" runat="server" ></ asp:Label>
</ td>
< td>
< strong>Last Updated Date</ strong>
</ td>
< td>
< asp:Label ID="EmailLinkDialoglblLastUpdatedDate" runat="server" ></ asp:Label>
</ td>
</ tr>
</ table>
< br />
< eo:CallbackPanel ID="CallbackPanel2" runat="server" Triggers="{ControlID:EmailLinkDialogbtnSelectAD;Parameter:},{ControlID:EmailLinkDialogbtnSendEmail;Parameter:}">
< panel id="EmailLinkDialogEmailPnl" runat="server" >
< asp:CustomValidator ID="EmailLinkDialogvldtr" runat="server"></ asp:CustomValidator>
< table style="vertical-align:middle; text-align:left;">
< tr>
< td>
< strong>To</ strong>
</ td>
< td>
< asp:TextBox ID="EmailLinkDialogtxtBoxTo" runat="server" Width="300px"></ asp:TextBox>
< asp:LinkButton ID="EmailLinkDialogbtnSelectAD" runat="server" Text="<<" Font-Size="12px"></ asp:LinkButton>
</ td>
< td rowspan="3" valign="top">
< asp:ListBox ID="EmailLinkDialogADListBox" runat="server" Height="120px" Font-Size="9px" Width="185px"></ asp:ListBox>
</ td>
</ tr>
< tr>
< td>
< strong>Subject</ strong>
</ td>
< td>
< asp:TextBox ID="EmailLinkDialogtxtBoxSubject" runat="server" Width="300px"></ asp:TextBox>
</ td>
</ tr>
< tr>
< td>
< strong>Email Message</ strong>
</ td>
< td>
< asp:TextBox ID="EmailLinkDialogtxtBoxBody" runat="server" TextMode="MultiLine" Width="300px" Height="70px"></ asp:TextBox>
</ td>
</ tr>
< tr>
< td colspan="3" style=" color:Red;">
PS: Document Link will be added in the email after the message
</ td>
</ tr>
< tr>
< td colspan="3">
< br />
< center>
< asp:LinkButton ID="EmailLinkDialogbtnSendEmail" runat="server" Font-Underline="true" Text="Click here to send email"></ asp:LinkButton>
</ center>
</ td>
</ tr>
</ table>
</ panel>
< asp:Label ID="EmailLinkDialoglblConfirmation" runat="server" ForeColor="Green" Font-Size="14px"></ asp:Label>
< br />
</ eo:CallbackPanel>
</ center>
</ ContentTemplate>
< FooterTemplate>
< center>
< asp:Button ID="EmailLinkDialogbtnClose" runat="server" Text="Close" />
</ center>
</ FooterTemplate>
</ eo:Dialog>
< eo:MsgBox runat="server" id="ErrorMsgBox" HeaderHtml="" MinWidth="150" Width="320px"
HeaderImageUrl="00020441" HeaderHtmlFormat='"padding-top:4px">{0}</div>' Height="150px"
ControlSkinID="None" MinHeight="100" HeaderImageHeight="27" AllowResize="True" CloseButtonUrl="00020440"
MsgBoxButtonType="ImageButton" IsModal="true" >
<FooterStyleActive CssText="background-color:#f0f0f0; padding-right: 4px; padding-left: 4px; font-size: 8pt; padding-bottom: 4px; padding-top: 4px; font-family: tahoma"></FooterStyleActive>
<HeaderStyleActive CssText="background-image:url(00020442);color:#444444;font-family:'trebuchet ms';font-size:10pt;font-weight:bold;padding-bottom:7px;padding-left:8px;padding-right:0px;padding-top:0px;"></HeaderStyleActive>
<ContentStyleActive CssText="background-color:#f0f0f0;font-family:tahoma;font-size:8pt;padding-bottom:4px;padding-left:4px;padding-right:4px;padding-top:4px"></ContentStyleActive>
<BorderImages BottomBorder="00020409,00020429" RightBorder="00020407,00020427" TopRightCornerBottom="00020405,00020425"
TopRightCorner="00020403,00020423" LeftBorder="00020406,00020426" TopLeftCorner="00020401,00020421"
BottomRightCorner="00020410,00020430" TopLeftCornerBottom="00020404,00020424" BottomLeftCorner="00020408,00020428"
TopBorder="00020402,00020422"></BorderImages>
</eo:MsgBox>
</div>
</eo:SplitterPane>
</eo:Splitter>
</div>
</asp:Content>
Code: Visual Basic.NET
Imports NMDC_EDMS.clsCommon
Imports NMDC_EDMS.clsMyADClass
Imports System.Data
Imports System.Data.SqlClient
Public Class DocLibrary
Inherits System.Web.UI.Page
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
If IsPostBack = False Then
If IsNothing(Session("CurrProjectCode")) = False Then
'lblProjectName.Text = "of " & Session("CurrProjectName").ToString
Dim rootFolder As String
rootFolder = "~/fileserver/" & Session("CurrProjectCode").ToString() & "/Current"
Dim ds As DataSet = GetDataSetofQuery("Select IsSuperUser from UserProjects where ProjectCode = '" & _
Session("CurrProjectCode").ToString & "' and WindowsLoginId = '" & Page.User.Identity.Name & "' ")
If ds.Tables.Count = 0 Then
ds.Dispose()
ds = Nothing
Return
End If
If ds.Tables(0).Rows.Count = 0 Then 'if no record is retrieved user is not authorised for the project
ds.Dispose()
ds = Nothing
Return
End If
If ds.Tables(0).Rows(0).Item(0).ToString.ToLower = "true" Then 'if user is a super user then no filter
DisplayFiles(rootFolder)
If ExplorerTree.Nodes.Count > 0 Then
If IsNothing(ExplorerTree.SelectedNode) = True Then
ExplorerTree.Nodes(0).Selected = True
Dim e2 As New EO.Web.NavigationItemEventArgs(ExplorerTree.Nodes(0))
FolderExplorerTree_Click(Nothing, e2)
Else
Dim e2 As New EO.Web.NavigationItemEventArgs(ExplorerTree.SelectedNode)
FolderExplorerTree_Click(Nothing, e2)
End If
End If
ds.Dispose()
ds = Nothing
Return
End If
Dim sql As String = "SELECT Discipline.SubFolderPath FROM Discipline INNER JOIN UserDisciplines ON " & _
"Discipline.DisciplineCode = UserDisciplines.DisciplineCode " & _
"WHERE UserDisciplines.ProjectCode = '" & Session("CurrProjectCode").ToString & "' AND " & _
"UserDisciplines.WindowsLoginId = '" & Page.User.Identity.Name & "' " & _
"ORDER BY Discipline.SubFolderPath"
ds = GetDataSetofQuery(sql)
If ds.Tables.Count = 0 Then
ds.Dispose()
ds = Nothing
Return
End If
If ds.Tables(0).Rows.Count = 0 Then
ds.Dispose()
ds = Nothing
Return
End If
Dim i As Integer
Dim tn As EO.Web.TreeNode
Dim AddDir As Boolean
For i = 0 To ds.Tables(0).Rows.Count - 1
AddDir = True
'Special check for CurrDivCode for NMDC Base, if Div is selected only that division must be seen in Doc Library
If IsNothing(Session("CurrDivCode")) = False Then
If ds.Tables(0).Rows(i).Item(0).ToString = GetSubFolderPathfromDiscipline(Session("CurrDivCode").ToString) Then
AddDir = True
Else
AddDir = False
End If
End If
If AddDir = False Then
Continue For
End If
tn = New EO.Web.TreeNode
tn.Text = ds.Tables(0).Rows(i).Item(0).ToString
tn.Value = ds.Tables(0).Rows(i).Item(0).ToString
ExplorerTree.Nodes.Add(tn)
DisplayFiles(rootFolder & "/" & ds.Tables(0).Rows(i).Item(0).ToString, tn)
Next
If ExplorerTree.Nodes.Count > 0 Then
If IsNothing(ExplorerTree.SelectedNode) = True Then
ExplorerTree.Nodes(0).Selected = True
Dim e2 As New EO.Web.NavigationItemEventArgs(ExplorerTree.Nodes(0))
FolderExplorerTree_Click(Nothing, e2)
Else
Dim e2 As New EO.Web.NavigationItemEventArgs(ExplorerTree.SelectedNode)
FolderExplorerTree_Click(Nothing, e2)
End If
End If
ds.Dispose()
ds = Nothing
End If
End If
If IsPostBack = True Then
If IsNothing(ViewState("GridDb")) = False Then
Dim ds As DataSet = CType(ViewState("GridDb"), DataSet)
Grid1.DataSource = ds
Grid1.DataBind()
ds.Dispose()
ds = Nothing
End If
End If
End Sub
Private Sub DisplayFiles(ByVal DirPath As String, Optional ByVal tn As EO.Web.TreeNode = Nothing)
If IsNothing(Session("CurrSelectedPath")) = False Then
If DirPath = Session("CurrSelectedPath").ToString Then
tn.Selected = True
tn.ExpandPath()
End If
End If
Dim dirInfo As New System.IO.DirectoryInfo(Server.MapPath(DirPath))
Dim dl As System.IO.DirectoryInfo() = dirInfo.GetDirectories
Dim d As System.IO.DirectoryInfo
Dim AddDir As Boolean = True
For Each d In dl
AddDir = True
'Special check for CurrDivCode for NMDC Base, if Div is selected only that division must be seen in Doc Library
If IsNothing(Session("CurrDivCode")) = False And tn Is Nothing Then
If d.Name = GetSubFolderPathfromDiscipline(Session("CurrDivCode").ToString) Then
AddDir = True
Else
AddDir = False
End If
End If
If AddDir = False Then
Continue For
End If
Dim tnode As New EO.Web.TreeNode
tnode.Text = d.Name
tnode.Value = d.Name
If tn Is Nothing Then ApplyDiscColorCodeonFolder(tnode) 'Apply color code on root folder
If Not tn Is Nothing Then
tn.ChildNodes.Add(tnode)
Else
Me.ExplorerTree.Nodes.Add(tnode)
End If
DisplayFiles(DirPath & "/" & d.Name, tnode)
Next
dirInfo = Nothing
dl = Nothing
d = Nothing
End Sub
Protected Sub FolderExplorerTree_Click(ByVal sender As Object, ByVal e As EO.Web.NavigationItemEventArgs)
'Here get the subfolderpath which was selected and populate the grid with those documents
Dim tn As EO.Web.TreeNode = CType(e.TreeNode, EO.Web.TreeNode)
Dim FullsubfolderpathWithDiscFolderPath As String = tn.Text
While True
If IsNothing(tn.ParentNode.Text) = False Then
FullsubfolderpathWithDiscFolderPath = tn.ParentNode.Text & "/" & FullsubfolderpathWithDiscFolderPath
tn = tn.ParentNode
Else
Exit While
End If
End While
'
Dim a1 As String() = FullsubfolderpathWithDiscFolderPath.Split("/")
FillGrid(a1(0).ToString(), FullsubfolderpathWithDiscFolderPath)
End Sub
Protected Sub FillGrid(ByVal disciplinePath As String, ByVal subFolderPath As String)
If IsNothing(Session("CurrProjectCode")) = True Then
Return
End If
Dim sqlcmd As New SqlCommand
With sqlcmd
.CommandText = "GetDocstoPopulateGrid"
.CommandType = CommandType.StoredProcedure
.Parameters.Add("@WindowsLoginId", SqlDbType.VarChar).Value = Page.User.Identity.Name
.Parameters.Add("@ProjectCode", SqlDbType.VarChar).Value = Session("CurrProjectCode").ToString
.Parameters.Add("@DisciplinePath", SqlDbType.VarChar).Value = disciplinePath
.Parameters.Add("@SubFolderPath", SqlDbType.VarChar).Value = subFolderPath
End With
Dim ds As DataSet = GetDataSetofSqlCommand(sqlcmd)
If ds.Tables.Count = 0 Then
Return
End If
'Grid1.RecordCount = ds.Tables(0).Rows.Count
For Each dr As DataRow In ds.Tables(0).Rows
dr.Item("DocUpdatedBy") = GetUserInfo(dr.Item("DocUpdatedBy").ToString, "cn")
Next
'
Grid1.DataSource = ds
Grid1.DataBind()
ViewState("GridDb") = ds
'
ds.Dispose()
sqlcmd.Dispose()
ds = Nothing
sqlcmd = Nothing
End Sub
Protected Sub mnuContextGrid_ItemClick(ByVal sender As Object, ByVal e As EO.Web.NavigationItemEventArgs)
If IsNothing(Session("CurrProjectCode")) = True Then
Return
End If
Dim menuitem As EO.Web.MenuItem = CType(e.MenuItem, EO.Web.MenuItem)
Select Case menuitem.ItemID
Case "mnuContextGridOpenFile" 'Open File
If Grid1.SelectedItemIndex < 0 Then
Return
End If
Dim DocId As String = Grid1.Items(Grid1.SelectedItemIndex).Cells(0).Value.ToString
'Dim ds As DataSet = GetDataSetofQuery(sql)
'If ds.Tables.Count = 0 Then
' Return
'End If
''Response.Redirect("~/fileserver/" & Session("CurrProjectCode").ToString & "/current/" & ds.Tables(0).Rows(0).Item(0).ToString)
''RegisterStartupScript("11", "<script type='text/javascript'>detailedresults=window.open('" & _
'' "/fileserver/" & Session("CurrProjectCode").ToString & "/current/" & ds.Tables(0).Rows(0).Item(0).ToString & _
'' "','mywindow', 'location=0,status=1,scrollbars=1,width=100,height=100');</script>")
'Dim strEncryptedFilePath As String = EncryptData("/fileserver/" & Session("CurrProjectCode").ToString & "/current/" & ds.Tables(0).Rows(0).Item(0).ToString)
ClientScript.RegisterStartupScript(Me.GetType(), "aa", "<script type='text/javascript'>detailedresults=window.open('" & _
"/DocumentFileShare/ShowFile.aspx?DocId=" & DocId & _
"','mywindow', 'location=0,status=1,scrollbars=2,width=300,height=300,resizable=yes');</script>")
Case "mnuContextGridViewProp" 'View/Edit Doc Properties
If Grid1.SelectedItemIndex < 0 Then
Return
End If
Dim DocId As String = Grid1.Items(Grid1.SelectedItemIndex).Cells(0).Value.ToString
Dim ProjectCode As String = Session("CurrProjectCode").ToString
Dim sqlcmd As New SqlCommand
Dim ds As DataSet
sqlcmd.Connection = GetSqlConnection()
sqlcmd.CommandType = CommandType.StoredProcedure
sqlcmd.CommandText = "IsUserAuth2Rev"
sqlcmd.Parameters.Add("@WindowsLoginId", SqlDbType.VarChar).Value = Page.User.Identity.Name
sqlcmd.Parameters.Add("@ProjectCode", SqlDbType.VarChar).Value = ProjectCode
sqlcmd.Parameters.Add("@DocId", SqlDbType.Int).Value = DocId
sqlcmd.Parameters.Add("@IsAuth", SqlDbType.Bit).Direction = ParameterDirection.Output
Dim isUserAuthorized As Boolean = False
Try
sqlcmd.Connection.Open()
sqlcmd.ExecuteNonQuery()
If sqlcmd.Parameters("@IsAuth").Value.ToString.ToLower = "true" Then
isUserAuthorized = True
sqlcmd.Connection.Close()
End If
Catch ex As Exception
Finally
sqlcmd.Connection.Close()
End Try
sqlcmd.Parameters.Clear()
sqlcmd.CommandType = CommandType.Text
sqlcmd.CommandText = "Select * from CurrentDocView where DocId = @DocId"
sqlcmd.Parameters.Add("@DocId", SqlDbType.Int).Value = DocId
ds = GetDataSetofSqlCommand(sqlcmd)
If ds.Tables.Count = 0 Then
Return
End If
If ds.Tables(0).Rows.Count = 0 Then
Return
End If
FillDocPropDialogCombo()
With ds.Tables(0).Rows(0)
DocPropDialoglblProjName.Text = Session("CurrProjectName").ToString
DocPropDialoglblDisciplineName.Text = .Item("DisciplineName").ToString
DocPropDialogtxtBoxDocRefNo.Text = .Item("DocRefNo").ToString
DocPropDialogdtpDocDate.SelectedDate = CType(.Item("DocDate").ToString, Date)
DocPropDialogtxtBoxDocTitle.Text = .Item("DocTitle").ToString
DocPropDialoglblDocTypeName.Text = .Item("DocTypeName").ToString
DocPropDialoglblFileName.Text = .Item("FileName").ToString
DocPropDialoglblLastUpdatedDate.Text = CType(.Item("DocUpdatedDate").ToString, Date).ToString("dd/MM/yyyy")
DocPropDialoglblSubFolderPath.Text = .Item("DocSubFolderPath").ToString.Replace("/", "\")
DocPropDialoglblVersion.Text = .Item("Version").ToString
DocPropDialogrdConfidential.SelectedValue = .Item("Confidential").ToString()
DocPropDialogtxtBoxRemarks.Text = .Item("LetterRemarks").ToString
If String.IsNullOrEmpty(.Item("ProjAreaCode").ToString) = False Then
For Each dr As ListItem In DocPropDialogcmbProjArea.Items
If dr.Value = .Item("ProjAreaCode").ToString Then
dr.Selected = True
Exit For
End If
Next
End If
If String.IsNullOrEmpty(.Item("ProjWrkPackCode").ToString) = False Then
For Each dr As ListItem In DocPropDialogcmbProjWrkPack.Items
If dr.Value = .Item("ProjWrkPackCode").ToString Then
dr.Selected = True
Exit For
End If
Next
End If
End With
DocPropDialoglblConfirmation.Text = Nothing
DocPropDialogbtnSave.Visible = True
'Condition if User Is not Authorized
If isUserAuthorized = False Then
DocPropDialogvldtr.ErrorMessage = "*You are not authorized to edit the properties"
DocPropDialogvldtr.IsValid = False
DocPropDialogbtnSave.Enabled = False
Else
DocPropDialogvldtr.ErrorMessage = ""
DocPropDialogvldtr.IsValid = True
DocPropDialogbtnSave.Enabled = True
End If
DocPropDialog.Show()
ds.Dispose()
sqlcmd.Dispose()
Case "mnuContextGridSendEmailLink" 'Send Link
If Grid1.SelectedItemIndex < 0 Then
Return
End If
Dim DocId As String = Grid1.Items(Grid1.SelectedItemIndex).Cells(0).Value.ToString
Dim ProjectCode As String = Session("CurrProjectCode").ToString
Dim sqlcmd As New SqlCommand
Dim ds As DataSet
sqlcmd.Parameters.Clear()
sqlcmd.CommandType = CommandType.Text
sqlcmd.CommandText = "Select * from CurrentDocView where DocId = @DocId"
sqlcmd.Parameters.Add("@DocId", SqlDbType.Int).Value = DocId
ds = GetDataSetofSqlCommand(sqlcmd)
If ds.Tables.Count = 0 Then
Return
End If
If ds.Tables(0).Rows.Count = 0 Then
Return
End If
With ds.Tables(0).Rows(0)
EmailLinkDialoglblProjName.Text = Session("CurrProjectName").ToString
EmailLinkDialoglblDisciplineName.Text = .Item("DisciplineName").ToString
EmailLinkDialoglblDocRefNo.Text = .Item("DocRefNo").ToString
EmailLinkDialoglblDocTypeName.Text = .Item("DocTypeName").ToString
EmailLinkDialoglblFileName.Text = .Item("FileName").ToString
EmailLinkDialoglblLastUpdatedDate.Text = CType(.Item("DocUpdatedDate").ToString, Date).ToString("dd/MM/yyyy")
EmailLinkDialoglblSubFolderPath.Text = .Item("DocSubFolderPath").ToString.Replace("/", "\")
EmailLinkDialoglblVersion.Text = .Item("Version").ToString
End With
Dim dsusers As DataSet = New DataSet
EmailLinkDialogADListBox.ClearSelection()
FillEmailLinkDialogADDataset(dsusers)
EmailLinkDialogADListBox.DataSource = dsusers
EmailLinkDialogADListBox.DataMember = "dtusers"
EmailLinkDialogADListBox.DataTextField = "FullName"
EmailLinkDialogADListBox.DataValueField = "LoginName"
EmailLinkDialogADListBox.DataBind()
EmailLinkDialogEmailPnl.Visible = True
EmailLinkDialogtxtBoxBody.Text = Nothing
EmailLinkDialogtxtBoxSubject.Text = Nothing
EmailLinkDialogtxtBoxTo.Text = Nothing
EmailLinkDialoglblConfirmation.Visible = False
EmailLinkDialogvldtr.IsValid = True
EmailLinkDialog.Show()
ds.Dispose()
sqlcmd.Dispose()
Case "mnuContextGridRevisionHistory" 'Revision History
If Grid1.SelectedItemIndex < 0 Then
Return
End If
Dim DocId As String = Grid1.Items(Grid1.SelectedItemIndex).Cells(0).Value.ToString
Dim sqlcmd As New SqlCommand
Dim ds As DataSet
sqlcmd.Parameters.Clear()
sqlcmd.CommandType = CommandType.Text
sqlcmd.CommandText = "Select * from CurrentDocView where DocId = @DocId"
sqlcmd.Parameters.Add("@DocId", SqlDbType.Int).Value = DocId
ds = GetDataSetofSqlCommand(sqlcmd)
If ds.Tables.Count = 0 Then
Return
End If
If ds.Tables(0).Rows.Count = 0 Then
Return
End If
With ds.Tables(0).Rows(0)
RevisionHistoryDialoglblProjName.Text = Session("CurrProjectName").ToString
RevisionHistoryDialoglblDisciplineName.Text = .Item("DisciplineName").ToString
RevisionHistoryDialoglblDocRefNo.Text = .Item("DocRefNo").ToString
RevisionHistoryDialoglblDocTypeName.Text = .Item("DocTypeName").ToString
RevisionHistoryDialoglblFileName.Text = .Item("FileName").ToString
RevisionHistoryDialoglblLastUpdatedDate.Text = CType(.Item("DocUpdatedDate").ToString, Date).ToString("dd/MM/yyyy")
RevisionHistoryDialoglblSubFolderPath.Text = .Item("DocSubFolderPath").ToString.Replace("/", "\")
RevisionHistoryDialoglblVersion.Text = .Item("Version").ToString
End With
ds.Tables.Clear()
sqlcmd.Parameters.Clear()
sqlcmd.CommandType = CommandType.Text
sqlcmd.CommandText = "Select * from DocRevisionHistoryView where CurrentDocId = @DocId"
sqlcmd.Parameters.Add("@DocId", SqlDbType.Int).Value = DocId
ds = GetDataSetofSqlCommand(sqlcmd)
If ds.Tables.Count > 0 Then
RevisionHistoryGrid.DataSource = ds
RevisionHistoryGrid.DataBind()
RevisionHistoryDialog.Show()
Else
ErrorMsgBox.Show("View Revision History", "No Revision history found for this document!", Nothing, New EO.Web.MsgBoxButton("~/images/button_ok.gif"), New EO.Web.MsgBoxButton("~/images/blank.gif"))
End If
'
ds.Dispose()
sqlcmd.Dispose()
Case "mnuContextGridUploadRevision" 'Upload Revision
If Grid1.SelectedItemIndex < 0 Then
Return
End If
Dim DocId As String = Grid1.Items(Grid1.SelectedItemIndex).Cells(0).Value.ToString
Dim ProjectCode As String = Session("CurrProjectCode").ToString
Dim sqlcmd As New SqlCommand
sqlcmd.Connection = GetSqlConnection()
sqlcmd.CommandType = CommandType.StoredProcedure
sqlcmd.CommandText = "IsUserAuth2Rev"
sqlcmd.Parameters.Add("@WindowsLoginId", SqlDbType.VarChar).Value = Page.User.Identity.Name
sqlcmd.Parameters.Add("@ProjectCode", SqlDbType.VarChar).Value = ProjectCode
sqlcmd.Parameters.Add("@DocId", SqlDbType.Int).Value = DocId
sqlcmd.Parameters.Add("@IsAuth", SqlDbType.Bit).Direction = ParameterDirection.Output
Try
sqlcmd.Connection.Open()
sqlcmd.ExecuteNonQuery()
If sqlcmd.Parameters("@IsAuth").Value.ToString.ToLower = "false" Then
ErrorMsgBox.Show("Upload Revision Error", "You are not authorized to revise this document!", Nothing, New EO.Web.MsgBoxButton("~/images/button_ok.gif"), New EO.Web.MsgBoxButton("~/images/blank.gif"))
sqlcmd.Connection.Close()
Return
End If
Catch ex As Exception
Finally
sqlcmd.Connection.Close()
End Try
Dim ds As DataSet
sqlcmd.Parameters.Clear()
sqlcmd.CommandType = CommandType.Text
sqlcmd.CommandText = "Select * from CurrentDocView where DocId = @DocId"
sqlcmd.Parameters.Add("@DocId", SqlDbType.Int).Value = DocId
ds = GetDataSetofSqlCommand(sqlcmd)
If ds.Tables.Count = 0 Then
Return
End If
If ds.Tables(0).Rows.Count = 0 Then
Return
End If
With ds.Tables(0).Rows(0)
ReviseDocDialoglblProjName.Text = Session("CurrProjectName").ToString
ReviseDocDialoglblDisciplineName.Text = .Item("DisciplineName").ToString
ReviseDocDialoglblDocRefNo.Text = .Item("DocRefNo").ToString
ReviseDocDialoglblDocTypeName.Text = .Item("DocTypeName").ToString
ReviseDocDialoglblFileName.Text = .Item("FileName").ToString
ReviseDocDialoglblLastUpdatedDate.Text = CType(.Item("DocUpdatedDate").ToString, Date).ToString("dd/MM/yyyy")
ReviseDocDialoglblSubFolderPath.Text = .Item("DocSubFolderPath").ToString.Replace("/", "\")
ReviseDocDialoglblVersion.Text = .Item("Version").ToString
End With
ReviseDocDialoglblFinalMessage.Text = Nothing
ReviseDocDialogbtnSaveRevision.Visible = True
ReviseDocDialogFileUploader.ClearPostedFiles()
ReviseDocDialogFileUploader.Enabled = True
vldtr.IsValid = True
ReviseDocDialog.Show()
ds.Dispose()
sqlcmd.Dispose()
Case "mnuContextGridDeleteDoc" 'Delete a Document
If Grid1.SelectedItemIndex < 0 Then
Return
End If
Dim DocId As String = Grid1.Items(Grid1.SelectedItemIndex).Cells(0).Value.ToString
Dim ProjectCode As String = Session("CurrProjectCode").ToString
Dim sqlcmd As New SqlCommand
sqlcmd.Connection = GetSqlConnection()
sqlcmd.CommandType = CommandType.StoredProcedure
sqlcmd.CommandText = "IsUserAuth2Del"
sqlcmd.Parameters.Add("@WindowsLoginId", SqlDbType.VarChar).Value = Page.User.Identity.Name
sqlcmd.Parameters.Add("@ProjectCode", SqlDbType.VarChar).Value = ProjectCode
sqlcmd.Parameters.Add("@DocId", SqlDbType.Int).Value = DocId
sqlcmd.Parameters.Add("@IsAuth", SqlDbType.Bit).Direction = ParameterDirection.Output
Try
sqlcmd.Connection.Open()
sqlcmd.ExecuteNonQuery()
If sqlcmd.Parameters("@IsAuth").Value.ToString.ToLower = "false" Then
ErrorMsgBox.Show("Delete Document Error", "You are not authorized to delete this document!", Nothing, New EO.Web.MsgBoxButton("~/images/button_ok.gif"), New EO.Web.MsgBoxButton("~/images/blank.gif"))
sqlcmd.Connection.Close()
Return
End If
Catch ex As Exception
Finally
sqlcmd.Connection.Close()
End Try
Dim ds As DataSet
sqlcmd.Parameters.Clear()
sqlcmd.CommandType = CommandType.Text
sqlcmd.CommandText = "Select * from CurrentDocView where DocId = @DocId"
sqlcmd.Parameters.Add("@DocId", SqlDbType.Int).Value = DocId
ds = GetDataSetofSqlCommand(sqlcmd)
If ds.Tables.Count = 0 Then
Return
End If
If ds.Tables(0).Rows.Count = 0 Then
Return
End If
With ds.Tables(0).Rows(0)
DeleteDocDialoglblProjName.Text = Session("CurrProjectName").ToString
DeleteDocDialoglblDisciplineName.Text = .Item("DisciplineName").ToString
DeleteDocDialoglblDocRefNo.Text = .Item("DocRefNo").ToString
DeleteDocDialoglblDocTypeName.Text = .Item("DocTypeName").ToString
DeleteDocDialoglblFileName.Text = .Item("FileName").ToString
DeleteDocDialoglblLastUpdatedDate.Text = CType(.Item("DocUpdatedDate").ToString, Date).ToString("dd/MM/yyyy")
DeleteDocDialoglblSubFolderPath.Text = .Item("DocSubFolderPath").ToString.Replace("/", "\")
DeleteDocDialoglblVersion.Text = .Item("Version").ToString
End With
DeleteDocDialog.Show()
ds.Dispose()
sqlcmd.Dispose()
End Select
End Sub
#Region "Doc Properties"
Private Sub FillDocPropDialogCombo()
If IsNothing(Session("CurrProjectCode")) = False Then
Dim ds As DataSet
'ProjArea
DocPropDialogcmbProjArea.Items.Clear()
DocPropDialogcmbProjArea.Items.Add(New ListItem("", ""))
ds = GetDataSetofQuery("Select * from ProjArea where ProjectCode = '" & Session("CurrProjectCode").ToString() & "' order by ProjAreaName")
If ds.Tables.Count > 0 Then
For i = 0 To ds.Tables(0).Rows.Count - 1
DocPropDialogcmbProjArea.Items.Add(New ListItem(ds.Tables(0).Rows(i).Item("ProjAreaName").ToString, _
ds.Tables(0).Rows(i).Item("ProjAreaCode").ToString))
Next
End If
ds.Tables.Clear()
'ProjWrkPack
DocPropDialogcmbProjWrkPack.Items.Clear()
DocPropDialogcmbProjWrkPack.Items.Add(New ListItem("", ""))
ds = GetDataSetofQuery("Select * from ProjWrkPack order by ProjWrkPackName")
If ds.Tables.Count > 0 Then
For i = 0 To ds.Tables(0).Rows.Count - 1
DocPropDialogcmbProjWrkPack.Items.Add(New ListItem(ds.Tables(0).Rows(i).Item("ProjWrkPackName").ToString, _
ds.Tables(0).Rows(i).Item("ProjWrkPackCode").ToString))
Next
End If
ds.Tables.Clear()
ds.Dispose()
ds = Nothing
End If
End Sub
Private Sub DocPropDialogbtnSave_Click(ByVal sender As Object, ByVal e As EventArgs) Handles DocPropDialogbtnSave.Click
If Grid1.SelectedItemIndex < 0 Then
DocPropDialogvldtr.IsValid = False
DocPropDialogvldtr.ErrorMessage = "*No Document Selected from the Document Library!"
Return
End If
If String.IsNullOrEmpty(DocPropDialogtxtBoxDocRefNo.Text) = True Then
DocPropDialogvldtr.ErrorMessage = "*Document Ref No can not be empty"
DocPropDialogvldtr.IsValid = False
Return
End If
If DocPropDialogdtpDocDate.SelectedDate = #12:00:00 AM# Then
DocPropDialogvldtr.ErrorMessage = "*Document Date is mandatory"
DocPropDialogvldtr.IsValid = False
Return
End If
Dim sqlcmd As New SqlCommand
With sqlcmd
.Connection = GetSqlConnection()
.CommandType = CommandType.StoredProcedure
.CommandText = "UpdateDocProp"
.Parameters.Add("@DocId", SqlDbType.Int).Value = Grid1.Items(Grid1.SelectedItemIndex).Cells(0).Value
.Parameters.Add("@DocRefNo", SqlDbType.VarChar).Value = DocPropDialogtxtBoxDocRefNo.Text
.Parameters.Add("@DocDate", SqlDbType.DateTime).Value = DocPropDialogdtpDocDate.SelectedDate
.Parameters.Add("@DocTitle", SqlDbType.VarChar).Value = DocPropDialogtxtBoxDocTitle.Text
.Parameters.Add("@Confidential", SqlDbType.VarChar).Value = DocPropDialogrdConfidential.SelectedItem.Value
.Parameters.Add("@LetterRemarks", SqlDbType.VarChar).Value = DocPropDialogtxtBoxRemarks.Text
.Parameters.Add("@ProjAreaCode", SqlDbType.VarChar).Value = DBNull.Value
If String.IsNullOrEmpty(DocPropDialogcmbProjArea.SelectedItem.Value.ToString) = False Then .Parameters("@ProjAreaCode").Value = DocPropDialogcmbProjArea.SelectedItem.Value
.Parameters.Add("@ProjWrkPackCode", SqlDbType.VarChar).Value = DBNull.Value
If String.IsNullOrEmpty(DocPropDialogcmbProjWrkPack.SelectedItem.Value.ToString) = False Then .Parameters("@ProjWrkPackCode").Value = DocPropDialogcmbProjWrkPack.SelectedItem.Value
.Parameters.Add("@DocUpdatedBy", SqlDbType.VarChar).Value = Page.User.Identity.Name
Try
.Connection.Open()
'
.ExecuteNonQuery()
Add2Log(Page.User.Identity.Name, "UPDDOCPROP", Session("CurrProjectCode").ToString, Grid1.Items(Grid1.SelectedItemIndex).Cells(0).Value)
DocPropDialoglblConfirmation.Text = "Document properties saved successfully"
DocPropDialogbtnSave.Visible = False
Catch ex As Exception
DocPropDialogvldtr.ErrorMessage = ex.Message
DocPropDialogvldtr.IsValid = False
Finally
.Connection.Close()
End Try
End With
End Sub
Protected Sub DocPropDialogbtnClose_Click(ByVal sender As Object, ByVal e As EventArgs) Handles DocPropDialogbtnClose.Click
Dim a1 As String() = DocPropDialoglblSubFolderPath.Text.Replace("\", "/").Split("/")
FillGrid(a1(0).ToString(), DocPropDialoglblSubFolderPath.Text.Replace("\", "/"))
End Sub
#End Region
#Region "EmailLink"
Private Sub FillEmailLinkDialogADDataset(ByVal dsusers As DataSet)
Dim i As Integer = 0
Try
Dim sPath As String = ConfigurationManager.ConnectionStrings("ADConnectionString").ConnectionString
Dim entry As New DirectoryServices.DirectoryEntry(sPath)
Dim mySearcher As New System.DirectoryServices.DirectorySearcher(entry)
Dim result As System.DirectoryServices.SearchResult
Dim resultCol As System.DirectoryServices.SearchResultCollection
Dim so As New System.DirectoryServices.SortOption
so.Direction = SortDirection.Ascending
so.PropertyName = "DisplayName"
mySearcher.Sort = so
mySearcher.PropertiesToLoad.Add("samaccountname")
mySearcher.PropertiesToLoad.Add("DisplayName")
mySearcher.PropertiesToLoad.Add("title")
'
dsusers.Tables.Clear()
dsusers.Tables.Add("dtUsers")
dsusers.Tables(0).Columns.Add(New DataColumn("LoginName"))
dsusers.Tables(0).Columns.Add(New DataColumn("FullName"))
dsusers.Tables(0).Columns.Add(New DataColumn("title"))
dsusers.Tables(0).Columns.Add(New DataColumn("DropDownTextCol"))
Dim pk(0) As System.Data.DataColumn
pk(0) = dsusers.Tables(0).Columns("LoginName")
dsusers.Tables(0).PrimaryKey = pk
'
mySearcher.Filter = ("(&(objectClass=user)(objectCategory=person))")
mySearcher.PageSize = 1000
resultCol = mySearcher.FindAll()
If Not (resultCol Is DBNull.Value) Then
Dim row As DataRow
While i < resultCol.Count
result = resultCol(i)
row = dsusers.Tables(0).NewRow
'If (result.Properties.Contains("samaccountname")) And (result.Properties.Contains("DisplayName")) And _
' (result.Properties.Contains("title")) And (result.Properties.Contains("mail")) And _
'(result.Properties.Contains("description")) Then
If Not result.Properties("samaccountname").Count = 0 Then
row("LoginName") = result.Properties("samaccountname").Item(0).ToString()
End If
If Not result.Properties("DisplayName").Count = 0 Then
row("FullName") = result.Properties("DisplayName").Item(0).ToString()
End If
If Not result.Properties("title").Count = 0 Then
row("title") = result.Properties("title").Item(0).ToString()
End If
'If Not IsNothing(result.Properties("description").Item(0)) Then
row("DropDownTextCol") = row("FullName").ToString & " - " & row("title").ToString
dsusers.Tables(0).Rows.Add(row)
'End If
i += 1
End While
End If
Catch ex As Exception
' Response.Write(ex.Message)
End Try
End Sub
Private Sub EmailLinkDialogbtnSelectAD_Click(ByVal sender As Object, ByVal e As EventArgs) Handles EmailLinkDialogbtnSelectAD.Click
If EmailLinkDialogADListBox.SelectedIndex < 0 = True Then
Return
End If
If String.IsNullOrEmpty(EmailLinkDialogtxtBoxTo.Text) = True Then
EmailLinkDialogtxtBoxTo.Text = EmailLinkDialogADListBox.SelectedItem.Value
Else
EmailLinkDialogtxtBoxTo.Text += ", " & EmailLinkDialogADListBox.SelectedItem.Value
End If
End Sub
Private Sub EmailLinkDialogbtnSendEmail_Click(ByVal sender As Object, ByVal e As EventArgs) Handles EmailLinkDialogbtnSendEmail.Click
If Grid1.SelectedItemIndex < 0 Then
EmailLinkDialogvldtr.IsValid = False
EmailLinkDialogvldtr.ErrorMessage = "*No Document Selected from the Document Library!"
Return
End If
If String.IsNullOrEmpty(EmailLinkDialogtxtBoxTo.Text) = True Then
EmailLinkDialogvldtr.IsValid = False
EmailLinkDialogvldtr.ErrorMessage = "*No Receipent email found!"
Return
End If
Dim receivers As String = EmailLinkDialogtxtBoxTo.Text
Dim subject As String = EmailLinkDialogtxtBoxSubject.Text
Dim DocId As Integer = Grid1.Items(Grid1.SelectedItemIndex).Cells(0).Value
Dim Body As String = EmailLinkDialogtxtBoxBody.Text.Replace(vbCrLf, "<br />")
Body += "<br><a href='http://nmdc-edms:8080/DocumentFileShare/ShowFile.aspx?DocId=" & DocId.ToString & "'>Click here to open</a>"
If NewEmail(Page.User.Identity.Name, receivers, subject, Body) = True Then
EmailLinkDialogEmailPnl.Visible = False
EmailLinkDialoglblConfirmation.Text = "Email Sent Successfully"
EmailLinkDialoglblConfirmation.Visible = True
End If
End Sub
#End Region
#Region "Revision Procedures"
Protected Sub btnSaveRevision_Click(ByVal sender As Object, ByVal e As EventArgs) Handles ReviseDocDialogbtnSaveRevision.Click
If Grid1.SelectedItemIndex < 0 Then
vldtr.IsValid = False
vldtr.ErrorMessage = "*No Document Selected from the Document Library!"
Return
End If
If ReviseDocDialogFileUploader.PostedFiles.Length = 0 Then
vldtr.IsValid = False
vldtr.ErrorMessage = "*No file selected"
Return
End If
If ReviseDocDialogFileUploader.PostedFiles(0).ClientFileName <> ReviseDocDialoglblFileName.Text Then
If System.IO.File.Exists(Server.MapPath(ReviseDocDialoglblSubFolderPath.Text.Replace("\", "/")) & ReviseDocDialogFileUploader.PostedFiles(0).ClientFileName) Then
vldtr.IsValid = False
vldtr.ErrorMessage = "*Another document with same file name exist, can not overwrite it!"
Return
End If
End If
Dim sqltran As SqlTransaction
Dim sqlconn As SqlConnection = GetSqlConnection()
Dim sqlcmd As New SqlCommand
With sqlcmd
.Connection = sqlconn
.CommandType = CommandType.StoredProcedure
.CommandText = "ReviseDoc"
.Parameters.Add("@OldDocId", SqlDbType.Int).Value = Grid1.Items(Grid1.SelectedItemIndex).Cells(0).Value
.Parameters.Add("@NewFileName", SqlDbType.VarChar).Value = ReviseDocDialogFileUploader.PostedFiles(0).ClientFileName
.Parameters.Add("@NewFileType", SqlDbType.VarChar).Value = ReviseDocDialogFileUploader.PostedFiles(0).ContentType
.Parameters.Add("@NewFileSize", SqlDbType.Int).Value = ReviseDocDialogFileUploader.PostedFiles(0).Length
.Parameters.Add("@RevisedDocFileName", SqlDbType.VarChar).Value = Grid1.Items(Grid1.SelectedItemIndex).Cells(0).Value.ToString & "." & ReviseDocDialoglblFileName.Text.Substring(ReviseDocDialoglblFileName.Text.LastIndexOf(".") + 1)
.Parameters.Add("@UpdatedBy", SqlDbType.VarChar).Value = Page.User.Identity.Name
.Parameters.Add("@NewDocId", SqlDbType.Int).Direction = ParameterDirection.Output
Try
.Connection.Open()
sqltran = .Connection.BeginTransaction("SqlReviseDoc")
.Transaction = sqltran
.ExecuteNonQuery()
Dim NewDocId As Integer = .Parameters("@NewDocId").Value
Dim oldfileOldFullPath As String = "~/fileserver/" & Session("CurrProjectCode").ToString & "/current/" & _
ReviseDocDialoglblSubFolderPath.Text.Replace("\", "/") & "/" & ReviseDocDialoglblFileName.Text
Dim oldfileNewFullPath As String = "~/fileserver/" & Session("CurrProjectCode").ToString & "/revised/" & _
Grid1.Items(Grid1.SelectedItemIndex).Cells(0).Value & "." & ReviseDocDialoglblFileName.Text.Substring(ReviseDocDialoglblFileName.Text.LastIndexOf(".") + 1)
System.IO.File.Move(Server.MapPath(oldfileOldFullPath), Server.MapPath(oldfileNewFullPath))
Dim strFullFilePath As String = "~/fileserver/" & Session("CurrProjectCode").ToString & "/current/" & _
ReviseDocDialoglblSubFolderPath.Text.Replace("\", "/") & "/" & ReviseDocDialogFileUploader.PostedFiles(0).ClientFileName
System.IO.File.Copy(ReviseDocDialogFileUploader.PostedFiles(0).TempFileName, Server.MapPath(strFullFilePath))
.Transaction.Commit()
DocPage_Add2Log(Page.User.Identity.Name, "REVISE", Session("CurrProjectCode").ToString, NewDocId, Server.MapPath(strFullFilePath))
ReviseDocDialoglblFinalMessage.Text = "Document Revised Successfully"
ReviseDocDialogbtnSaveRevision.Visible = False
ReviseDocDialogFileUploader.Enabled = False
Catch ex As Exception
vldtr.IsValid = False
vldtr.ErrorMessage = ex.Message
If IsNothing(.Transaction) = False Then
.Transaction.Rollback()
End If
Finally
.Connection.Close()
End Try
End With
End Sub
Protected Sub ReviseDocDialogbtnCloseDialog_Click(ByVal sender As Object, ByVal e As EventArgs) Handles ReviseDocDialogbtnCloseDialog.Click
Dim a1 As String() = ReviseDocDialoglblSubFolderPath.Text.Replace("\", "/").Split("/")
FillGrid(a1(0).ToString(), ReviseDocDialoglblSubFolderPath.Text.Replace("\", "/"))
End Sub
#End Region
#Region "Delete Procedures"
Protected Sub btnDeleteDocYes_Click(ByVal sender As Object, ByVal e As EventArgs) Handles btnDeleteDocYes.Click
If Grid1.SelectedItemIndex < 0 Then
Return
End If
Dim sqltran As SqlTransaction
Dim sqlconn As SqlConnection = GetSqlConnection()
Dim sqlcmd As New SqlCommand
With sqlcmd
.Connection = sqlconn
.CommandType = CommandType.StoredProcedure
.CommandText = "DeleteDoc"
.Parameters.Add("@DocId", SqlDbType.Int).Value = Grid1.Items(Grid1.SelectedItemIndex).Cells(0).Value
.Parameters.Add("@DocFileName", SqlDbType.VarChar).Value = Grid1.Items(Grid1.SelectedItemIndex).Cells(0).Value.ToString & "." & DeleteDocDialoglblFileName.Text.Substring(DeleteDocDialoglblFileName.Text.LastIndexOf(".") + 1)
.Parameters.Add("@DeletedBy", SqlDbType.VarChar).Value = Page.User.Identity.Name
Try
.Connection.Open()
sqltran = .Connection.BeginTransaction("SqlDeleteDoc")
.Transaction = sqltran
.ExecuteNonQuery()
Dim oldfileOldFullPath As String = "~/fileserver/" & Session("CurrProjectCode").ToString & "/current/" & _
DeleteDocDialoglblSubFolderPath.Text.Replace("\", "/") & "/" & DeleteDocDialoglblFileName.Text
Dim oldfileNewFullPath As String = "~/fileserver/" & Session("CurrProjectCode").ToString & "/Deleted/" & _
Grid1.Items(Grid1.SelectedItemIndex).Cells(0).Value & "." & DeleteDocDialoglblFileName.Text.Substring(DeleteDocDialoglblFileName.Text.LastIndexOf(".") + 1)
System.IO.File.Move(Server.MapPath(oldfileOldFullPath), Server.MapPath(oldfileNewFullPath))
.Transaction.Commit()
Dim a1 As String() = DeleteDocDialoglblSubFolderPath.Text.Replace("\", "/").Split("/")
FillGrid(a1(0).ToString(), DeleteDocDialoglblSubFolderPath.Text.Replace("\", "/"))
Catch ex As Exception
If IsNothing(.Transaction) = False Then
.Transaction.Rollback()
End If
Finally
.Connection.Close()
sqlcmd.Dispose()
End Try
End With
End Sub
#End Region
End Class
|