/// <summary> /// Si collega al dipartimento "codice" con un determinato user e pwd. /// Se user e pwd sono nulle accede con un utente predefinito. /// </summary> /// <param name="codice">Codice dipartimento.</param> /// <param name="user">Nome utente.</param> /// <param name="pwd">Password.</param> /// <param name="datacontabile">Data contabile.</param> void ConnectToDepartment(string codice, string user, string pwd, DateTime datacontabile) { string error; DataAccess Conn = GetVars.GetSystemDataAccess(this, out error); MetaMasterBootstrap master = Page.Master as MetaMasterBootstrap; master?.setUniversita(Session["system_config_nome_universita"] as string); if (codice.Trim().Length == 0) { labExtMessage.Text = "Non è stato selezionato alcun dipartimento"; return; } //Attenzione: leggere da XML IP del server e NomeDB //Inserire da codice NomeUtente e Password string filterdip = "(codicedipartimento=" + QueryCreator.quotedstrvalue(codice, true) + ")"; DataTable CodDip = Conn.RUN_SELECT("codicidipartimenti", "*", null, filterdip, null, true); if ((CodDip == null) || (CodDip.Rows.Count == 0)) { //Dati non corretti WebLog.Log(this, codice + ": Codice non corretto"); labExtMessage.Text = "Il codice inserito non è corretto."; return; } if (CodDip.Rows.Count > 1) { //Attenzione nel DB non è garantita l'unicità dei dati. labExtMessage.Text = "Chiedere al Responsabile del servizio " + "l'assegnazione di un nuovo Codice"; WebLog.Log(this, "Attenzione!!! Duplicazione di codici per " + codice); return; } string err = ""; DataRow myDr = CodDip.Rows[0]; Session["Dipartimento"] = myDr["Dipartimento"].ToString(); //Creo la connessione. DataAccess UsrConn = GetVars.CreateUserConn(this, myDr, user, pwd, datacontabile, out err); if (UsrConn == null) { err = "Connessione per l'utente '" + user + "' rifiutata. <br/> Controllare Nome Utente e/o Password"; string err2 = "Connessione al db del dipartimento " + codice + " non riuscita. <br/>" + err; labExtMessage.Text = err2; WebLog.Log(this, err2); return; } }
protected void btnOk_Click(object sender, ImageClickEventArgs e) { if (Conn == null) { return; } DateTime D; try { D = (DateTime)HelpForm.GetObjectFromString(typeof(DateTime), txtDataContabile.Text, "x.y"); } catch { lblMessaggio.Text = "La data contabile è un campo obbligatorio."; return; } string codicedipartimento = null; if (Request != null) { codicedipartimento = Request.Params["dep"]; if (!string.IsNullOrEmpty(codicedipartimento)) { Label3.Visible = false; cmbDipartimento.Visible = false; } } if (string.IsNullOrEmpty(codicedipartimento)) { if (cmbDipartimento.SelectedValue != "" && cmbDipartimento.SelectedValue != null) { codicedipartimento = cmbDipartimento.SelectedValue; } } if (string.IsNullOrEmpty(codicedipartimento)) { lblMessaggio.Text = "E' obbligatorio scegliere un dipartimento"; } //Cerco prima nella tabella contatto e poi nella tabella responsabile. string NomeUtente = txtNomeUtente.Text; //rbTipuUtente.SelectedValue == "5" IMPLICITAMENTE // Connessione al dipartimento. ConnectToDepartment(codicedipartimento, null, null, D); //Connessione al Server.Database privato del software. Easy_DataAccess UsrConn = GetVars.GetUserConn(this); if (UsrConn == null) { return; //Messaggio già viualizzato da ConnectToDepartment() } QueryHelper QHS = UsrConn.GetQueryHelper(); if (!DatiValidi(D, UsrConn)) { lblMessaggio.Text = string.Format("L'esercizio {0} non è stato creato!", D.Year); return; } if (UsrConn.Open() == false) { //Il Server del Dipartimento non è in rete. //Il servizio non è disponibile in quanto il computer potrebbe essere spento. labExtMessage.Text = "Il Server del Dipartimento non risponde.\r" + "Potrebbe essere spento o momentaneamente fuori rete. \r" + "Provi in seguito."; WebLog.Log(this, "Il Server del dipartimento non risponde."); return; } UsrConn.Close(); Meta_EasyDispatcher Disp = new Meta_EasyDispatcher(UsrConn); ApplicationState APS = new ApplicationState(Disp, UsrConn); string path = this.MapPath("."); string filename = Path.Combine(path, "proxyserver.html"); if (File.Exists(filename)) { StreamReader SR = new StreamReader(filename); string webauth = SR.ReadToEnd(); webauth = webauth.Replace("\n", "").Replace("\r", "").Trim(); APS.webautorithy = webauth; SR.Close(); } APS.SaveApplicationState(this); labExtMessage.Text = "Connessione al server effettuata."; int userkind = 5; // utente SSO (SAML/Shibboleth) string user = null; string forename = null; string lastname = null; string cf = null; string email = null; string filter = QHS.AppAnd( QHS.CmpEq("username", NomeUtente), QHS.CmpEq("codicedipartimento", codicedipartimento), QHS.CmpEq("userkind", userkind) ); // prelevare l'idflowchart e poi fare la connecttodepartment DataTable virtualuser = Conn.RUN_SELECT("virtualuser", "*", null, filter, null, false); if (virtualuser != null && virtualuser.Rows.Count != 0) { user = virtualuser.Rows[0]["sys_user"].ToString(); forename = virtualuser.Rows[0]["forename"].ToString(); lastname = virtualuser.Rows[0]["surname"].ToString(); email = virtualuser.Rows[0]["email"].ToString(); cf = virtualuser.Rows[0]["cf"].ToString(); UsrConn.SetUsr("HasVirtualUser", "S"); // Controllare se è anche un responsabile // Vediamo se esiste un manager il cui login="******" // se si, assegnamo le due variabili di responsabile come // nel caso "2" filter = QHS.CmpEq("userweb", virtualuser.Rows[0]["username"].ToString()); DataTable manager = UsrConn.RUN_SELECT("manager", "*", null, filter, null, false); if (manager != null && manager.Rows.Count != 0) { Session["Responsabile"] = manager.Rows[0]["title"].ToString(); Session["CodiceResponsabile"] = manager.Rows[0]["idman"]; } EasySecurity sec = UsrConn.Security as EasySecurity; UsrConn.externalUser = NomeUtente; sec.SetSys("user", user); sec.SetUsr("usergrouplist", null); sec.CalculateGroupList(); sec.RecalcUserEnvironment(); sec.ReadAllGroupOperations(); sec.SetUsr("forename", forename); sec.SetUsr("surname", lastname); sec.SetUsr("email", email); sec.SetUsr("cf", cf); if (!CambioDataConsentita(UsrConn, D)) { UsrConn.Close(); labExtMessage.Text = "Accesso non consentito in tale data \rin base alla gestione della sicurezza."; lblMessaggio.Text = "Accesso negato"; return; } } else { lblMessaggio.Text = "Utente non valido."; return; } Session["TipoUtente"] = "Utente SSO"; Session["Utente"] = string.Format("{0} {1}", forename, lastname); Session["PasswordUtente"] = null; // non la conosciamo Session["SavedFlowChart"] = null; object idflowchart = UsrConn.GetSys("idflowchart"); if (idflowchart != null && idflowchart != DBNull.Value) { object title = UsrConn.DO_READ_VALUE("flowchart", QHS.CmpEq("idflowchart", idflowchart), "title"); if (title != null && title != DBNull.Value) { Session["SavedFlowChart"] = title; } } Session["SavedHomePage"] = "LoginSAML.aspx"; Response.Redirect("IndiceReport.aspx"); }
protected void Page_Load(object sender, EventArgs e) { lblMessaggio.Text = ""; labExtMessage.Text = ""; // Imposta il nome dell'utente identificato dall'intentity provider. if (Session["samlemail"] == null) { lblMessaggio.Text = "Autenticazione fallita."; WebLog.Log(this, "Autenticazione fallita."); //Response.Redirect("DefaultSAML.aspx"); return; } txtNomeUtente.Text = Session["samlemail"].ToString(); if (!Page.IsPostBack) { Session["utente"] = ""; Session["Responsabile"] = ""; Session["Fornitore"] = ""; Session["CodiceResponsabile"] = null; Session["CodiceFornitore"] = null; Session["TipoUtente"] = null; txtDataContabile.Text = HelpForm.StringValue(DateTime.Now, "x.y"); } DataSet Cfg = GetVars.GetConfigDataSet(this); if (Cfg.Tables[0].Rows.Count == 0) { lblMessaggio.Text = "Servizio non installato correttamente. Manca il file di configurazione."; WebLog.Log(this, "Connessione al db di sistema non riuscita."); return; } string error; Conn = GetVars.GetSystemDataAccess(this, out error); if (Conn == null) { lblMessaggio.Text = "Connessione al DB di sistema non riuscita."; WebLog.Log(this, "Connessione al db di sistema non riuscita."); return; } else { lblMessaggio.Text = "Il servizio Web è attivo."; } MetaMasterBootstrap master = Page.Master as MetaMasterBootstrap; master?.setUniversita(Session["system_config_nome_universita"] as string); GetVars.ClearUserConn(this); if (Request != null) { string dep = Request.Params["dep"]; if (!string.IsNullOrEmpty(dep)) { Label3.Visible = false; cmbDipartimento.Visible = false; } } AggiornaElencoDipartimenti(); }
protected void Page_Load(object sender, EventArgs e) { //Master.SetTitle("WebEasy - Accesso Servizi Dipartimento "); lblMessaggio.Text = ""; labExtMessage.Text = ""; error_dep = false; if (!Page.IsPostBack || Page.Session.IsNewSession) { Session["utente"] = ""; Session["Responsabile"] = ""; Session["Fornitore"] = ""; Session["CodiceResponsabile"] = null; Session["CodiceFornitore"] = null; } if (Request != null) { if (Request.Params["x"] != null && Request.Params["x"].ToString() != "") { Session["DepCode"] = Request.Params["x"]; } } if (Session["DepCode"] == null || Session["DepCode"].ToString() == "") { lblMessaggio.Text = "E' necessario chiamare la pagina magazzino_out.aspx con il parametro dep=codice dipartimento"; WebLog.Log(this, "Parametro dep non fornito."); error_dep = true; return; } //if (Session["DoLogon"] == null || !((bool)Session["DoLogon"])) { // lblMessaggio.Text = "Applicazione non inizializzata correttamente."; // WebLog.Log(this, "Applicazione non inizializzata correttamente."); // return; //} DataSet Cfg = GetVars.GetConfigDataSet(this); if (Cfg.Tables[0].Rows.Count == 0) { lblMessaggio.Text = "Servizio non installato correttamente. Manca il file di configurazione."; WebLog.Log(this, "Connessione al db di sistema non riuscita."); return; } MetaMaster MM = Master as MetaMaster; //if (MM != null) MM.ShowClientMessage("NINO", false); string error; DataAccess Conn = GetVars.GetSystemDataAccess(this, out error); if (Conn == null) { //lblMessaggio.Text = "Connessione al DB di sistema non riuscita." + error; //Attenzione qui l'errore contiene la password del Database ! lblMessaggio.Text = "Connessione al DB di sistema non riuscita."; WebLog.Log(this, "Connessione al db di sistema non riuscita."); return; } lblMessaggio.Text = "Il servizio Web è attivo"; GetVars.ClearUserConn(this); }
protected void ImageButton1_Click(object sender, ImageClickEventArgs e) { if (error_dep) { return; } string error; DataAccess Conn = GetVars.GetSystemDataAccess(this, out error); if (Conn == null) { return; } DateTime D = DateTime.Now; object Onedip = Session["DepCode"]; if (Onedip == null) { MetaPage.SessionTimeOut(this); return; } //Onedip = "amministrazione"; ConnectToDepartment(Onedip.ToString(), null, null, D); Easy_DataAccess UsrConnTemp = GetVars.GetUserConn(this); if (UsrConnTemp == null || UsrConnTemp.Open() == false) { //Il Server del Dipartimento non è in rete. //Il servizio non è disponibile in quanto il computer potrebbe essere spento. labExtMessage.Text = "Il Server del Dipartimento " + Onedip.ToString() + " non risponde.\r" + "Potrebbe essere spento o momentaneamente fuori rete. \r" + "Provi in seguito"; txtCodice.ReadOnly = true; WebLog.Log(this, "Il Server del dipartimento " + Onedip.ToString() + "non risponde."); return; } DataSet DDecode = UsrConnTemp.CallSP("calc_bookingid", new object[] { txtCodice.Text }, true); UsrConnTemp.Close(); if (DDecode == null || DDecode.Tables.Count == 0) { lblMessaggio.Text = "Errore nel contattare il dipartimento o codice errato."; return; } DataTable TDecode = DDecode.Tables[0]; if (TDecode.Rows.Count == 0) { lblMessaggio.Text = "Errore nel contattare il dipartimento o codice errato."; return; } DataRow RCode = TDecode.Rows[0]; if (RCode["iddep"].ToString() == "") { lblMessaggio.Text = "Errore nella lettura del codice a barre"; txtCodice.Text = ""; return; } string depcode = RCode["iddep"].ToString(); string idbooking = RCode["idbooking"].ToString(); ConnectToDepartment(depcode, null, null, D); Easy_DataAccess UsrConn = GetVars.GetUserConn(this); if (UsrConn == null || UsrConn.Open() == false) { //Il Server del Dipartimento non è in rete. //Il servizio non è disponibile in quanto il computer potrebbe essere spento. labExtMessage.Text = "Il Server del Dipartimento " + depcode + " non risponde.\r" + "Potrebbe essere spento o momentaneamente fuori rete. \r" + "Provi in seguito"; txtCodice.ReadOnly = true; WebLog.Log(this, "Il Server del dipartimento " + depcode + "non risponde."); return; } labExtMessage.Text = "Connessione al server effettuata."; ScaricaPrenotazione(UsrConn, idbooking); }
protected void Page_Load(object sender, EventArgs e) { //Master.SetTitle("WebEasy - Accesso Servizi Dipartimento "); lblMessaggio.Text = ""; labExtMessage.Text = ""; if (!Page.IsPostBack || Page.Session.IsNewSession) { Session["utente"] = ""; Session["Responsabile"] = ""; Session["Fornitore"] = ""; Session["CodiceResponsabile"] = null; Session["CodiceFornitore"] = null; } if (Request != null) { if (Request.Params["x"] != null && Request.Params["x"].ToString() != "") { Session["DepCode"] = Request.Params["x"]; } } if (Session["DepCode"] == null || Session["DepCode"].ToString() == "") { lblMessaggio.Text = "E' necessario chiamare la pagina magazzino_in.aspx con il parametro dep=codice dipartimento"; WebLog.Log(this, "Parametro dep non fornito."); return; } //if (Session["DoLogon"] == null || !((bool)Session["DoLogon"])) { // lblMessaggio.Text = "Applicazione non inizializzata correttamente."; // WebLog.Log(this, "Applicazione non inizializzata correttamente."); // return; //} DataSet Cfg = GetVars.GetConfigDataSet(this); if (Cfg.Tables[0].Rows.Count == 0) { lblMessaggio.Text = "Servizio non installato correttamente. Manca il file di configurazione."; WebLog.Log(this, "Connessione al db di sistema non riuscita."); return; } MetaMaster MM = Master as MetaMaster; //if (MM != null) MM.ShowClientMessage("NINO", false); string error; DataAccess Conn = GetVars.GetSystemDataAccess(this, out error); if (Conn == null) { //lblMessaggio.Text = "Connessione al DB di sistema non riuscita." + error; //Attenzione qui l'errore contiene la password del Database ! lblMessaggio.Text = "Connessione al DB di sistema non riuscita."; WebLog.Log(this, "Connessione al db di sistema non riuscita."); return; } lblMessaggio.Text = "Il servizio Web è attivo"; GetVars.ClearUserConn(this); MetaMaster master = Page.Master as MetaMaster; master?.setUniversita(Session["system_config_nome_universita"] as string); if (!Page.IsPostBack) { ldapauth ldpauth = new ldapauth(Conn); if (!ldpauth.getconfig()) { rbTipuUtente.Items.RemoveAt(3); } } //WebLog.Log(this, "Visualizza Login_Servizi"); DateTime D = DateTime.Now; if (IsPostBack) { if (txtNomeUtente.Text == "") { lblMessaggio.Text = "Il nome utente è un campo obbligatorio."; //MM.ShowClientMessage("Il nome utente è un campo obbligatorio.", "Errore", // System.Windows.Forms.MessageBoxButtons.OK); return; } if (txtPassword.Text == "") { lblMessaggio.Text = "La password è un campo obbligatorio."; //MM.ShowClientMessage("La password è un campo obbligatorio.", "Errore", // System.Windows.Forms.MessageBoxButtons.OK); return; } } if (IsPostBack && Request != null) { //Cerco prima nella tabella contatto e poi nella tabella responsabile. string NomeUtente = txtNomeUtente.Text; string Password = txtPassword.Text; // Request.Form["txtPassword"].ToString(); if (rbTipuUtente.SelectedValue == "1" || rbTipuUtente.SelectedValue == "2") { //Responsabile o Fornitore ConnectToDepartment(Session["DepCode"].ToString(), null, null, D); } if (rbTipuUtente.SelectedValue == "3") //Utente dell'applicazione { ConnectToDepartment(Session["DepCode"].ToString(), NomeUtente, txtPassword.Text, D); } bool ldapauthok = false; if (rbTipuUtente.SelectedValue == "4") // Utente LDAP { ldapauth lauth = new ldapauth(Conn); if (!lauth.getconfig()) { // Nessuna configurazione LDAP lblMessaggio.Text = lauth.ErrorMsg; return; } else { if (!lauth.Authenticate(NomeUtente, txtPassword.Text)) { // autenticazione fallita lblMessaggio.Text = lauth.ErrorMsg; return; } else { // autenticazione LDAP riuscita NomeUtente = lauth.user_decoded; ConnectToDepartment(Session["DepCode"].ToString(), null, null, D); ldapauthok = true; } } } //Connessione al Server.Database privato del software. Easy_DataAccess UsrConn = GetVars.GetUserConn(this); if (UsrConn == null) { return; //Messaggio già viualizzato da ConnectToDepartment() } QueryHelper QHS = UsrConn.GetQueryHelper(); string user = null; string forename = null; string lastname = null; string cf = null; string email = null; if (rbTipuUtente.SelectedValue == "3") { if (!CambioDataConsentita(UsrConn, D)) { UsrConn.Close(); labExtMessage.Text = "Accesso non consentito in tale data \rin base alla gestione della sicurezza."; // MM.ShowClientMessage("Accesso non consentito in tale data in base alla gestione della sicurezza.", "Errore", // System.Windows.Forms.MessageBoxButtons.OK); lblMessaggio.Text = "Accesso negato"; return; } } if (UsrConn.Open() == false) { //Il Server del Dipartimento non è in rete. //Il servizio non è disponibile in quanto il computer potrebbe essere spento. labExtMessage.Text = "Il Server del Dipartimento non risponde.\r" + "Potrebbe essere spento o momentaneamente fuori rete. \r" + "Provi in seguito"; txtNomeUtente.ReadOnly = true; WebLog.Log(this, "Il Server del dipartimento non risponde."); return; } UsrConn.Close(); Meta_EasyDispatcher Disp = new Meta_EasyDispatcher(UsrConn); ApplicationState APS = new ApplicationState(Disp, UsrConn); string path = this.MapPath("."); string filename = Path.Combine(path, "proxyserver.html"); if (File.Exists(filename)) { StreamReader SR = new StreamReader(filename); string webauth = SR.ReadToEnd(); webauth = webauth.Replace("\n", "").Replace("\r", "").Trim(); APS.webautorithy = webauth; SR.Close(); } APS.SaveApplicationState(this); labExtMessage.Text = "Connessione al server effettuata."; if (rbTipuUtente.SelectedValue == "1") { int countresp = UsrConn.RUN_SELECT_COUNT("manager", QHS.CmpEq("userweb", NomeUtente), false); if (countresp > 1) { lblMessaggioPass.Text = "Chiedere al Segreterio Amministrativo l'assegnazione di una nuova login"; WebLog.Log(this, "Attenzione !!! Login assegnata a piu responsabili"); return; } DataTable Responsabile = UsrConn.RUN_SELECT("manager", "*", null, QHS.AppAnd(QHS.CmpEq("userweb", NomeUtente), QHS.CmpEq("passwordweb", Password)), null, false); if (Responsabile.Rows.Count == 0) { //Dati non corretti labExtMessage.Text = "Nome utente o password non sono corretti."; WebLog.Log(this, "Nome Resp:" + NomeUtente + " e password:"******" non corretti"); return; } Session["LoginResponsabile"] = NomeUtente; Session["PasswordResponsabile"] = Password; Session["Responsabile"] = Responsabile.Rows[0]["title"].ToString(); Session["CodiceResponsabile"] = Responsabile.Rows[0]["idman"]; Session["TipoUtente"] = "responsabile"; WebLog.Log(this, "Riconosciuto responsabile: " + Session["Responsabile"].ToString()); } if (rbTipuUtente.SelectedValue == "2") { int countforn = UsrConn.RUN_SELECT_COUNT("registryreferenceview", QHS.CmpEq("userweb", NomeUtente), false); if (countforn > 1) { lblMessaggioPass.Text = "Chiedere al Segreterio Amministrativo l'assegnazione di una nuova login"; WebLog.Log(this, "Attenzione !!! Login assegnata a piu fornitori"); return; } DataTable Contatto = UsrConn.RUN_SELECT("registryreferenceview", "*", null, QHS.AppAnd(QHS.CmpEq("userweb", NomeUtente), QHS.CmpEq("passwordweb", Password)), null, false); if (Contatto.Rows.Count == 0) { //Dati non corretti labExtMessage.Text = "Nome utente o password non sono corretti."; WebLog.Log(this, "Nome Fornitore:" + NomeUtente + " e password:"******" non corretti"); return; } Session["LoginFornitore"] = NomeUtente; Session["Fornitore"] = Contatto.Rows[0]["registry"]; Session["CodiceFornitore"] = Contatto.Rows[0]["idreg"]; Session["PasswordFornitore"] = Password; Session["TipoUtente"] = "fornitore"; WebLog.Log(this, "Riconosciuto fornitore: " + Session["Fornitore"].ToString()); } if (rbTipuUtente.SelectedValue == "3") { Session["TipoUtente"] = "utente"; Session["Utente"] = NomeUtente; Session["PasswordUtente"] = Password; } if (ldapauthok || (rbTipuUtente.SelectedValue == "1") || (rbTipuUtente.SelectedValue == "2") || (rbTipuUtente.SelectedValue == "3")) { int userkind = Convert.ToInt32(rbTipuUtente.SelectedValue); string filter = QHS.AppAnd(QHS.CmpEq("username", NomeUtente), QHS.CmpEq("codicedipartimento", Session["DepCode"].ToString()), QHS.CmpEq("userkind", userkind) ); // prelevare l'idflowchart e poi fare la connecttodepartment DataTable virtualuser = Conn.RUN_SELECT("virtualuser", "*", null, filter, null, false); if (virtualuser != null && virtualuser.Rows.Count != 0) { user = virtualuser.Rows[0]["sys_user"].ToString(); forename = virtualuser.Rows[0]["forename"].ToString(); lastname = virtualuser.Rows[0]["surname"].ToString(); email = virtualuser.Rows[0]["email"].ToString(); cf = virtualuser.Rows[0]["cf"].ToString(); UsrConn.SetUsr("HasVirtualUser", "S"); // Controllare se è anche un responsabile // Vediamo se esiste un manager il cui login="******" // se si, assegnamo le due variabili di responsabile come // nel caso "2" filter = QHS.CmpEq("userweb", virtualuser.Rows[0]["username"].ToString()); DataTable manager = UsrConn.RUN_SELECT("manager", "*", null, filter, null, false); if (manager != null && manager.Rows.Count != 0) { Session["Responsabile"] = manager.Rows[0]["title"].ToString(); Session["CodiceResponsabile"] = manager.Rows[0]["idman"]; } EasySecurity sec = UsrConn.Security as EasySecurity; UsrConn.externalUser = NomeUtente; sec.SetSys("user", user); sec.SetUsr("usergrouplist", null); sec.CalculateGroupList(); sec.RecalcUserEnvironment(); sec.ReadAllGroupOperations(); sec.SetUsr("forename", forename); sec.SetUsr("surname", lastname); sec.SetUsr("email", email); sec.SetUsr("cf", cf); if (!CambioDataConsentita(UsrConn, D)) { labExtMessage.Text = "Accesso non consentito in tale data \rin base alla gestione della sicurezza."; lblMessaggio.Text = "Accesso negato"; return; } } else { if (ldapauthok) { lblMessaggio.Text = "Utente non valido."; return; } } } if (rbTipuUtente.SelectedValue == "4") { Session["TipoUtente"] = "Utente LDAP"; Session["Utente"] = forename + " " + lastname; Session["PasswordUtente"] = Password; } StampaReport(UsrConn, cf); //Response.Redirect("IndiceReport.aspx"); } }
//HtmlGenericControl StartVoceMenu(HtmlGenericControl parent, string testo,string classfun, string buttontag, EventHandler handler) { // HtmlGenericControl LI = new HtmlGenericControl("li"); // LI.InnerText = testo; // parent.Controls.Add(LI); // LI.Attributes["onClick"] = "doMenuFunction(\"" + classfun + "\",\"" + buttontag + "\"); return true;"; // Page.ClientScript.GetCallbackEventReference(HwMenuButton.ID, buttontag, null, null, null, true); // return LI; //} //LiteralControl StopVoceMenu(LiteralControl parent) { //} protected void Page_Load(object sender, System.EventArgs e) { ///////////////// WebLog.Log(this, "Visualizza IndiceReport.aspx"); //////////////// MyMenuClass.RegisterScript(this, HwMenuButton); MetaMasterBootstrap master = Page.Master as MetaMasterBootstrap; master?.setUniversita(Session["system_config_nome_universita"] as string); bool IsManager = (Session["CodiceResponsabile"] != null ? true : false); if (!IsManager) { PrenotaWait = false; PrenotaMyTeam = false; RicaricaCard = false; GestisciCard = false; IngressoMagazzino = false; } //btnRegistroRichiesteBuonoOrdine.Attributes.Add("onclick", "aprifin();"); if (Session["Cart"] != null) { ApplicationState APS = ApplicationState.GetApplicationState(this); MetaData M = APS.Dispatcher.Get("booking"); M.edit_type = "defaultnew02"; APS.CallPage(this, M, false); } if (Session["UserPar"] != null) { if (Session["ModuleReportRow"] != null) { // Report string F = "window.open('WebPDFView.aspx');"; if (!Page.ClientScript.IsClientScriptBlockRegistered(typeof(Page), "openwin")) { Page.ClientScript.RegisterClientScriptBlock( typeof(Page), "openwin", F, true); } //if (Session["PageToCameBack"] != null) { // string url = Session["PageToCameBack"].ToString(); // Session["PageToCameBack"] = null; // Response.Redirect(url); // return; //} } else { // Export string F = "window.open('ExportView.aspx');"; if (!Page.ClientScript.IsClientScriptBlockRegistered(typeof(Page), "openwin")) { Page.ClientScript.RegisterClientScriptBlock( typeof(Page), "openwin", F, true); } } //ApplicationState APS = ApplicationState.GetApplicationState(this); //MetaData M = APS.Dispatcher.Get("webpdf"); //M.edit_type = "view"; //APS.CallPage(this, M, false); } DataAccess UsrConn = GetVars.GetUserConn(this); if (((UsrConn == null) || (UsrConn.Open() == false))) { return; } string tipoutente = Session["TipoUtente"] as string; //if (tipoutente != "utente" && tipoutente != "Utente LDAP") { if (UsrConn.GetUsr("HasVirtualUser") == null && tipoutente != "utente") { Atto = false; AttoBudget = false; BuonoOrdine = false; VarPrev = false; ViterboVarPrev = false; VarIniziale = false; VarPrevBudget = false; VarInizialeBudget = false; Vetrina = false; Prenota = false; IngressoMagazzino = false; PrenotaMyTeam = false; PrenotaWait = false; Missioni = false; CataniaMissioni = false; MissioniAuth = false; MissioniMyTeam = false; canChangeRole = false; RicaricaCard = false; GestisciCard = false; Upb = false; Finanziamento = false; } if (tipoutente == "Utente LDAP" || tipoutente == "Utente SSO") { CanChangePassword = false; } if (RicaricaCard && UsrConn.RUN_SELECT_COUNT("lcard", null, false) == 0) { RicaricaCard = false; } //if (GestisciCard && UsrConn.RUN_SELECT_COUNT("lcard", null, false) == 0) { // GestisciCard = false; //} MyMenuClass myMenu = new MyMenuClass(null); CheckSecurityOnMenuButtons(myMenu); string filter = UsrConn.GetSys("filterrule") as string; filter = GetData.MergeFilters(filter, "(webvisible='S')"); if (tipoutente == "responsabile") { filter = filter + "AND" + "(reportname in (select reportname from reportparameter where datasource='manager'))"; } if (tipoutente == "fornitore") { filter = filter + "AND" + "(reportname in (select reportname from reportparameter where datasource='registryreference'))"; } ModRepWeb = UsrConn.RUN_SELECT("report", "*", "modulename,groupname", filter, null, true); UsrConn.Security.DeleteAllUnselectable(ModRepWeb); QueryHelper QHS = UsrConn.GetQueryHelper(); CQueryHelper QHC = new CQueryHelper(); object idflowchart = UsrConn.GetSys("idflowchart"); if (idflowchart != null && idflowchart != DBNull.Value) { //Applica filtro su stampe in base a flowchart DataTable MyMod = UsrConn.RUN_SELECT("flowchartmodulegroup", "*", null, QHS.CmpEq("idflowchart", idflowchart), null, false); if (MyMod != null && MyMod.Columns.Count > 0) { MyMod.CaseSensitive = false; foreach (DataRow RM in ModRepWeb.Select()) { if (RM["modulename"].ToString() == "" || RM["groupname"].ToString() == "") { continue; } string existfilter = QHC.AppAnd(QHC.CmpEq("modulename", RM["modulename"]), QHC.CmpEq("groupname", RM["groupname"])); if (MyMod.Select(existfilter).Length > 0) { continue; } RM.Delete(); } } } ModRepWeb.AcceptChanges(); string lastmodule = ""; string lastgroupname = ""; //Visualizza l'elenco dei report disponibili if (ModRepWeb != null && ModRepWeb.Rows.Count > 0) { MyMenuClass menuReport = new MyMenuClass("Report"); myMenu.AddChild(menuReport); MyMenuClass menuModule = null; MyMenuClass menuGruppo = null; foreach (DataRow DrReport in ModRepWeb.Rows) { if (DrReport["modulename"].ToString().ToLower() != lastmodule) { menuModule = new MyMenuClass(DrReport["modulename"].ToString()); menuReport.AddChild(menuModule); lastmodule = DrReport["modulename"].ToString().ToLower(); menuGruppo = new MyMenuClass(DrReport["groupname"].ToString(), true); menuModule.AddChild(menuGruppo); lastgroupname = DrReport["groupname"].ToString().ToLower(); } if (DrReport["groupname"].ToString().ToLower() != lastgroupname) { menuGruppo = new MyMenuClass(DrReport["groupname"].ToString(), true); menuModule.AddChild(menuGruppo); lastgroupname = DrReport["groupname"].ToString().ToLower(); } MyMenuClass voce = new MyMenuClass(DrReport["Description"].ToString(), "r", DrReport["ModuleName"].ToString() + "." + DrReport["ReportName"].ToString()); menuGruppo.AddChild(voce); } } string filterexpresp = "(webvisible='S') "; if (Session["CodiceResponsabile"] != null) { filterexpresp = filterexpresp + " AND" + "(procedurename in (select procedurename from exportfunctionparam where datasource='manager'))"; } if (Session["CodiceFornitore"] != null) { filterexpresp = filterexpresp + " AND" + "(procedurename in (select procedurename from exportfunctionparam where datasource='registryreference'))"; } ExportWeb = UsrConn.RUN_SELECT("exportfunction", "*", "modulename", filterexpresp, null, true); UsrConn.Security.DeleteAllUnselectable(ExportWeb); if (idflowchart != null && idflowchart != DBNull.Value) { //Applica filtro su stampe in base a flowchart DataTable MyMod = UsrConn.RUN_SELECT("flowchartexportmodule", "*", null, QHS.CmpEq("idflowchart", idflowchart), null, false); if (MyMod != null && MyMod.Columns.Count > 0) { MyMod.CaseSensitive = false; foreach (DataRow RM in ExportWeb.Select()) { if (RM["modulename"].ToString() == "") { continue; } string existfilter = QHC.CmpEq("modulename", RM["modulename"]); if (MyMod.Select(existfilter).Length > 0) { continue; } RM.Delete(); } } } ExportWeb.AcceptChanges(); lastmodule = ""; //Visualizza l'elenco delle esportazioni disponibili if (ExportWeb != null && ExportWeb.Rows.Count > 0) { MyMenuClass menuExport = new MyMenuClass("Esportazioni"); myMenu.AddChild(menuExport); MyMenuClass menuExpModule = null; //MyMenuClass menuExpGruppo; foreach (DataRow DrExport in ExportWeb.Rows) { if (DrExport["modulename"].ToString().ToLower() != lastmodule) { menuExpModule = new MyMenuClass(DrExport["modulename"].ToString(), null, null); menuExport.AddChild(menuExpModule); lastmodule = DrExport["modulename"].ToString().ToLower(); } MyMenuClass voce = new MyMenuClass(DrExport["Description"].ToString(), "e", DrExport["procedurename"].ToString() + "." + DrExport["Description"].ToString()); menuExpModule.AddChild(voce); } } /* * MyMenuClass sys = new MyMenuClass("Sistema"); * myMenu.AddChild(sys); * sys.AddChild(new MyMenuClass("Disconnetti", "s", "disconnect")); * if (canChangeRole) sys.AddChild(new MyMenuClass("Cambio Ruolo", "s", "changerole")); * if (CanChangePassword) sys.AddChild(new MyMenuClass("Cambio Password", "s", "changepwd")); */ myMenu.AddChild(new MyMenuClass("Disconnetti", "s", "disconnect")); if (canChangeRole) { myMenu.AddChild(new MyMenuClass("Cambio Ruolo", "s", "changerole")); } if (CanChangePassword) { myMenu.AddChild(new MyMenuClass("Cambio Password", "s", "changepwd")); } myMenu.Optimize(); MenuPanel.Controls.Add(myMenu.GetControl()); UsrConn.Close(); //WebLog.Log(this,"Visualizza Elenco Report disponibili (" + ModRepWeb.Rows.Count.ToString() + ")"); }