-
-
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/ScheMe-PIC/WebUserControls/mod_fileUpload.ascx.cs b/ScheMe-PIC/WebUserControls/mod_fileUpload.ascx.cs
index 7266fa9..49d850b 100644
--- a/ScheMe-PIC/WebUserControls/mod_fileUpload.ascx.cs
+++ b/ScheMe-PIC/WebUserControls/mod_fileUpload.ascx.cs
@@ -14,99 +14,102 @@ using SteamWare;
namespace ScheMe.WebUserControls
{
- public partial class mod_fileUpload : SteamWare.UserControl
+ public partial class mod_fileUpload : SteamWare.UserControl
+ {
+ protected void Page_Load(object sender, EventArgs e)
{
- protected void Page_Load(object sender, EventArgs e)
- {
- if (!IsPostBack)
- {
- fisVisFU(false);
- grView.DataBind();
- }
- divNewEdit.Visible = isWriteEnabled;
- }
- protected void Upload(object sender, EventArgs e)
- {
- string filename = Path.GetFileName(FileUpload1.PostedFile.FileName);
- string contentType = FileUpload1.PostedFile.ContentType;
- string gruppo = memLayer.ML.StringSessionObj("Gruppo");
- int idxPaziente = memLayer.ML.IntSessionObj("IdxPaziente");
- using (Stream fs = FileUpload1.PostedFile.InputStream)
- {
- using (BinaryReader br = new BinaryReader(fs))
- {
- byte[] bytes = br.ReadBytes((Int32)fs.Length);
- // controllo se sia caricamento o update...
- if (grView.SelectedIndex != -1)
- {
- try
- {
- int orig_idxFile = Convert.ToInt32(grView.SelectedValue);
- DtProxy.man.taFile.UpdateQuery(gruppo, idxPaziente, filename, contentType, bytes, orig_idxFile);
- }
- catch
- { }
- }
- else
- {
- DtProxy.man.taFile.InsertQuery(gruppo, idxPaziente, filename, contentType, bytes);
- }
- }
- }
- Response.Redirect(Request.Url.AbsoluteUri);
- }
-
- protected void DownloadFile(object sender, EventArgs e)
- {
- int idxFile = int.Parse((sender as LinkButton).CommandArgument);
- byte[] bytes;
- string fileName, contentType;
- ScheMe_Data.DS_Utility.tblFilesRow fileRow = DtProxy.man.taFile.getByKey(idxFile)[0];
- bytes = fileRow.Data;
- contentType = fileRow.ContentType;
- fileName = fileRow.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 = "Aggiorna File";
- }
-
- protected void btnAdd_Click(object sender, EventArgs e)
- {
- fisVisFU(true);
- btnUpload.Text = "Carica Nuovo";
- }
- ///
- /// 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);
- }
-
+ if (!IsPostBack)
+ {
+ fisVisFU(false);
+ grView.DataBind();
+ }
+ divNewEdit.Visible = isWriteEnabled || true;
}
+ protected void Upload(object sender, EventArgs e)
+ {
+ if (FileUpload1.PostedFile != null)
+ {
+ string filename = Path.GetFileName(FileUpload1.PostedFile.FileName);
+ string contentType = FileUpload1.PostedFile.ContentType;
+ string gruppo = memLayer.ML.StringSessionObj("Gruppo");
+ int idxPaziente = memLayer.ML.IntSessionObj("IdxPaziente");
+ using (Stream fs = FileUpload1.PostedFile.InputStream)
+ {
+ using (BinaryReader br = new BinaryReader(fs))
+ {
+ byte[] bytes = br.ReadBytes((Int32)fs.Length);
+ // controllo se sia caricamento o update...
+ if (grView.SelectedIndex != -1)
+ {
+ try
+ {
+ int orig_idxFile = Convert.ToInt32(grView.SelectedValue);
+ DtProxy.man.taFile.UpdateQuery(gruppo, idxPaziente, filename, contentType, bytes, orig_idxFile);
+ }
+ catch
+ { }
+ }
+ else
+ {
+ DtProxy.man.taFile.InsertQuery(gruppo, idxPaziente, filename, contentType, bytes);
+ }
+ }
+ }
+ }
+ Response.Redirect(Request.Url.AbsoluteUri);
+ }
+
+ protected void DownloadFile(object sender, EventArgs e)
+ {
+ int idxFile = int.Parse((sender as LinkButton).CommandArgument);
+ byte[] bytes;
+ string fileName, contentType;
+ ScheMe_Data.DS_Utility.tblFilesRow fileRow = DtProxy.man.taFile.getByKey(idxFile)[0];
+ bytes = fileRow.Data;
+ contentType = fileRow.ContentType;
+ fileName = fileRow.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 = "Aggiorna File";
+ }
+
+ protected void btnAdd_Click(object sender, EventArgs e)
+ {
+ fisVisFU(true);
+ btnUpload.Text = "Carica Nuovo";
+ }
+ ///
+ /// 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/ScheMe-PIC/WebUserControls/mod_fileUpload.ascx.designer.cs b/ScheMe-PIC/WebUserControls/mod_fileUpload.ascx.designer.cs
index a9df4cd..2e68ba9 100644
--- a/ScheMe-PIC/WebUserControls/mod_fileUpload.ascx.designer.cs
+++ b/ScheMe-PIC/WebUserControls/mod_fileUpload.ascx.designer.cs
@@ -1,10 +1,10 @@
//------------------------------------------------------------------------------
-//
-// This code was generated by a tool.
+//
+// Codice generato da uno strumento.
//
-// Changes to this file may cause incorrect behavior and will be lost if
-// the code is regenerated.
-//
+// Le modifiche a questo file possono causare un comportamento non corretto e verranno perse se
+// il codice viene rigenerato.
+//
//------------------------------------------------------------------------------
namespace ScheMe.WebUserControls {
@@ -13,74 +13,74 @@ namespace ScheMe.WebUserControls {
public partial class mod_fileUpload {
///
- /// divNewEdit control.
+ /// Controllo divFileUpl.
///
///
- /// 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.
+ /// Campo generato automaticamente.
+ /// Per la modifica, spostare la dichiarazione di campo dal file di progettazione al file code-behind.
///
protected global::System.Web.UI.HtmlControls.HtmlGenericControl divFileUpl;
///
- /// FileUpload1 control.
+ /// Controllo btnCancel.
///
///
- /// Auto-generated field.
- /// To modify move field declaration from designer file to code-behind file.
+ /// Campo generato automaticamente.
+ /// Per la modifica, spostare la dichiarazione di campo dal file di progettazione al file code-behind.
+ ///
+ protected global::System.Web.UI.WebControls.Button btnCancel;
+
+ ///
+ /// Controllo FileUpload1.
+ ///
+ ///
+ /// Campo generato automaticamente.
+ /// Per la modifica, spostare la dichiarazione di campo dal file di progettazione al file code-behind.
///
protected global::System.Web.UI.WebControls.FileUpload FileUpload1;
///
- /// btnUpload control.
+ /// Controllo btnUpload.
///
///
- /// Auto-generated field.
- /// To modify move field declaration from designer file to code-behind file.
+ /// Campo generato automaticamente.
+ /// Per la modifica, spostare la dichiarazione di campo dal file di progettazione al file code-behind.
///
protected global::System.Web.UI.WebControls.Button btnUpload;
///
- /// grView control.
+ /// Controllo divNewEdit.
///
///
- /// Auto-generated field.
- /// To modify move field declaration from designer file to code-behind file.
+ /// Campo generato automaticamente.
+ /// Per la modifica, spostare la dichiarazione di campo dal file di progettazione al file code-behind.
+ ///
+ protected global::System.Web.UI.HtmlControls.HtmlGenericControl divNewEdit;
+
+ ///
+ /// Controllo btnAdd.
+ ///
+ ///
+ /// Campo generato automaticamente.
+ /// Per la modifica, spostare la dichiarazione di campo dal file di progettazione al file code-behind.
+ ///
+ protected global::System.Web.UI.WebControls.Button btnAdd;
+
+ ///
+ /// Controllo grView.
+ ///
+ ///
+ /// Campo generato automaticamente.
+ /// Per la modifica, spostare la dichiarazione di campo dal file di progettazione al file code-behind.
///
protected global::System.Web.UI.WebControls.GridView grView;
///
- /// odsFile control.
+ /// Controllo odsFile.
///
///
- /// Auto-generated field.
- /// To modify move field declaration from designer file to code-behind file.
+ /// Campo generato automaticamente.
+ /// Per la modifica, spostare la dichiarazione di campo dal file di progettazione al file code-behind.
///
protected global::System.Web.UI.WebControls.ObjectDataSource odsFile;
}