primo inserimento BRUTALE componente gestione files allegati...

This commit is contained in:
Samuele E. Locatelli
2017-01-30 18:57:25 +01:00
parent 6050d9b84e
commit c876e8eb59
19 changed files with 552 additions and 152 deletions
+25
View File
@@ -65,5 +65,30 @@ public class WebGimUtils
return convDate(dataOra, formato, cultura, false);
}
public static WebGimUtils obj = new WebGimUtils();
/// <summary>
/// restituisce il filePath (reale) della dir dedicata ad un dato intervento...
/// </summary>
/// <param name="numInt"></param>
/// <returns></returns>
public static string dirPathIntMtz(int numInt)
{
// ipotesi: folder bilanciate andando a mettere MAX 1000 files x folder, quindi fodler 0 --> 0...999, 1000 --> 1000...1999, etc
int maxFiles = 1000;
int numDir = numInt / maxFiles;
string BaseDir = "Files";
return string.Format(@"{0}\{1}\{2}", BaseDir, numDir*maxFiles, numInt);
}
/// <summary>
/// Fornisce elenco dei files di un dato intervento di MTZ cercando su filesystem
/// </summary>
/// <param name="numInt"></param>
/// <returns></returns>
public static DataLayer_generic.filesDataTable elencoFiles(int numInt)
{
// in primis faccio controllo esistenza folder...
return fileMover.obj.elencoFilesDir(dirPathIntMtz(numInt));
}
}
Binary file not shown.
Binary file not shown.
+1
View File
@@ -0,0 +1 @@

+17
View File
@@ -266,6 +266,7 @@
<Content Include="Content\bootstrap-switch\bootstrap2\bootstrap-switch.min.css" />
<Content Include="Content\bootstrap-switch\bootstrap3\bootstrap-switch.css" />
<Content Include="Content\bootstrap-switch\bootstrap3\bootstrap-switch.min.css" />
<Content Include="WebUserControls\test.ascx" />
<None Include="bundleconfig.json" />
<None Include="Content\bootstrap-theme.less" />
<Content Include="Content\bootstrap-theme.css">
@@ -787,6 +788,7 @@
<DependentUpon>compilerconfig.json</DependentUpon>
</Content>
<Content Include="Content\Style.less" />
<Content Include="Files\PlaceHolder.file" />
<None Include="help\IT\images\._browser" />
<Content Include="imagecache\PlaceHolder.file" />
<None Include="Properties\PublishProfiles\Alumat_Winlab.pubxml" />
@@ -1304,6 +1306,13 @@
<Compile Include="WebUserControls\mod_famiglieMacchine.ascx.designer.cs">
<DependentUpon>mod_famiglieMacchine.ascx</DependentUpon>
</Compile>
<Compile Include="WebUserControls\mod_fileUpload.ascx.cs">
<DependentUpon>mod_fileUpload.ascx</DependentUpon>
<SubType>ASPXCodeBehind</SubType>
</Compile>
<Compile Include="WebUserControls\mod_fileUpload.ascx.designer.cs">
<DependentUpon>mod_fileUpload.ascx</DependentUpon>
</Compile>
<Compile Include="WebUserControls\mod_filtraMtzProg.ascx.cs">
<DependentUpon>mod_filtraMtzProg.ascx</DependentUpon>
<SubType>ASPXCodeBehind</SubType>
@@ -1577,6 +1586,13 @@
<Compile Include="WebUserControls\mod_vocabolario.ascx.designer.cs">
<DependentUpon>mod_vocabolario.ascx</DependentUpon>
</Compile>
<Compile Include="WebUserControls\test.ascx.cs">
<DependentUpon>test.ascx</DependentUpon>
<SubType>ASPXCodeBehind</SubType>
</Compile>
<Compile Include="WebUserControls\test.ascx.designer.cs">
<DependentUpon>test.ascx</DependentUpon>
</Compile>
</ItemGroup>
<ItemGroup>
<Content Include="images\mtzProg.png" />
@@ -1705,6 +1721,7 @@
<Content Include="WebUserControls\mod_elFamMacch.ascx" />
<Content Include="WebUserControls\mod_elMacch2Fam.ascx" />
<Content Include="WebUserControls\mod_famiglieMacchine.ascx" />
<Content Include="WebUserControls\mod_fileUpload.ascx" />
<Content Include="WebUserControls\mod_filtraMtzProg.ascx" />
<Content Include="WebUserControls\mod_filtro.ascx" />
<Content Include="WebUserControls\mod_fixCal.ascx" />
+113 -150
View File
@@ -6,6 +6,8 @@
<%@ Register Src="~/WebUserControls/mod_impiegoRisorse.ascx" TagPrefix="uc3" TagName="mod_impiegoRisorse" %>
<%@ Register Src="~/WebUserControls/mod_ricercaItem.ascx" TagPrefix="uc1" TagName="mod_ricercaItem" %>
<%@ Register Src="~/WebUserControls/mod_MovMag2Int.ascx" TagPrefix="uc1" TagName="mod_MovMag2Int" %>
<%@ Register Src="~/WebUserControls/mod_fileUpload.ascx" TagPrefix="uc1" TagName="mod_fileUpload" %>
<asp:FormView ID="frmView_default" runat="server" DataKeyNames="numIntMtz" DataSourceID="ods_default" Width="100%">
<ItemTemplate>
@@ -73,13 +75,6 @@
<br />
<asp:DropDownList ID="listMacchine" runat="server" AutoPostBack="True" DataSourceID="odsMacchine" DataTextField="label" DataValueField="value" Width="100%" BackColor="Silver" Font-Size="8pt" SelectedValue='<%# Eval("idxMacchina") %>' Enabled="false">
</asp:DropDownList>
<%--<asp:ObjectDataSource ID="odsMacchine" runat="server" OldValuesParameterFormatString="Original_{0}"
SelectMethod="getByConditio" TypeName="GIM_data.DS_utilityTableAdapters.v_selMacchineTableAdapter">
<SelectParameters>
<asp:ControlParameter ControlID="listImpianti" DefaultValue="0" Name="conditio" PropertyName="SelectedValue"
Type="Int32" />
</SelectParameters>
</asp:ObjectDataSource>--%>
<asp:ObjectDataSource ID="odsMacchine" runat="server" OldValuesParameterFormatString="Original_{0}" SelectMethod="getData" TypeName="GIM_data.DS_utilityTableAdapters.v_selMacchineTableAdapter"></asp:ObjectDataSource>
</div>
</div>
@@ -117,78 +112,62 @@
</div>
</div>
<div id="divDown" style="background-color: #FFFFFF; border-top: solid 2px orange; padding: 10px;">
<table>
<tr>
<td>
<asp:Label runat="server" ID="lblPresaInCarico" Text='<%# traduci("lblPresaInCarico") %>'
Font-Size="X-Small" />
</td>
<td>
<asp:Label runat="server" ID="lblInizioIntervento" Text='<%# traduci("lblInizioIntervento") %>'
Font-Size="X-Small" />
</td>
<td>
<asp:Label runat="server" ID="lblFineIntervento" Text='<%# traduci("lblFineIntervento") %>'
Font-Size="X-Small" />
</td>
<td>
<asp:Label runat="server" ID="lblDescrStato" Text='<%# traduci("lblDescrStato") %>'
Font-Size="X-Small" />
</td>
<td style="text-align: center;">
<asp:Label runat="server" ID="lblInterventi" Text='<%# traduci ("lblInterventi") %>'
Font-Size="X-Small"></asp:Label>
</td>
<td style="text-align: center;">
<asp:Label runat="server" ID="lblRisorse" Text='<%# traduci ("lblRisorse") %>' Font-Size="X-Small"></asp:Label>
</td>
</tr>
<tr>
<td>
<asp:TextBox ID="presaInCaricoLabel" runat="server" Text='<%# Eval("presaInCarico") %>'
CssClass="fixedVal" ReadOnly="true" />
</td>
<td>
<asp:TextBox ID="inizioInterventoLabel" runat="server" Text='<%# Eval("inizioIntervento") %>'
CssClass="fixedVal" ReadOnly="true" />
</td>
<td>
<asp:TextBox ID="fineInterventoLabel" runat="server" Text='<%# Eval("fineIntervento") %>'
CssClass="fixedVal" ReadOnly="true" />
</td>
<td>
<asp:DropDownList runat="server" ID="ddlStato" CssClass="fixedVal" SelectedValue='<%# Eval("idxStato") %>'
DataSourceID="odsStato" DataTextField="label" DataValueField="value" Enabled="false">
</asp:DropDownList>
<asp:ObjectDataSource ID="odsStato" runat="server" OldValuesParameterFormatString="Original_{0}"
SelectMethod="GetData" TypeName="GIM_data.DS_utilityTableAdapters.v_selStatoTableAdapter"></asp:ObjectDataSource>
</td>
<td rowspan="3" style="vertical-align: top; padding-left: 30px;">
<uc1:mod_interventoOpMtz ID="mod_interventoOpMtz0" runat="server" vistaModulo="selezione" />
</td>
<td rowspan="3" style="vertical-align: top; padding-left: 30px;">
<uc3:mod_impiegoRisorse ID="mod_impiegoRisorse0" runat="server" vistaModulo="selezione" />
</td>
</tr>
<tr>
<td colspan="2">
<asp:Label runat="server" ID="lblDescrGuasto" Text='<%# traduci ("lblDescrizioneGen") %>'
Font-Size="X-Small" />
</td>
<td>
<asp:Label runat="server" ID="lblIsPreventivabile" Text='<%# traduci("lblIsPreventivabile") %>'
Font-Size="X-Small" />
<asp:CheckBox ID="isPreventivabileCheckBox" runat="server" Checked='<%# Eval("isPreventivabile") %>'
Enabled="false" />
</td>
</tr>
<tr>
<td colspan="3">
<asp:TextBox ID="descrizioneInterventoLabel" runat="server" Text='<%# Eval("descrizioneIntervento") %>'
CssClass="fixedValLeft" ReadOnly="true" Height="100px" Width="500px" TextMode="MultiLine" />
</td>
</tr>
</table>
<div class="row">
<div class="col-sm-4">
<div class="row">
<div class="col-sm-4">
<asp:Label runat="server" ID="lblPresaInCarico" Text='<%# traduci("lblPresaInCarico") %>' Font-Size="X-Small" />
<br />
<asp:TextBox ID="presaInCaricoLabel" runat="server" Text='<%# Eval("presaInCarico") %>' CssClass="fixedVal" ReadOnly="true" />
</div>
<div class="col-sm-4">
<asp:Label runat="server" ID="lblInizioIntervento" Text='<%# traduci("lblInizioIntervento") %>' Font-Size="X-Small" />
<br />
<asp:TextBox ID="inizioInterventoLabel" runat="server" Text='<%# Eval("inizioIntervento") %>' CssClass="fixedVal" ReadOnly="true" />
</div>
<div class="col-sm-4">
<asp:Label runat="server" ID="lblFineIntervento" Text='<%# traduci("lblFineIntervento") %>' Font-Size="X-Small" />
<br />
<asp:TextBox ID="fineInterventoLabel" runat="server" Text='<%# Eval("fineIntervento") %>' CssClass="fixedVal" ReadOnly="true" />
</div>
</div>
<div class="row">
<div class="col-sm-6">
<asp:Label runat="server" ID="lblDescrGuasto" Text='<%# traduci ("lblDescrizioneGen") %>' Font-Size="X-Small" />
</div>
<div class="col-sm-6">
<asp:Label runat="server" ID="lblIsPreventivabile" Text='<%# traduci("lblIsPreventivabile") %>' Font-Size="X-Small" />
<asp:CheckBox ID="isPreventivabileCheckBox" runat="server" Checked='<%# Eval("isPreventivabile") %>' Enabled="false" />
</div>
<div class="col-sm-12">
<asp:TextBox ID="descrizioneInterventoLabel" runat="server" Text='<%# Eval("descrizioneIntervento") %>' CssClass="fixedValLeft" ReadOnly="true" Height="100px" Width="500px" TextMode="MultiLine" />
</div>
</div>
</div>
<div class="col-sm-4">
<div class="row">
<div class="col-sm-3">
<asp:Label runat="server" ID="lblDescrStato" Text='<%# traduci("lblDescrStato") %>' Font-Size="X-Small" />
<br />
<asp:DropDownList runat="server" ID="ddlStato" CssClass="fixedVal" SelectedValue='<%# Eval("idxStato") %>' DataSourceID="odsStato" DataTextField="label" DataValueField="value" Enabled="false">
</asp:DropDownList>
<asp:ObjectDataSource ID="odsStato" runat="server" OldValuesParameterFormatString="Original_{0}" SelectMethod="GetData" TypeName="GIM_data.DS_utilityTableAdapters.v_selStatoTableAdapter"></asp:ObjectDataSource>
</div>
<div class="col-sm-3">
<asp:Label runat="server" ID="lblInterventi" Text='<%# traduci ("lblInterventi") %>'
Font-Size="X-Small"></asp:Label>
<uc1:mod_interventoOpMtz ID="mod_interventoOpMtz0" runat="server" vistaModulo="selezione" />
</div>
<div class="col-sm-6">
<asp:Label runat="server" ID="lblRisorse" Text='<%# traduci ("lblRisorse") %>' Font-Size="X-Small"></asp:Label>
<uc3:mod_impiegoRisorse ID="mod_impiegoRisorse0" runat="server" vistaModulo="selezione" />
</div>
</div>
</div>
<div class="col-sm-4">
<uc1:mod_fileUpload runat="server" ID="mod_fileUpload" numIntMtz='<%# Eval("numIntMtz") %>' />
</div>
</div>
</div>
</div>
</ItemTemplate>
@@ -324,77 +303,61 @@
</div>
<div class="row">
<div id="divDown" class="col-xs-12" style="background-color: #FFFFFF; border-top: solid 2px orange; padding: 10px;">
<table>
<tr>
<td>
<asp:Label runat="server" ID="lblPresaInCarico" Text='<%# traduci("lblPresaInCarico") %>'
Font-Size="X-Small" />
</td>
<td>
<asp:Label runat="server" ID="lblInizioIntervento" Text='<%# traduci("lblInizioIntervento") %>'
Font-Size="X-Small" />
</td>
<td>
<asp:Label runat="server" ID="lblFineIntervento" Text='<%# traduci("lblFineIntervento") %>'
Font-Size="X-Small" />
</td>
<td>
<asp:Label runat="server" ID="lblDescrStato" Text='<%# traduci("lblDescrStato") %>'
Font-Size="X-Small" />
</td>
<td style="text-align: center;">
<asp:Label runat="server" ID="lblInterventi" Text='<%# traduci ("lblInterventi") %>' Font-Size="X-Small"></asp:Label>
</td>
<td style="text-align: center;">
<asp:Label runat="server" ID="lblRisorse" Text='<%# traduci ("lblRisorse") %>' Font-Size="X-Small"></asp:Label>
</td>
</tr>
<tr>
<td>
<asp:TextBox ID="presaInCaricoLabel" runat="server" Text='<%# Eval("presaInCarico") %>' CssClass="textEv_Read" ReadOnly="true" />
</td>
<td>
<uc2:mod_dataOra ID="mod_dataOra2" runat="server" valore='<%# Bind("inizioIntervento") %>'
css="textEv_1" tipoOrario="tendina" mostraLabel="false" />
</td>
<td>
<uc2:mod_dataOra ID="mod_dataOra3" runat="server" valore='<%# Bind("fineIntervento") %>'
css="textEv_1" tipoOrario="tendina" mostraLabel="false" />
</td>
<td>
<asp:DropDownList runat="server" ID="ddlStato" CssClass="textEv_1" SelectedValue='<%# Bind("idxStato") %>'
DataSourceID="odsStato" DataTextField="label" DataValueField="value">
</asp:DropDownList>
<asp:ObjectDataSource ID="odsStato" runat="server" OldValuesParameterFormatString="Original_{0}"
SelectMethod="GetData" TypeName="GIM_data.DS_utilityTableAdapters.v_selStatoTableAdapter"></asp:ObjectDataSource>
</td>
<td rowspan="3" style="vertical-align: top; padding-left: 30px;">
<uc1:mod_interventoOpMtz ID="mod_interventoOpMtz1" runat="server" vistaModulo="editing" />
</td>
<td rowspan="3" style="vertical-align: top; padding-left: 30px;">
<uc3:mod_impiegoRisorse runat="server" ID="mod_impiegoRisorse1" vistaModulo="editing" />
</td>
</tr>
<tr>
<td colspan="2">
<asp:Label runat="server" ID="lblDescrGuasto" Text='<%# traduci ("lblDescrizioneGen") %>'
Font-Size="X-Small" />
</td>
<td>
<asp:Label runat="server" ID="lblIsPreventivabile" Text='<%# traduci("lblIsPreventivabile") %>'
Font-Size="X-Small" />
<asp:CheckBox ID="isPreventivabileCheckBox" runat="server" Checked='<%# Bind("isPreventivabile") %>'
Enabled="true" />
</td>
</tr>
<tr>
<td colspan="3">
<asp:TextBox ID="descrizioneInterventoLabel" runat="server" Text='<%# Bind("descrizioneIntervento") %>'
Height="100px" Width="500px" CssClass="textEv_1Left" TextMode="MultiLine" />
</td>
</tr>
</table>
<div class="row">
<div class="col-sm-4">
<div class="row">
<div class="col-sm-4">
<asp:Label runat="server" ID="lblPresaInCarico" Text='<%# traduci("lblPresaInCarico") %>' Font-Size="X-Small" />
<br />
<asp:TextBox ID="presaInCaricoLabel" runat="server" Text='<%# Eval("presaInCarico") %>' CssClass="textEv_Read" ReadOnly="true" />
</div>
<div class="col-sm-4">
<asp:Label runat="server" ID="lblInizioIntervento" Text='<%# traduci("lblInizioIntervento") %>' Font-Size="X-Small" />
<br />
<uc2:mod_dataOra ID="mod_dataOra2" runat="server" valore='<%# Bind("inizioIntervento") %>' css="textEv_1" tipoOrario="tendina" mostraLabel="false" />
</div>
<div class="col-sm-4">
<asp:Label runat="server" ID="lblFineIntervento" Text='<%# traduci("lblFineIntervento") %>' Font-Size="X-Small" />
<br />
<uc2:mod_dataOra ID="mod_dataOra3" runat="server" valore='<%# Bind("fineIntervento") %>' css="textEv_1" tipoOrario="tendina" mostraLabel="false" />
</div>
</div>
<div class="row">
<div class="col-sm-6">
<asp:Label runat="server" ID="lblDescrGuasto" Text='<%# traduci ("lblDescrizioneGen") %>' Font-Size="X-Small" />
</div>
<div class="col-sm-6">
<asp:Label runat="server" ID="lblIsPreventivabile" Text='<%# traduci("lblIsPreventivabile") %>' Font-Size="X-Small" />
<asp:CheckBox ID="isPreventivabileCheckBox" runat="server" Checked='<%# Bind("isPreventivabile") %>' Enabled="true" />
</div>
<div class="col-sm-12">
<asp:TextBox ID="descrizioneInterventoLabel" runat="server" Text='<%# Bind("descrizioneIntervento") %>' Height="100px" Width="500px" CssClass="textEv_1Left" TextMode="MultiLine" />
</div>
</div>
</div>
<div class="col-sm-4">
<div class="row">
<div class="col-sm-3">
<asp:Label runat="server" ID="lblDescrStato" Text='<%# traduci("lblDescrStato") %>' Font-Size="X-Small" />
<br />
<asp:DropDownList runat="server" ID="ddlStato" CssClass="textEv_1" SelectedValue='<%# Bind("idxStato") %>' DataSourceID="odsStato" DataTextField="label" DataValueField="value">
</asp:DropDownList>
<asp:ObjectDataSource ID="odsStato" runat="server" OldValuesParameterFormatString="Original_{0}" SelectMethod="GetData" TypeName="GIM_data.DS_utilityTableAdapters.v_selStatoTableAdapter"></asp:ObjectDataSource>
</div>
<div class="col-sm-3">
<asp:Label runat="server" ID="lblInterventi" Text='<%# traduci ("lblInterventi") %>' Font-Size="X-Small"></asp:Label>
<uc1:mod_interventoOpMtz ID="mod_interventoOpMtz1" runat="server" vistaModulo="editing" />
</div>
<div class="col-sm-6">
<asp:Label runat="server" ID="lblRisorse" Text='<%# traduci ("lblRisorse") %>' Font-Size="X-Small"></asp:Label>
<uc3:mod_impiegoRisorse runat="server" ID="mod_impiegoRisorse1" vistaModulo="editing" />
</div>
</div>
</div>
<div class="col-sm-4">
FILE UPLOAD
</div>
</div>
</div>
</div>
</div>
@@ -235,8 +235,7 @@
<asp:Parameter Name="presaInCarico" Type="DateTime" />
</UpdateParameters>
<SelectParameters>
<asp:SessionParameter DefaultValue="0" Name="numIntMtz" SessionField="numIntMtz_sel"
Type="Int32" />
<asp:SessionParameter DefaultValue="0" Name="numIntMtz" SessionField="numIntMtz_sel" Type="Int32" />
</SelectParameters>
</asp:ObjectDataSource>
<asp:ObjectDataSource ID="odsAmbiti" runat="server" OldValuesParameterFormatString="Original_{0}" SelectMethod="GetData" TypeName="GIM_data.DS_utilityTableAdapters.v_selAmbitiTableAdapter"></asp:ObjectDataSource>
@@ -0,0 +1,69 @@
<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="mod_fileUpload.ascx.cs" Inherits="GIM_site.WebUserControls.mod_fileUpload" %>
<div runat="server" id="divOpenNew" class="bg-info" style="text-align: center; margin: auto; font-size:2.5em;">
<b><asp:HyperLink runat="server" ID="hlOpenNew" NavigateUrl="~/showFile" Target="_blank"><%: numAllegati %>Allegati</asp:HyperLink></b>
</div>
<div runat="server" id="divNormal">
<div id="divNewEdit" runat="server">
<asp:Button ID="btnAdd" runat="server" Text="Nuovo Allegato" OnClick="btnAdd_Click" Enabled='<%# enableMod %>' />
<asp:Button ID="btnCancel" runat="server" Text="Annulla" OnClick="btnCancel_Click" />
</div>
<div id="divFileUpl" runat="server">
<div style="width: 100%;">
<asp:FileUpload ID="FileUpload1" runat="server" />
</div>
<div style="width: 100%;">
<asp:Button ID="btnUpload" runat="server" Text="Upload" OnClick="Upload" data-theme="b" />
</div>
</div>
<asp:GridView ID="grView" runat="server" Width="100%" AutoGenerateColumns="False" DataSourceID="odsFile" DataKeyNames="Nome" OnSelectedIndexChanged="grView_SelectedIndexChanged">
<EditRowStyle BackColor="#2461BF" />
<FooterStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
<HeaderStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
<PagerStyle BackColor="#2461BF" ForeColor="White" HorizontalAlign="Center" />
<RowStyle BackColor="#EFF3FB" HorizontalAlign="Left" />
<SelectedRowStyle BackColor="#D1DDF1" Font-Bold="True" ForeColor="#333333" />
<SortedAscendingCellStyle BackColor="#F5F7FB" />
<SortedAscendingHeaderStyle BackColor="#6D95E1" />
<SortedDescendingCellStyle BackColor="#E9EBEF" />
<SortedDescendingHeaderStyle BackColor="#4870BE" />
<AlternatingRowStyle BackColor="White" />
<Columns>
<asp:TemplateField HeaderText="Documento">
<EditItemTemplate>
<asp:TextBox ID="TextBox1" runat="server" Text='<%# Bind("Nome") %>'></asp:TextBox>
</EditItemTemplate>
<ItemTemplate>
<div>
<asp:LinkButton ID="lnkDownload" runat="server" OnClick="DownloadFile" CommandArgument='<%# Eval("Nome") %>'>
<asp:Label ID="Label1" runat="server" Text='<%# Eval("Nome") %>' />
</asp:LinkButton>
</div>
<div>
<asp:Label CssClass="flLeft" ID="lblDataMod" runat="server" Text='<%# Eval("dataCreaz","{0:yyyy-MM-dd HH:mm}") %>' Font-Size="0.7em" />
<asp:Label CssClass="flRight" ID="lblSize" runat="server" Text='<%# Eval("size","{0:N0} kb") %>' Font-Size="0.8em" />
</div>
</ItemTemplate>
<ItemStyle HorizontalAlign="Left" />
</asp:TemplateField>
<asp:TemplateField ItemStyle-HorizontalAlign="right">
<ItemTemplate>
<div id="Div1" runat="server" visible='<%# isWriteEnabled %>'>
<asp:LinkButton ID="lnkSelect" runat="server" CausesValidation="False" CommandName="Select" Text="Select" CssClass="ui-btn ui-shadow ui-corner-all ui-icon-edit ui-btn-icon-notext ui-btn-inline" ToolTip="Modifica" Visible='<%# enableMod %>' />
<asp:LinkButton ID="lnkDelete" runat="server" CausesValidation="False" CommandName="Delete" Text="Delete" CssClass="ui-btn ui-shadow ui-corner-all ui-icon-delete ui-btn-icon-notext ui-btn-inline" ToolTip="Elimina" OnClientClick="return confirm('Sei sicuro di voler eliminare il file?')" Visible='<%# enableMod %>' />
</div>
</ItemTemplate>
<ItemStyle HorizontalAlign="Center"></ItemStyle>
</asp:TemplateField>
</Columns>
</asp:GridView>
<asp:ObjectDataSource ID="odsFile" runat="server" OldValuesParameterFormatString="original_{0}" SelectMethod="elencoFiles" TypeName="WebGimUtils">
<SelectParameters>
<asp:SessionParameter DefaultValue="0" Name="numInt" SessionField="numIntMtz_sel" Type="Int32" />
</SelectParameters>
</asp:ObjectDataSource>
</div>
@@ -0,0 +1,177 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.IO;
using System.Data;
using System.Data.SqlClient;
using System.Configuration;
using GIM_data;
using System.Text;
using SteamWare;
namespace GIM_site.WebUserControls
{
public partial class mod_fileUpload : SteamWare.UserControl
{
/// <summary>
/// abilita modifica/cancellazione allegati
/// </summary>
public bool enableMod { get; set; }
public bool showOpenNewTab
{
get
{
return divOpenNew.Visible;
}
set
{
divOpenNew.Visible = value;
divNormal.Visible = !value;
}
}
/// <summary>
/// caricamento pagina
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
hlOpenNew.NavigateUrl = string.Format("~/Allegati?numIntMtz={0}", numIntMtz);
fisVisFU(false);
grView.DataBind();
}
divNewEdit.Visible = isWriteEnabled;
btnAdd.DataBind();
}
/// <summary>
/// Num Int richiesto
/// </summary>
public int numIntMtz { get; set; }
public void doUpdate()
{
grView.DataBind();
}
public int numAllegati
{
get
{
int answ = 0;
try
{
//answ = DtProxy.man.taFile.getByImpegno(numIntMtz).Rows.Count;
answ = WebGimUtils.elencoFiles(numIntMtz).Count;
}
catch
{ }
return answ;
}
}
protected void Upload(object sender, EventArgs e)
{
string filename = Path.GetFileName(FileUpload1.PostedFile.FileName);
string contentType = FileUpload1.PostedFile.ContentType;
int idxImpegno = memLayer.ML.QSI("idxImpegno");
using (Stream fs = FileUpload1.PostedFile.InputStream)
{
using (BinaryReader br = new BinaryReader(fs))
{
byte[] bytes = br.ReadBytes((Int32)fs.Length);
// PROCEDO SOLO SE HO UN FILE!!!! ovvero bytes <> null
if (bytes.Length > 0)
{
fileMover.obj.setDirectoryMapPath(WebGimUtils.dirPathIntMtz(numIntMtz));
// controllo se sia caricamento o update...
if (grView.SelectedIndex != -1)
{
try
{
fileMover.obj.eliminaFile(filename);
fileMover.obj.salvaFileBuffer(filename, bytes);
//int orig_idxFile = Convert.ToInt32(grView.SelectedValue);
//DtProxy.man.taFile.UpdateQuery(idxImpegno, 0, filename, contentType, bytes, orig_idxFile);
}
catch
{ }
}
else
{
fileMover.obj.salvaFileBuffer(filename, bytes);
//DtProxy.man.taFile.InsertQuery(idxImpegno, 0, filename, contentType, bytes);
}
}
}
}
Response.Redirect(Request.Url.AbsoluteUri);
}
protected void DownloadFile(object sender, EventArgs e)
{
byte[] bytes;
string fileName, contentType;
//int idxFile = int.Parse((sender as LinkButton).CommandArgument);
//DS_Utility.tblFilesRow fileRow = DtProxy.man.taFile.getByKey(idxFile)[0];
//bytes = fileRow.Data;
//contentType = fileRow.ContentType;
//fileName = fileRow.FileName;
fileName = ((sender as LinkButton).CommandArgument);
bytes = fileMover.obj.scaricaFile(fileName);
contentType = MimeMapping.GetMimeMapping(fileName);
Response.Clear();
Response.Buffer = true;
Response.Charset = "";
Response.Cache.SetCacheability(HttpCacheability.NoCache);
Response.ContentType = contentType;
Response.AppendHeader("Content-Disposition", "attachment; filename=" + fileName);
Response.BinaryWrite(bytes);
Response.Flush();
Response.End();
}
protected void grView_SelectedIndexChanged(object sender, EventArgs e)
{
// mostro controllo x edit...
fisVisFU(true);
btnUpload.Text = "Sostituisci File";
}
protected void btnAdd_Click(object sender, EventArgs e)
{
fisVisFU(true);
btnUpload.Text = "Carica Nuovo File";
}
/// <summary>
/// fix visibilità controllo file upload
/// </summary>
/// <param name="showAdd">mostra controlli add=true oppure nasconde = false</param>
private void fisVisFU(bool showAdd)
{
divFileUpl.Visible = showAdd;
btnAdd.Visible = !showAdd;
btnCancel.Visible = showAdd;
if (grView.SelectedIndex != -1 && !showAdd)
{
grView.SelectedIndex = -1;
}
}
protected void btnCancel_Click(object sender, EventArgs e)
{
fisVisFU(false);
}
}
}
+114
View File
@@ -0,0 +1,114 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace GIM_site.WebUserControls {
public partial class mod_fileUpload {
/// <summary>
/// divOpenNew control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.HtmlControls.HtmlGenericControl divOpenNew;
/// <summary>
/// hlOpenNew control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.HyperLink hlOpenNew;
/// <summary>
/// divNormal control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.HtmlControls.HtmlGenericControl divNormal;
/// <summary>
/// divNewEdit control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.HtmlControls.HtmlGenericControl divNewEdit;
/// <summary>
/// btnAdd control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.Button btnAdd;
/// <summary>
/// btnCancel control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.Button btnCancel;
/// <summary>
/// divFileUpl control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.HtmlControls.HtmlGenericControl divFileUpl;
/// <summary>
/// FileUpload1 control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.FileUpload FileUpload1;
/// <summary>
/// btnUpload control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.Button btnUpload;
/// <summary>
/// grView control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.GridView grView;
/// <summary>
/// odsFile control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.ObjectDataSource odsFile;
}
}
+1
View File
@@ -0,0 +1 @@
<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="test.ascx.cs" Inherits="GIM_site.WebUserControls.test" %>
+17
View File
@@ -0,0 +1,17 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
namespace GIM_site.WebUserControls
{
public partial class test : System.Web.UI.UserControl
{
protected void Page_Load(object sender, EventArgs e)
{
}
}
}
+17
View File
@@ -0,0 +1,17 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace GIM_site.WebUserControls
{
public partial class test
{
}
}
Binary file not shown.
Binary file not shown.