///// <summary> ///// on keywords research ///// </summary> ///// <param name="sender"></param> ///// <param name="e"></param> //public static System.Data.DataTable btnKeywords_Click( // string this_txtKeywords_Text // ) //{ // System.Data.DataTable plausibleDocuments = // Process.doc_multi.doc_multi_searchingEngines.SearchByKeywordsOnAbstracts( // this_txtKeywords_Text // ); // return plausibleDocuments; //}// public static void DownloadButton_Click( Int32 id_doc_multi, System.Web.HttpContext this_Context ) { // query for blob at id, by means of Entity::Doc_multi. Entity.BusinessEntities.Doc_multi dm = new Entity.BusinessEntities.Doc_multi(); string webServer_extractionPath = null; Int32 res = dm.FILE_from_DB_writeto_FS( id_doc_multi, out webServer_extractionPath // sul web server. , this_Context.Request.UserHostName ); // // Ensure that Entity::Doc_multi produced an actual file. if ( string.IsNullOrEmpty(webServer_extractionPath) || !System.IO.File.Exists(webServer_extractionPath) ) { throw new HttpException(404, "doc_multi not found"); }// else trace client credentials. else { LoggingToolsContainerNamespace.LoggingToolsContainer.LogBothSinks_DbFs( " document extracted by client: " + this_Context.Request.UserHostName + " " , 5); } // // portare in download dal web server al client. // // extract extension int extIndex = webServer_extractionPath.LastIndexOf('.'); string extension = "doc"; if (-1 < extIndex) { extension = webServer_extractionPath.Substring(extIndex); }// else let it default. // // extract filename int fnameIndex = webServer_extractionPath.LastIndexOf('\\'); // it's a reserved char: double it. string filename = webServer_extractionPath.Substring(fnameIndex + 1); // exclude the last backslash. // this_Context.Response.ContentType = Downloader.setContentType(extension); // // Set the filename this_Context.Response.AddHeader("content-disposition", "attachment;filename=" + filename); // // Stream the file from web_Server to the client filesystem( the client browser will show a dialog). this_Context.Response.WriteFile(webServer_extractionPath); // ready. }// end method download_from_webServer_to_Client.
}// /// <summary> /// btnSubmit is used to communicate the final decision of the user: /// after he reviews the check-list of the web_srv uploaded files, he finally /// confirms what to send to the db_srv( i.e. the checked ones only). /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btnDocsFromWebToDb_Click(object sender, EventArgs e) { string _abstract; int ref_candidato_id; string sourceName; bool result = true;// bool mask. // bool validForWriting = default(bool);// a not-valid-forWriting item does not affect the whole insertion. int acc = 0; foreach (ListItem Item in this.chkMultiDoc.Items) { if (Item.Selected) { validForWriting = this.validationForWrite( out _abstract, out ref_candidato_id, ref acc // the accumulator is used, as index, to acces an array in Session and incremented by the calee. , out sourceName ); if (true == validForWriting) { Entity.BusinessEntities.Doc_multi dm = new Entity.BusinessEntities.Doc_multi(); int entityDbInsertionResult = dm.FILE_from_FS_insertto_DB( ref_candidato_id, _abstract, sourceName ); result &= (0 < entityDbInsertionResult);// each insertion must return the lastGeneratedId, which>0. }// else NOTvalidForWriting -> skip item. result &= validForWriting;// update the result, to last insertion outcome. }// else skip an item that has been un-checked, after uploading from client to web_srv. }// end foreach item that has been uploaded from client to web_srv. // // // ready if (!result) { LoggingToolsContainerNamespace.LoggingToolsContainer.DecideAndLog( null,// original exception type "Non e' stato possibile inserire il lavoro.", 0); //this.pnlInteractiveControls.Enabled = true;// let the user correct errors on page. this.divUpload.Enabled = true;// let the user correct errors on page. this.lblEsito.Text = "Non e' stato possibile inserire il lavoro."; this.lblEsito.BackColor = System.Drawing.Color.Red; return;// on page } else { LoggingToolsContainerNamespace.LoggingToolsContainer.DecideAndLog( null,// original exception type "Il lavoro e' stato inserito correttamente.", 0); //----navigate to "scadenziario", where the inserted phase is visible. this.lblEsito.Text = ""; this.lblEsito.BackColor = System.Drawing.Color.Transparent; this.Session["errore"] = null;// gc this.Session["arlUploadPaths"] = null;// gc this.Session["ref_candidato_id"] = null;// gc --- NB. this.Response.Redirect("candidatoLoad.aspx"); } }//---end submit()