diff --git a/GIM_data/WebGimUtils.cs b/GIM_data/WebGimUtils.cs
index 609a86e..4474a7f 100644
--- a/GIM_data/WebGimUtils.cs
+++ b/GIM_data/WebGimUtils.cs
@@ -65,5 +65,30 @@ public class WebGimUtils
return convDate(dataOra, formato, cultura, false);
}
public static WebGimUtils obj = new WebGimUtils();
+
+ ///
+ /// restituisce il filePath (reale) della dir dedicata ad un dato intervento...
+ ///
+ ///
+ ///
+ 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);
+ }
+
+ ///
+ /// Fornisce elenco dei files di un dato intervento di MTZ cercando su filesystem
+ ///
+ ///
+ ///
+ public static DataLayer_generic.filesDataTable elencoFiles(int numInt)
+ {
+ // in primis faccio controllo esistenza folder...
+ return fileMover.obj.elencoFilesDir(dirPathIntMtz(numInt));
+ }
}
\ No newline at end of file
diff --git a/GIM_data/bin/GIM_data.dll b/GIM_data/bin/GIM_data.dll
index 33b0aec..36f5cb5 100644
Binary files a/GIM_data/bin/GIM_data.dll and b/GIM_data/bin/GIM_data.dll differ
diff --git a/GIM_data/bin/SteamWare.dll b/GIM_data/bin/SteamWare.dll
index d39048d..c667178 100644
Binary files a/GIM_data/bin/SteamWare.dll and b/GIM_data/bin/SteamWare.dll differ
diff --git a/GIM_data/obj/Debug/GIM_data.csprojResolveAssemblyReference.cache b/GIM_data/obj/Debug/GIM_data.csprojResolveAssemblyReference.cache
index ab26c53..3117967 100644
Binary files a/GIM_data/obj/Debug/GIM_data.csprojResolveAssemblyReference.cache and b/GIM_data/obj/Debug/GIM_data.csprojResolveAssemblyReference.cache differ
diff --git a/GIM_site/Files/16000/16239/prova file.txt b/GIM_site/Files/16000/16239/prova file.txt
new file mode 100644
index 0000000..e69de29
diff --git a/GIM_site/Files/PlaceHolder.file b/GIM_site/Files/PlaceHolder.file
new file mode 100644
index 0000000..5f28270
--- /dev/null
+++ b/GIM_site/Files/PlaceHolder.file
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/GIM_site/GIM_site.csproj b/GIM_site/GIM_site.csproj
index 5327058..5363ae4 100644
--- a/GIM_site/GIM_site.csproj
+++ b/GIM_site/GIM_site.csproj
@@ -266,6 +266,7 @@
+
@@ -787,6 +788,7 @@
compilerconfig.json
+
@@ -1304,6 +1306,13 @@
mod_famiglieMacchine.ascx
+
+ mod_fileUpload.ascx
+ ASPXCodeBehind
+
+
+ mod_fileUpload.ascx
+
mod_filtraMtzProg.ascx
ASPXCodeBehind
@@ -1577,6 +1586,13 @@
mod_vocabolario.ascx
+
+ test.ascx
+ ASPXCodeBehind
+
+
+ test.ascx
+
@@ -1705,6 +1721,7 @@
+
diff --git a/GIM_site/WebUserControls/mod_dettInt_default.ascx b/GIM_site/WebUserControls/mod_dettInt_default.ascx
index c0a2000..58ac604 100644
--- a/GIM_site/WebUserControls/mod_dettInt_default.ascx
+++ b/GIM_site/WebUserControls/mod_dettInt_default.ascx
@@ -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" %>
+
@@ -73,13 +75,6 @@
- <%--
-
-
-
- --%>
@@ -117,78 +112,62 @@
-
-
- |
-
- |
-
-
- |
-
-
- |
-
-
- |
-
-
- |
-
-
- |
-
-
- |
-
- |
-
-
- |
-
-
- |
-
-
-
-
- |
-
-
- |
-
-
- |
-
-
- |
-
- |
-
-
-
- |
-
-
- |
-
- |
-
-
+
@@ -324,77 +303,61 @@
-
-
- |
-
- |
-
-
- |
-
-
- |
-
-
- |
-
-
- |
-
-
- |
-
-
-
- |
-
- |
-
-
- |
-
-
- |
-
-
-
-
- |
-
-
- |
-
-
- |
-
-
- |
-
- |
-
-
-
- |
-
-
- |
-
- |
-
-
+
diff --git a/GIM_site/WebUserControls/mod_dettInt_full.ascx b/GIM_site/WebUserControls/mod_dettInt_full.ascx
index 0d8724b..7f7681a 100644
--- a/GIM_site/WebUserControls/mod_dettInt_full.ascx
+++ b/GIM_site/WebUserControls/mod_dettInt_full.ascx
@@ -235,8 +235,7 @@
-
+
diff --git a/GIM_site/WebUserControls/mod_fileUpload.ascx b/GIM_site/WebUserControls/mod_fileUpload.ascx
new file mode 100644
index 0000000..bb29bb3
--- /dev/null
+++ b/GIM_site/WebUserControls/mod_fileUpload.ascx
@@ -0,0 +1,69 @@
+<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="mod_fileUpload.ascx.cs" Inherits="GIM_site.WebUserControls.mod_fileUpload" %>
+
+
+
+
<%: numAllegati %>Allegati
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/GIM_site/WebUserControls/mod_fileUpload.ascx.cs b/GIM_site/WebUserControls/mod_fileUpload.ascx.cs
new file mode 100644
index 0000000..5c09f49
--- /dev/null
+++ b/GIM_site/WebUserControls/mod_fileUpload.ascx.cs
@@ -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
+ {
+ ///
+ /// abilita modifica/cancellazione allegati
+ ///
+ public bool enableMod { get; set; }
+
+ public bool showOpenNewTab
+ {
+ get
+ {
+ return divOpenNew.Visible;
+ }
+ set
+ {
+ divOpenNew.Visible = value;
+ divNormal.Visible = !value;
+ }
+ }
+
+ ///
+ /// caricamento pagina
+ ///
+ ///
+ ///
+ 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();
+ }
+
+ ///
+ /// Num Int richiesto
+ ///
+ 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";
+ }
+ ///
+ /// fix visibilità controllo file upload
+ ///
+ /// mostra controlli add=true oppure nasconde = false
+ 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);
+ }
+
+ }
+}
\ No newline at end of file
diff --git a/GIM_site/WebUserControls/mod_fileUpload.ascx.designer.cs b/GIM_site/WebUserControls/mod_fileUpload.ascx.designer.cs
new file mode 100644
index 0000000..271c8dd
--- /dev/null
+++ b/GIM_site/WebUserControls/mod_fileUpload.ascx.designer.cs
@@ -0,0 +1,114 @@
+//------------------------------------------------------------------------------
+//
+// This code was generated by a tool.
+//
+// Changes to this file may cause incorrect behavior and will be lost if
+// the code is regenerated.
+//
+//------------------------------------------------------------------------------
+
+namespace GIM_site.WebUserControls {
+
+
+ public partial class mod_fileUpload {
+
+ ///
+ /// divOpenNew control.
+ ///
+ ///
+ /// Auto-generated field.
+ /// To modify move field declaration from designer file to code-behind file.
+ ///
+ protected global::System.Web.UI.HtmlControls.HtmlGenericControl divOpenNew;
+
+ ///
+ /// hlOpenNew control.
+ ///
+ ///
+ /// Auto-generated field.
+ /// To modify move field declaration from designer file to code-behind file.
+ ///
+ protected global::System.Web.UI.WebControls.HyperLink hlOpenNew;
+
+ ///
+ /// divNormal control.
+ ///
+ ///
+ /// Auto-generated field.
+ /// To modify move field declaration from designer file to code-behind file.
+ ///
+ protected global::System.Web.UI.HtmlControls.HtmlGenericControl divNormal;
+
+ ///
+ /// divNewEdit control.
+ ///
+ ///
+ /// Auto-generated field.
+ /// To modify move field declaration from designer file to code-behind file.
+ ///
+ protected global::System.Web.UI.HtmlControls.HtmlGenericControl divNewEdit;
+
+ ///
+ /// btnAdd control.
+ ///
+ ///
+ /// Auto-generated field.
+ /// To modify move field declaration from designer file to code-behind file.
+ ///
+ protected global::System.Web.UI.WebControls.Button btnAdd;
+
+ ///
+ /// btnCancel control.
+ ///
+ ///
+ /// Auto-generated field.
+ /// To modify move field declaration from designer file to code-behind file.
+ ///
+ protected global::System.Web.UI.WebControls.Button btnCancel;
+
+ ///
+ /// divFileUpl control.
+ ///
+ ///
+ /// Auto-generated field.
+ /// To modify move field declaration from designer file to code-behind file.
+ ///
+ protected global::System.Web.UI.HtmlControls.HtmlGenericControl divFileUpl;
+
+ ///
+ /// FileUpload1 control.
+ ///
+ ///
+ /// Auto-generated field.
+ /// To modify move field declaration from designer file to code-behind file.
+ ///
+ protected global::System.Web.UI.WebControls.FileUpload FileUpload1;
+
+ ///
+ /// btnUpload control.
+ ///
+ ///
+ /// Auto-generated field.
+ /// To modify move field declaration from designer file to code-behind file.
+ ///
+ protected global::System.Web.UI.WebControls.Button btnUpload;
+
+ ///
+ /// grView control.
+ ///
+ ///
+ /// Auto-generated field.
+ /// To modify move field declaration from designer file to code-behind file.
+ ///
+ protected global::System.Web.UI.WebControls.GridView grView;
+
+ ///
+ /// odsFile control.
+ ///
+ ///
+ /// Auto-generated field.
+ /// To modify move field declaration from designer file to code-behind file.
+ ///
+ protected global::System.Web.UI.WebControls.ObjectDataSource odsFile;
+ }
+}
diff --git a/GIM_site/WebUserControls/test.ascx b/GIM_site/WebUserControls/test.ascx
new file mode 100644
index 0000000..ce55a9b
--- /dev/null
+++ b/GIM_site/WebUserControls/test.ascx
@@ -0,0 +1 @@
+<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="test.ascx.cs" Inherits="GIM_site.WebUserControls.test" %>
diff --git a/GIM_site/WebUserControls/test.ascx.cs b/GIM_site/WebUserControls/test.ascx.cs
new file mode 100644
index 0000000..64acffc
--- /dev/null
+++ b/GIM_site/WebUserControls/test.ascx.cs
@@ -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)
+ {
+
+ }
+ }
+}
\ No newline at end of file
diff --git a/GIM_site/WebUserControls/test.ascx.designer.cs b/GIM_site/WebUserControls/test.ascx.designer.cs
new file mode 100644
index 0000000..90f8dc5
--- /dev/null
+++ b/GIM_site/WebUserControls/test.ascx.designer.cs
@@ -0,0 +1,17 @@
+//------------------------------------------------------------------------------
+//
+// This code was generated by a tool.
+//
+// Changes to this file may cause incorrect behavior and will be lost if
+// the code is regenerated.
+//
+//------------------------------------------------------------------------------
+
+namespace GIM_site.WebUserControls
+{
+
+
+ public partial class test
+ {
+ }
+}
diff --git a/GIM_site/bin/SteamWare.dll b/GIM_site/bin/SteamWare.dll
index d39048d..c667178 100644
Binary files a/GIM_site/bin/SteamWare.dll and b/GIM_site/bin/SteamWare.dll differ
diff --git a/GIM_site/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache b/GIM_site/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache
index 500a98d..ba59106 100644
Binary files a/GIM_site/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache and b/GIM_site/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache differ
diff --git a/GIM_site/obj/Debug/GIM_site.csprojResolveAssemblyReference.cache b/GIM_site/obj/Debug/GIM_site.csprojResolveAssemblyReference.cache
index a03a80c..3701f3f 100644
Binary files a/GIM_site/obj/Debug/GIM_site.csprojResolveAssemblyReference.cache and b/GIM_site/obj/Debug/GIM_site.csprojResolveAssemblyReference.cache differ
diff --git a/GimDB/bin/Output/GimDB.dacpac b/GimDB/bin/Output/GimDB.dacpac
index 6b7f0b2..a5039db 100644
Binary files a/GimDB/bin/Output/GimDB.dacpac and b/GimDB/bin/Output/GimDB.dacpac differ