Пример #1
0
        private void GetParamfromDB()
        {
            DataRow MR = Session["ExportRow"] as DataRow;

            if (MR == null)
            {
                return;
            }
            TitoloExp.Text = MR["Description"].ToString();
            DataAccess Conn = GetVars.GetUserConn(this);

            if (Conn == null)
            {
                return;
            }
            string filterpar = "(" +
                               "procedurename=" + QueryCreator.quotedstrvalue(MR["procedurename"], true) + ")";
            DataTable Params = Conn.RUN_SELECT("exportfunctionparam", "*", "number asc", filterpar, null, true);

            if (Params == null)
            {
                return;
            }
            Params.Columns.Add("__WebControlID", typeof(string));
            //Dataset di Sessione
            Session["Paramdata"] = Params;
            //Crea la tabella per inserire i parametri dell'utente
            CreatePrimaryTable(Params.Select(null, "number asc"));
            //Aggiunge la colonna ParamValue che mi servirà per conservare il valore inserito dall'utente
            //Params.Columns.Add("ParamValue",GetTypeFromUserFormat(Params["userformat"].ToString()));
        }
Пример #2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            string S1 = this.Request.Params["x"]; //proviene da sp_exp_licenzauso

            this.Response.Clear();
            if (S1 == null || S1 == "")
            {
                return;
            }
            string error;

            Conn = GetVars.GetSystemDataAccess(this, out error);
            if (Conn == null)
            {
                return;
            }

            ldpauth = new ldapauth(Conn);
            if (!ldpauth.getconfig())
            {
                return;
            }

            DoLDAP(S1);
        }
Пример #3
0
 protected override void OnUnload(EventArgs e)
 {
     if (DepConn != null)
     {
         DepConn.Destroy();
     }
     GetVars.clearSystemDataAccess(this);
     base.OnUnload(e);
 }
Пример #4
0
        protected void Page_Load(object sender, EventArgs e)
        {
            DataAccess DepConn = null;


            if (Request != null)
            {
                if (Request.Params["dep"] != null && Request.Params["dep"].ToString() != "")
                {
                    dep = Request.Params["dep"];
                }
            }

            DepConn = GetDepartmentConn(dep);
            if (DepConn == null)
            {
                GetVars.clearSystemDataAccess(this);
                return;
            }

            if (IsDataRequest())
            {
                GestisciDataRequest(DepConn, dep);
                DepConn.Close();
                DepConn.Destroy();
                GetVars.clearSystemDataAccess(this);
                return;
            }

            //Se c'è il parametro idreg si tratta di una richiesta di curriculum--> invia il file
            if (Request.Params["idreg"] != null && Request.Params["idreg"] != "")
            {
                GestisciRichiestaCurriculum(DepConn);
                DepConn.Close();
                DepConn.Destroy();
                GetVars.clearSystemDataAccess(this);
                return;
            }


            if (!IsPostBack)
            {
                anno.Text             = DateTime.Now.Year.ToString();
                rdbTipo.SelectedValue = "C";
                GetVars.clearSystemDataAccess(this);
                return;
            }

            RenderHtmlPage(DepConn);
            DepConn.Close();
            DepConn.Destroy();
            GetVars.clearSystemDataAccess(this);
        }
Пример #5
0
        /// <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;
            }
        }
Пример #6
0
        protected void btnok_Click(object sender, EventArgs e)
        {
            Easy_DataAccess Conn         = GetVars.GetUserConn(Page);
            bool            err          = false;
            string          idcustomuser = Conn.GetSys("idcustomuser") as string;
            object          idflowchart  = cmbruolo.SelectedValue;
            object          ndetail      = Conn.GetSys("ndetail");
            object          currdate     = Conn.GetSys("datacontabile");

            string sel = cmbruolo.SelectedValue;

            if (sel == "" || sel == null)
            {
                return;
            }

            if (sel.IndexOf("§") < 0)
            {
                return;
            }
            string [] ss = sel.Split('§');
            ndetail     = CfgFn.GetNoNullInt32(ss[1]);
            idflowchart = ss[0];
            string filter = QHS.AppAnd(QHS.CmpEq("idcustomuser", idcustomuser),
                                       QHS.CmpEq("idflowchart", idflowchart),
                                       QHS.CmpEq("ndetail", ndetail));
            object title = Conn.DO_READ_VALUE("flowchartuser", filter, "title");

            if (title == DBNull.Value)
            {
                title = Conn.DO_READ_VALUE("flowchart", QHS.CmpEq("idflowchart", idflowchart), "title");
            }

            Conn.RecalcUserEnvironment(idflowchart, ndetail);
            Conn.ReadAllGroupOperations();

            Session["SavedFlowChart"] = null;
            if (title != null)
            {
                Session["SavedFlowChart"] = title;
            }

            Response.Redirect("IndiceReport.aspx");
        }
Пример #7
0
        DataAccess GetDepartmentConn(string dep)
        {
            DataSet Cfg = GetVars.GetConfigDataSet(this);

            if (Cfg.Tables[0].Rows.Count == 0)
            {
                Error("Servizio non installato correttamente. Manca il file di configurazione.");
                return(null);
            }
            string     error;
            DataAccess Conn = GetVars.GetSystemDataAccess(this, out error);

            if (Conn == null)
            {
                Error("Connessione al db di sistema non riuscita.");
                return(null);
            }
            return(GetDepAccess(Conn, dep));
        }
Пример #8
0
        void StampaCheckIn()
        {
            DataAccess Conn = GetVars.GetUserConn(this);

            if (((Conn == null) || (Conn.Open() == false)))
            {
                return;
            }

            if (Conn.GetUsr("cf") == null)
            {
                Conn.Close();
                return;
            }

            string cf = Conn.GetUsr("cf").ToString();
            //Crea un datatable con i parametri per la stampa

            DataTable T = new DataTable("tabella");

            T.Columns.Add("cf", typeof(string));
            DataRow R = T.NewRow();

            R["cf"] = cf;
            T.Rows.Add(R);
            QueryHelper QHS          = Conn.GetQueryHelper();
            DataTable   Modulereport = Conn.RUN_SELECT("report", "*", null, QHS.CmpEq("reportname", "rpt_ingressomagazzino"), null, true);

            Conn.Close();
            Session["UserPar"]         = T;
            Session["ModuleReportRow"] = Modulereport.Rows[0];
            //Session["PageToCameBack"] = this.Request.Url;

            string F = "window.open('WebPDFView.aspx');";

            if (!Page.ClientScript.IsClientScriptBlockRegistered(typeof(Page), "openwin"))
            {
                Page.ClientScript.RegisterClientScriptBlock(
                    typeof(Page), "openwin", F, true);
            }
        }
Пример #9
0
        object DefaultForParameter(DataRow Param)
        {
            DataAccess myDA    = GetVars.GetUserConn(this);
            string     TipoDef = Param["hintkind"].ToString().ToUpper();
            DateTime   DC      = (DateTime)myDA.GetSys("datacontabile");

            switch (TipoDef)
            {
            case "STRING":                      //Other
                return(Param["hint"].ToString());

            case "1/CURRM":                       //Primo giorno del mese
                return(new DateTime(DC.Year, DC.Month, 1));

            case "LASTDAY/CURRM":                      //Ultimo giorno del mese
                return(new DateTime(DC.Year, DC.Month,
                                    DateTime.DaysInMonth(DC.Year, DC.Month)));

            case "ACCOUNTYEAR":                     //esercizio corrente
                return(myDA.GetSys("esercizio"));

            case "NOHINT":                     //nessun valore predef.
                return(DBNull.Value);

            case "1/1":                     //Primo giorno dell'anno
                return(new DateTime(DC.Year, 1, 1));

            case "31/12":                     //Ultimo giorno dell'anno
                return(new DateTime(DC.Year, 12, 31));

            case "ACCOUNTDATE":                     //Data Contabile
                return(DC);

            default:
                return(DBNull.Value);
            }
        }
Пример #10
0
        protected void Page_Load(object sender, System.EventArgs e)
        {
            //WebLog.Log(this,"Visualizza InserisciParametri");
            DataAccess Conn = GetVars.GetUserConn(this);
            DataTable  Params;

            //labCurrUser.Text = System.Environment.UserName+" (Network= "+System.Environment.UserDomainName+")";
            if (IsPostBack)
            {
                LeggiParametri();
                //WebLog.Log(this,"Ha letto i parametri inseriti dal'utente in InserisciParametri");
            }
            else
            {
                CreaPaginaParametri();

                //Aggiunge tipo parametro
                //TableCell tCell4 = new TableCell();
                //tRow.Cells.Add(tCell4);
                //tCell4.Width = 200;
                //tCell4.Text = ConvertTypeParameter(MyRowParam["appformat"].ToString());
                //string ParamType = "ParamType" + countTxt;
                //Session[ParamType] = MyRowParam["appformat"].ToString();	//Salva il tipo di parametro in formato numerico Campus



                /////////////////Aggiunge i controlli Validator per le TextBox;
                //					TableCell tCell4 = new TableCell();
                //					tRow.Cells.Add(tCell4);
                //					RequiredFieldValidator MyValid = new RequiredFieldValidator();
                //					MyValidator[countTxt] = MyValid;
                //					MyValid.ControlToValidate = TxtName;
                //					MyValid.ErrorMessage = "Completare il campo";
                //					tCell4.Controls.Add(MyValidator[countTxt]);
            }
        }
Пример #11
0
        DataAccess GetDepAccess(DataAccess Conn, string dep)
        {
            QueryHelper QHS = Conn.GetQueryHelper();

            string    filterdip = QHS.CmpEq("codicedipartimento", dep);
            DataTable CodDip    = Conn.RUN_SELECT("codicidipartimenti", "*", null, filterdip, null, true);

            if ((CodDip == null) || (CodDip.Rows.Count == 0))
            {
                //Dati non corretti
                Error(dep + ": Codice non corretto");
                return(null);
            }
            if (CodDip.Rows.Count > 1)
            {
                //Attenzione nel DB non è garantita l'unicità dei dati.
                Error("Attenzione !!! Duplicazione di codici per " + dep);
                return(null);
            }

            string  err  = "";
            DataRow myDr = CodDip.Rows[0];
            //Session["Dipartimento"] = myDr["Dipartimento"].ToString();


            //Creo la connessione.
            DataAccess UsrConn = GetVars.CreateUserConn(this, myDr, null, null, DateTime.Now, out err);

            if (UsrConn == null)
            {
                Error("Connessione al db del dipartimento " + dep + " non riuscita. ");
                return(null);
            }

            return(UsrConn);
        }
Пример #12
0
        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");
            }
        }
Пример #13
0
        /// <summary>
        /// Col1:ComboCodeField     Col2:ComboDescField
        /// </summary>
        /// <param name="myRowParam"></param>
        /// <returns></returns>
        private DataTable GetDataTableXcombo(DataRow myRowParam)
        {
            DataAccess Conn = GetVars.GetUserConn(this);

            if (Conn == null)
            {
                return(null);
            }

            string Filter = myRowParam["filter"].ToString().Trim();

            if (Filter != "")
            {
                Filter = Conn.Compile(Filter, true);
            }
            string sort = "";

            if (myRowParam["datasource"].ToString().ToLower().IndexOf("level") >= 0)
            {
                sort = myRowParam["valuemember"].ToString();
            }

            //Aggiunge filtro su esercizio se chiave primaria contiene
            // un campo di nome esercizio
            //if (QueryCreator.IsPrimaryKey(datasource, "ayear")) {
            //    Filter = GetData.MergeFilters(Filter, "(ayear='" +Conn.GetSys("esercizio").ToString() + "')");
            //}

            string      ComboTable     = myRowParam["datasource"].ToString();
            string      ComboCodeField = myRowParam["valuemember"].ToString().ToLower();
            string      comboDescField = myRowParam["displaymember"].ToString();
            QueryHelper QHS            = Conn.GetQueryHelper();

            if (ComboTable.ToLower() == "upb")
            {
                if (Session["codiceresponsabile"] != null && Session["codiceresponsabile"].ToString() != "")
                {
                    Filter = QHS.AppAnd(Filter, QHS.CmpEq("idman", Session["codiceresponsabile"]));
                }
                if (comboDescField == "codeupb")
                {
                    comboDescField = "SUBSTRING(codeupb+'-'+title,1,50) AS codedescr";
                    myRowParam["displaymember"] = "codedescr";
                }
                sort = "printingorder";
            }
            if (ComboTable.ToLower() == "fin")
            {
                if (Session["codiceresponsabile"] != null && Session["codiceresponsabile"].ToString() != "")
                {
                    Filter = QHS.AppAnd(Filter, QHS.CmpEq("idman", Session["codiceresponsabile"]));
                    DataTable FV = Conn.RUN_SELECT("finusable", "idfin", null, Filter, null, false);
                    Filter = QHS.FieldIn("idfin", FV.Select());
                }
                if (comboDescField == "codefin")
                {
                    comboDescField = "SUBSTRING(codefin+'-'+title,1,50) AS codedescr";
                    myRowParam["displaymember"] = "codedescr";
                }
                sort = "printingorder";
            }

            if (Filter == "")
            {
                Filter = null;
            }
            if (sort == "")
            {
                sort = comboDescField;
            }

            //string mySelectCombo = "SELECT distinct(" + ComboCodeField + ") AS " + ComboCodeField;
            string mySelectCombo = "SELECT * ";

            if (ComboTable.ToLower() == "fin" || ComboTable.ToLower() == "upb")
            {
                mySelectCombo += ", " + comboDescField;
            }

            /*
             * if (sort != null) {
             *  if (mySelectCombo.IndexOf(sort) < 0) mySelectCombo += "," + sort;
             * }
             */
            //if (ComboTable.ToLower() == "upb") mySelectCombo += ", idman";
            mySelectCombo += " FROM " + ComboTable;
            if (Filter != null)
            {
                mySelectCombo += " WHERE " + Filter;
            }
            if (sort != null)
            {
                mySelectCombo += " ORDER BY " + sort;
            }
            DataTable TCombo = Conn.SQLRunner(mySelectCombo, true);

            //DataTable TCombo = Conn.RUN_SELECT(ComboTable, "*", sort, Filter, null, false);

            TCombo.TableName = ComboTable.ToLower();

            Conn.DeleteAllUnselectable(TCombo);
            return(TCombo);
        }
Пример #14
0
        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);
        }
Пример #15
0
        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");
        }
Пример #16
0
        public static void Log(System.Web.UI.Page P, string Azione)
        {
            DataSet DS = new DataSet("log");

            DS.CaseSensitive = false;
            DataAccess Conn = GetVars.GetSystemDataAccess(P);

            if (Conn == null)
            {
                return;
            }
            Conn.Open();
            if (Conn.openError)
            {
                return;
            }
            DataTable T = Conn.CreateTableByName("logweb", "*");

            DS.Tables.Add(T);
            DataRow R = T.NewRow();

            R["IDLog"]              = Guid.NewGuid().ToString();
            R["IP"]                 = P.Request.UserHostAddress;
            R["Azione"]             = Azione;
            R["Data"]               = DateTime.Now;
            R["CodiceDipartimento"] = NoNull(GetVars.GetCodDip(P));
            R["Dipartimento"]       = NoNull(GetVars.GetDip(P));
            R["DipServer"]          = NoNull(Conn.GetSys("server"));
            R["DipDatabase"]        = NoNull(Conn.GetSys("database"));
            R["NomeReport"]         = NoNull(P.Session["ReportName"]);
            T.Rows.Add(R);
            string tipoUtente = NoNull(P.Session["TipoUtente"]).ToString();

            if (tipoUtente.ToLower() == "fornitore")
            {
                R["Utente"]      = NoNull(P.Session["Fornitore"]);
                R["LoginUtente"] = NoNull(P.Session["LoginFornitore"]);
            }
            if (tipoUtente.ToLower() == "responsabile")
            {
                R["Utente"]      = NoNull(P.Session["Responsabile"]);
                R["LoginUtente"] = NoNull(P.Session["LoginResponsabile"]);
            }
            if (tipoUtente.ToLower() == "utente")
            {
                R["Utente"]      = NoNull(P.Session["Utente"]);
                R["LoginUtente"] = NoNull(P.Session["Utente"]);
            }
            if (tipoUtente.ToLower() == "utente ldap")
            {
                R["Utente"]      = NoNull(P.Session["Utente"]);
                R["LoginUtente"] = NoNull(P.Session["Utente"]);
            }


            PostData PD = new PostData();

            PD.initClass(DS, Conn);
            ProcedureMessageCollection MCOLL = PD.DO_POST_SERVICE();

            if (MCOLL.CanIgnore && MCOLL.Count > 0)
            {
                PD.DO_POST_SERVICE();
            }
            Conn.Close();
        }
Пример #17
0
        void DoLDAP(string S1)
        {
            this.Response.Clear();
            //this.Response.Output.Write(S);
            Hashtable   HH  = DataAccess.GetHashFromString(S1);
            string      E   = "Errore";
            QueryHelper QHS = Conn.GetQueryHelper();



            try {
                //Elabora la Hashtable per la mail
                string user = HH["usr"] as string;
                string pwd  = HH["pwd"] as string;
                string dep  = HH["dep"] as string;


                ldapauth LA = new ldapauth(Conn);
                if (!LA.getconfig())
                {
                    this.Response.Output.Write("Errore LA.getconfig: " + LA.ErrorMsg);
                    return;
                }
                if (!LA.Authenticate(user, pwd))
                {
                    this.Response.Output.Write("Errore LA.Authenticate: " + LA.ErrorMsg +
                                               "(servername=" + LA.servername + "port=" + LA.port.ToString() + "user="******",pwd=" + pwd + ")");
                    return;
                }
                user = LA.user_decoded;

                string filter = QHS.AppAnd(QHS.CmpEq("username", user),
                                           QHS.CmpEq("codicedipartimento", dep),
                                           QHS.CmpEq("userkind", 4)
                                           );
                // 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)
                {
                    this.Response.Output.Write("Errore: virtualuser not found (" + filter + ")");
                    Conn.Destroy();
                    return;
                }

                DataRow VU = virtualuser.Rows[0];



                string    filterdip = QHS.CmpEq("codicedipartimento", dep);
                DataTable CodDip    = Conn.RUN_SELECT("codicidipartimenti", "*", null, filterdip, null, true);
                if ((CodDip == null) || (CodDip.Rows.Count != 1))
                {
                    Conn.Destroy();
                    return;
                }
                Hashtable Hresp = new Hashtable();
                Hresp["usr"]  = GetVars.DecryptPassword(GetVars.ConvBytes(CodDip.Rows[0]["UserDB"]));
                Hresp["pwd"]  = GetVars.DecryptPassword(GetVars.ConvBytes(CodDip.Rows[0]["PassDB"]));
                Hresp["vusr"] = VU["sys_user"].ToString();
                E             = DataAccess.GetStringFromHashTable(Hresp);
            }
            catch (Exception EE) {
                E = "Errore:" + QueryCreator.GetErrorString(EE);
            }
            Conn.Destroy();
            this.Response.Output.Write(E.ToString());
        }
Пример #18
0
        bool ConnectToDepartment(string codice, string user, string pwd, DateTime datacontabile)
        {
            string     error;
            DataAccess Conn = GetVars.GetSystemDataAccess(this, out error);


            if (codice.Trim().Length == 0)
            {
                lblError.Text = "Non è stato selezionato alcun dipartimento";
                return(false);
            }

            if (user == "")
            {
                lblError.Text = "Nessun nome utente specificato";
                return(false);
            }

            if (pwd == "")
            {
                lblError.Text = "Nessuna password specificata";
                return(false);
            }


            Session["DBSysConn"] = Conn;
            //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
                lblError.Text = "Il codice inserito non è corretto.";
                return(false);
            }
            if (CodDip.Rows.Count > 1)
            {
                //Attenzione nel DB non è garantita l'unicità dei dati.
                lblError.Text = "Chiedere al Responsabile del servizio " +
                                "l'assegnazione di un nuovo Codice";
                return(false);
            }

            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. Controllare Nome Utente e/o Password";
                string err2 = "Connessione al db del dipartimento " + codice +
                              " non riuscita. <br/>" + err;
                lblError.Text = err2;
                return(false);
            }
            Session["DBUserConn"] = UsrConn;
            return(true);
        }
Пример #19
0
        protected void Page_Load(object sender, EventArgs e)
        {
            string FileName;
            string cmd   = Session["AttachmentCommand"] as string;
            string fname = Session["AttachmentFileName"] as string;

            if (cmd == null)
            {
                return;
            }

            string MyGuid = Session.SessionID.ToString();
            string str;

            str = DateTime.Now.ToString();
            str = str.Replace("/", "");
            str = str.Replace(".", "");
            str = str.Replace(" ", "");
            //Costruisce il nome del File (AnnoMeseGiornoOraMinutiSecondi)
            //FileName = str.Substring(4,4) + str.Substring(2,2) + str.Substring(0,2) + "h" + str.Substring(8,str.Length - 8);
            string prefix = Session["TipoUtente"] as String;

            if (prefix == "fornitore")
            {
                prefix += "-" + Session["CodiceFornitore"].ToString();
            }
            if (prefix == "responsabile")
            {
                prefix += "-" + Session["CodiceResponsabile"].ToString();
            }


            prefix = GetVars.GetUsrVar(this, "CodiceDipartimento").ToString() + "-" + prefix + "-";
            prefix = prefix.Replace("\\", "");
            prefix = prefix.Replace("/", "");
            prefix = prefix.Replace("*", "");
            prefix = prefix.Replace("?", "");
            prefix = prefix.Replace("$", "");
            prefix = prefix.Replace("%", "");


            FileName = prefix + "-" + System.Guid.NewGuid().ToString() + fname;

            string errmess;

            Easy_DataAccess Conn = GetVars.GetUserConn(this);
            object          doc  = Conn.DO_SYS_CMD(cmd, true);



            if (doc == null || doc == DBNull.Value)
            {
                Session["Messaggio"]          = "Documento non trovato";
                Session["CloseWindow"]        = true;
                Session["AttachmentCommand"]  = null;
                Session["AttachmentFileName"] = null;
                Response.Redirect("Messaggio.aspx");
                return;
            }


            // Restituisce il percorso fisico locale della cartella ReportPDF  ex: c:\inetpub\wwwroot\.....
            string FilePath = this.MapPath("ReportPDF");

            if (!FilePath.EndsWith("\\"))
            {
                FilePath += "\\";
            }

            string filenametodelete = FilePath + prefix + "*.*";

            string[] existingreports = System.IO.Directory.GetFiles(
                FilePath, prefix + "*.*");
            foreach (string filename in existingreports)
            {
                System.IO.File.Delete(filename);
            }

            string PDFfilePathRedir =   //FilePath +
                                      "ReportPDF/" +
                                      FileName;

            string     sw = Path.Combine(FilePath, FileName);
            FileStream FS = new FileStream(sw, FileMode.Create, FileAccess.Write);

            byte[] ByteArray = (byte[])doc;

            int n = ByteArray.Length;

            if (n == 0)
            {
                Session["Messaggio"]          = "Documento non trovato";
                Session["CloseWindow"]        = true;
                Session["AttachmentCommand"]  = null;
                Session["AttachmentFileName"] = null;
                Response.Redirect("Messaggio.aspx");
                return;
            }

            try {
                FS.Write(ByteArray, 0, n);//<<<<<<<<<
                FS.Flush();
                FS.Close();
            }
            catch {
                string mym = "Non è stato possibile completare il salvataggio del file. \r";
                Session["CloseWindow"] = true;
                Session["Messaggio"]   = mym;
                Response.Redirect("Messaggio.aspx");
                return;
            }
            //Visualizza il Report in formato PDF
            //WebLog.Log(this,"Visualizza il file in formato PDF");
            Session["AttachmentCommand"]  = null;
            Session["AttachmentFileName"] = null;

            Response.Redirect(PDFfilePathRedir);
        }
Пример #20
0
        protected void Page_Load(object sender, System.EventArgs e)
        {
            string     error = "";
            DataAccess sys   = GetVars.GetSystemDataAccess(this, out error);

            if (sys == null)
            {
                labMsg.Text = "Servizio Web non installato correttamente.";
                if (error != null)
                {
                    labMsg.Text += error;
                }
                return;
            }
            if (Session["pwd_system"] != null)
            {
                LabelPasswordCfg.Visible = false;
            }
            // Put user code to initialize the page here
            if (IsPostBack)
            {
                string pwdsys = Request.Form["txtPwdSystem"].ToString();
                if (Session["pwd_system"] == null)
                {
                    if (pwdsys != "web report fc-hires")
                    {
                        labMsg.Text = "Password di sistema non accettata.";
                        return;
                    }
                    Session["pwd_system"] = "1";
                }
                string          dip    = txtDip.Text;
                string          codice = txtCodice.Text;
                string          ip     = txtIP.Text;
                string          db     = txtDB.Text;
                string          user   = txtUser.Text;
                string          pwd    = Request.Form["txtPWD"].ToString();
                Easy_DataAccess Conn   = new Easy_DataAccess(
                    "mydsn", ip, db, user, pwd, user, pwd, DateTime.Now.Year, DateTime.Now);
                if (Conn == null)
                {
                    labMsg.Text = "Non è stato possibile collegarsi al server.";
                    return;
                }
                Conn.Open();
                if (Conn.OpenError)
                {
                    labMsg.Text = "Non è stato possibile collegarsi al server.";
                    return;
                }
                Conn.Close();
                DataSet     DS        = new Dipartimenti();
                QueryHelper QHS       = sys.GetQueryHelper();
                string      searchdip = QHS.CmpEq("CodiceDipartimento", codice);
                if (sys.RUN_SELECT_COUNT("CodiciDipartimenti", searchdip, true) > 0)
                {
                    labMsg.Text = "Codice dipartimento già esistente, sarà aggiornato.";
                    DataTable T = DS.Tables[0];
                    sys.RUN_SELECT_INTO_TABLE(T, null, searchdip, null, false);
                    DataRow R = T.Rows[0];
                    R["CodiceDipartimento"] = codice;
                    R["dipartimento"]       = dip;
                    R["IPserver"]           = GetVars.CryptPassword(ip);
                    R["NomeDB"]             = GetVars.CryptPassword(db);
                    R["UserDB"]             = GetVars.CryptPassword(user);
                    R["PassDB"]             = GetVars.CryptPassword(pwd);
                }
                else
                {
                    DataTable T = DS.Tables[0];
                    DataRow   R = T.NewRow();
                    R["CodiceDipartimento"] = codice;
                    R["dipartimento"]       = dip;
                    R["IPserver"]           = GetVars.CryptPassword(ip);
                    R["NomeDB"]             = GetVars.CryptPassword(db);
                    R["UserDB"]             = GetVars.CryptPassword(user);
                    R["PassDB"]             = GetVars.CryptPassword(pwd);
                    T.Rows.Add(R);
                }
                PostData CP = new PostData();
                CP.InitClass(DS, sys);
                ProcedureMessageCollection MCOLL = CP.DO_POST_SERVICE();
                if (!MCOLL.CanIgnore)
                {
                    labMsg.Text = "Delle regole di sicurezza impediscono l'update del db di sistema!!";
                    return;
                }

                if (MCOLL.Count > 0)
                {
                    MCOLL = CP.DO_POST_SERVICE();
                    if (!MCOLL.CanIgnore)
                    {
                        labMsg.Text = "Delle regole di sicurezza hanno impedito l'update del db di sistema!!";
                        return;
                    }
                }

                labMsg.Text = "DB DI SISTEMA Aggiornato correttamente.";
            }
        }
Пример #21
0
        protected void Page_Load(object sender, System.EventArgs e)
        {
            string  FileName;
            DataRow Rep = Session["ExportRow"] as DataRow;

            if (Rep == null)
            {
                return;
            }

            string MyGuid = Session.SessionID.ToString();
            string str;

            str = DateTime.Now.ToString();
            str = str.Replace("/", "");
            str = str.Replace(".", "");
            str = str.Replace(" ", "");
            //Costruisce il nome del File (AnnoMeseGiornoOraMinutiSecondi)
            //FileName = str.Substring(4,4) + str.Substring(2,2) + str.Substring(0,2) + "h" + str.Substring(8,str.Length - 8);
            string prefix = Session["TipoUtente"] as String;

            if (prefix == "fornitore")
            {
                prefix += "-" + Session["CodiceFornitore"].ToString();
            }
            if (prefix == "responsabile")
            {
                prefix += "-" + Session["CodiceResponsabile"].ToString();
            }
            prefix = GetVars.GetUsrVar(this, "CodiceDipartimento").ToString() + "-" + prefix + "-";
            prefix = prefix.Replace("\\", "");
            prefix = prefix.Replace("/", "");
            prefix = prefix.Replace("*", "");
            prefix = prefix.Replace("?", "");
            prefix = prefix.Replace("$", "");
            prefix = prefix.Replace("%", "");

            MetaMaster MM = Master as MetaMaster;


            FileName = prefix + Rep["procedurename"].ToString() + "-" + System.Guid.NewGuid().ToString();

            DataTable UserPar = (DataTable)Session["UserPar"];

            if (UserPar == null)
            {
                return;
            }
            DataRow Par = UserPar.Rows[0];
            string  errmess;

            Easy_DataAccess Conn = GetVars.GetUserConn(this);


            // Restituisce il percorso fisico locale della cartella ReportPDF  ex: c:\inetpub\wwwroot\.....
            string FilePath = this.MapPath("ReportPDF");

            if (!FilePath.EndsWith("\\"))
            {
                FilePath += "\\";
            }

            string filenametodelete = FilePath + prefix + "*.*";

            string  [] existingreports = System.IO.Directory.GetFiles(
                FilePath, prefix + "*.*");
            foreach (string filename in existingreports)
            {
                System.IO.File.Delete(filename);
            }
            string fileFormat = Rep["fileformat"].ToString();
            string extension  = "";

            switch (fileFormat)
            {
            case "F":
                extension = ".txt";
                break;

            case "T":
                extension = ".txt";
                break;

            case "C":
                extension = ".csv";
                break;

            case "E":
                extension = ".xlsx";
                break;
            }

            string PDFfilePathRedir =   //FilePath +
                                      "ReportPDF/" +
                                      FileName + extension;
            string PDFfilePathToCreate = FilePath +
                                         FileName + extension;


            int          count           = 0;
            const string DummyPrimaryKey = "DummyPrimaryKeyField";
            const string DummyField      = "reportname";


            object[] ReportParams = new object[UserPar.Columns.Count - 2];
            foreach (DataColumn C in UserPar.Columns)
            {
                string colname = C.ColumnName;
                if (colname == DummyPrimaryKey)
                {
                    continue;
                }
                if (colname == DummyField)
                {
                    continue;
                }
                bool Convert = (bool)C.ExtendedProperties["ConvertNullToPerc"];
                Type tipo    = Par.Table.Columns[colname].DataType;
                if (Convert && (tipo == typeof(string)) && (Par[colname].ToString() == ""))
                {
                    Par[colname] = "%";
                }
                ReportParams[count++] = Par[colname];
            }

            int timeout = 300;

            try {
                if (Rep["timeout"] != DBNull.Value)
                {
                    timeout = Convert.ToInt32(
                        Rep["timeout"]) * 60;
                    if (timeout == 0)
                    {
                        timeout = 300;
                    }
                }
            }
            catch {
            }
            string  ExportName = Rep["procedurename"].ToString();
            DataSet Out        = Conn.CallSP(ExportName, ReportParams, true, timeout);


            if ((Out == null) || (Out.Tables.Count == 0))
            {
                string mym = "La stored procedure " + ExportName +
                             " è stata valutata e non ha restituito alcun risultato.";
                //MM.ShowClientMessage(mym, "Avviso",  System.Windows.Forms.MessageBoxButtons.OK);
                Session["CloseWindow"] = true;
                Session["Messaggio"]   = mym;


                Response.Redirect("Messaggio.aspx");
                return;
            }
            if (Out.Tables[0].Rows.Count == 0)
            {
                string mym = "La stored procedure " + ExportName +
                             " è stata valutata e non ha restituito alcun risultato.";
                //MM.ShowClientMessage(mym, "Avviso",       System.Windows.Forms.MessageBoxButtons.OK);

                Session["CloseWindow"] = true;
                Session["Messaggio"]   = mym;
                Session["UserPar"]     = null;
                Session["ExportRow"]   = null;

                Response.Redirect("Messaggio.aspx");
                return;
            }

            DataTable OutTable = Out.Tables[0];

            OutTable.TableName = Rep["description"].ToString();

            string result = null;

            switch (fileFormat)
            {
            case "F": metadatalibrary.exportclass.dataTableToFixedLengthFile(OutTable, false, PDFfilePathToCreate); break;

            case "T": metadatalibrary.exportclass.dataTableToTabulationSeparatedValues(OutTable, false, PDFfilePathToCreate); break;

            case "C": metadatalibrary.exportclass.dataTableToCommaSeparatedValues(OutTable, false, PDFfilePathToCreate); break;

            case "E": result = metadatalibrary.exportclass.DataTableToExcel(OutTable, true, null, null,
                                                                            PDFfilePathToCreate);
                break;
            }
            if (!string.IsNullOrEmpty(result))
            {
                Session["Messaggio"] = result;
                //MM.ShowClientMessage(result, "Avviso", System.Windows.Forms.MessageBoxButtons.OK);
                Session["CloseWindow"] = true;
                Response.Redirect("Messaggio.aspx");
                return;
            }
            //Visualizza il Report in formato PDF
            //WebLog.Log(this,"Visualizza il file in formato PDF");
            Response.Clear();

            Session["UserPar"]   = null;
            Session["ExportRow"] = null;
            Response.Redirect(PDFfilePathRedir);
        }
Пример #22
0
        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);
        }
Пример #23
0
        private void CheckSecurityOnMenuButtons(MyMenuClass myMenu)
        {
            string     filter  = "";
            DataAccess UsrConn = GetVars.GetUserConn(this);

            if (((UsrConn == null) || (UsrConn.Open() == false)))
            {
                return;
            }

            CQueryHelper QHC = new CQueryHelper();
            QueryHelper  QHS = UsrConn.GetQueryHelper();

            string fitermenu = QHS.FieldInList("metadata",
                                               QHS.List("upb", "underwriting", "mandate", "finvar", "accountvar", "enactment", "accountenactment", "itineration"));
            DataTable DT = UsrConn.RUN_SELECT("menu", "*", "ordernumber,paridmenu", fitermenu, null, false);


            UsrConn.Security.DeleteAllUnselectable(DT);

            DataTable webconfig             = UsrConn.RUN_SELECT("web_config", "*", null, null, null, false);
            DataRow   rwebconf              = webconfig.Rows[0];
            bool      menuitinerationlist   = (rwebconf["menuitinerationlist"].ToString().ToUpper() == "S");
            bool      menuitinerationinsert = (rwebconf["menuitinerationinsert"].ToString().ToUpper() == "S");

            // UPB
            filter = QHC.CmpEq("metadata", "upb");
            var DR = DT.Select(filter);

            if (DR.Length == 0)
            {
                Upb = false;
            }


            //Finanziamento
            filter = QHC.CmpEq("metadata", "underwriting");
            DR     = DT.Select(filter);
            if (DR.Length == 0)
            {
                Finanziamento = false;
            }


            // Buono D'ordine
            filter = QHC.CmpEq("metadata", "mandate");
            DR     = DT.Select(filter);
            if (DR.Length == 0)
            {
                BuonoOrdine = false;
            }

            // Variazioni di Bilancio
            filter = QHC.CmpEq("metadata", "finvar");
            DR     = DT.Select(filter);
            if (DR.Length == 0)
            {
                VarPrev     = false;
                VarIniziale = false;
            }

            // TODO: Verificare l'utilità di questa condizione!
            // Variazioni di Bilancio per Viterbo
            //Filter = QHC.CmpEq("metadata", "viterbo_finvar");
            //DR = DT.Select(Filter);
            //if (DR.Length == 0) {
            //    VarPrev = false;
            //    VarIniziale = false;
            //}

            // Variazioni di Budget
            filter = QHC.CmpEq("metadata", "accountvar");
            DR     = DT.Select(filter);
            if (DR.Length == 0)
            {
                VarPrevBudget     = false;
                VarInizialeBudget = false;
            }
            // Atto Amministrativo
            filter = QHC.CmpEq("metadata", "enactment");
            DR     = DT.Select(filter);
            if (DR.Length == 0)
            {
                Atto = false;
            }
            // Atto Amministrativo di Budget
            filter = QHC.CmpEq("metadata", "accountenactment");
            DR     = DT.Select(filter);
            if (DR.Length == 0)
            {
                AttoBudget = false;
            }
            ////Ricarica cards
            //Filter = QHC.CmpEq("metadata", "lcardvar");
            //DR = DT.Select(Filter);
            //if (DR.Length == 0) RicaricaCard = false;

            MyMenuClass bil = null;

            if (Upb || Finanziamento)
            {
                bil = new MyMenuClass("Bilancio", null, null);

                if (Finanziamento)
                {
                    MyMenuClass m = new MyMenuClass("Finanziamento", "f", "underwriting.defaultnew02");
                    bil.AddChild(m);
                }
                if (Upb)
                {
                    MyMenuClass m = new MyMenuClass("UPB", "f", "upb.defaultnew02");
                    bil.AddChild(m);
                }
            }

            MyMenuClass ep = null;

            if (VarPrevBudget || VarInizialeBudget || AttoBudget)
            {
                ep = new MyMenuClass("E/P", null, null);
                if (VarInizialeBudget)
                {
                    MyMenuClass m = new MyMenuClass("Previsioni iniziali di Budget", "f", "accountvar.inizialenew02");
                    ep.AddChild(m);
                }

                if (VarPrevBudget)
                {
                    MyMenuClass m = new MyMenuClass("Variazione previsioni di Budget", "f", "accountvar.defaultnew02");
                    ep.AddChild(m);
                }
                if (AttoBudget)
                {
                    MyMenuClass m = new MyMenuClass("Atto Amministrativo di Budget", "f", "accountenactment.default");
                    ep.AddChild(m);
                }
            }

            MyMenuClass fin = null;

            //if (BuonoOrdine || VarPrev || Atto || RicaricaCard || GestisciCard || VarIniziale) {
            if (BuonoOrdine || VarPrev || ViterboVarPrev || Atto || RicaricaCard || GestisciCard || VarIniziale)
            {
                fin = new MyMenuClass("Finanziario", null, null);
                if (BuonoOrdine)
                {
                    MyMenuClass m = new MyMenuClass("Richiesta buono d'ordine", "f", "mandate.defaultnew02");
                    fin.AddChild(m);
                }
                if (VarIniziale)
                {
                    MyMenuClass m = new MyMenuClass("Previsioni iniziali", "f", "finvar.inizialenew02");
                    fin.AddChild(m);
                }

                if (VarPrev)
                {
                    MyMenuClass m = new MyMenuClass("Variazione previsioni", "f", "finvar.defaultnew02");
                    fin.AddChild(m);
                }

                // Inserita per Viterbo
                if (ViterboVarPrev && Session["system_config_previsioni_viterbo"] as string == "S")
                {
                    MyMenuClass m = new MyMenuClass("Viterbo - Variazione previsioni", "f", "viterbo_finvar.default");

                    // MyMenuClass m = new MyMenuClass("Viterbo - Variazione previsioni", "f", "viterbo_finvar_default");
                    //MyMenuClass m = new MyMenuClass("Viterbo - Variazione previsioni", "f", "viterbofinvar.default");
                    fin.AddChild(m);
                }

                if (Atto)
                {
                    MyMenuClass m = new MyMenuClass("Atto Amministrativo", "f", "enactment.defaultnew02");
                    fin.AddChild(m);
                }

                if (RicaricaCard)
                {
                    MyMenuClass m = new MyMenuClass("Ricarica card", "f", "lcardvar.default");
                    fin.AddChild(m);
                }
                if (GestisciCard)
                {
                    MyMenuClass m = new MyMenuClass("Gestisci card", "f", "lcard.default");
                    fin.AddChild(m);
                }
            }


            //Vetrina
            //Filter = QHC.CmpEq("metadata", "booking");
            string allowbooking = "'S'";

            if (UsrConn.GetUsr("ric_magazzino") != null)
            {
                allowbooking = UsrConn.GetUsr("ric_magazzino").ToString().ToUpper();
            }
            if (allowbooking != "'S'")
            {
                Prenota           = false;
                PrenotaMyTeam     = false;
                PrenotaWait       = false;
                Vetrina           = false;
                IngressoMagazzino = false;
            }


            //if (UsrConn.GetUsr("missioni") != null) {
            //    string managecompensi = UsrConn.GetUsr("missioni").ToString();
            //}
            // Missioni
            filter = QHC.CmpEq("metadata", "itineration");
            DR     = DT.Select(filter);
            if (DR.Length == 0)
            {
                Missioni        = false;
                MissioniAuth    = false;
                MissioniMyTeam  = false;
                CataniaMissioni = false;
            }
            else
            {
                if (Session["CodiceResponsabile"] == null)
                {
                    MissioniMyTeam = false;
                }
                int idauthagency = GetImpersonatedAuthAgency(UsrConn);
                if (idauthagency == 0)
                {
                    MissioniAuth = false;
                }
            }

            MyMenuClass mag = null;

            if (Prenota || PrenotaMyTeam || PrenotaWait || Vetrina || IngressoMagazzino)
            {
                mag = new MyMenuClass("Magazzino");

                if (Vetrina)
                {
                    MyMenuClass m = new MyMenuClass("Vetrina", "f", "showcase.defaultnew02");
                    mag.AddChild(m);
                }
                if (Prenota)
                {
                    MyMenuClass m = new MyMenuClass("Mie Prenotazioni", "f", "booking.defaultnew02");
                    mag.AddChild(m);
                }
                if (PrenotaMyTeam)
                {
                    MyMenuClass m = new MyMenuClass("Prenotazioni del mio Team", "f", "booking.myteamnew02");
                    mag.AddChild(m);
                }
                if (PrenotaWait)
                {
                    MyMenuClass m = new MyMenuClass("Prenotazioni da autorizzare", "f", "bookingdetail.defaultnew02");
                    mag.AddChild(m);
                }
                if (IngressoMagazzino)
                {
                    MyMenuClass m = new MyMenuClass("Stampa Check In magazzino", "s", "ingressomagazzino");
                    mag.AddChild(m);
                }
            }

            MyMenuClass mis = null;

            if (MissioniMyTeam || MissioniAuth || Missioni || CataniaMissioni)
            {
                mis = new MyMenuClass("Missioni");
                if (Missioni)
                {
                    if (true || menuitinerationinsert)
                    {
                        MyMenuClass m1 = new MyMenuClass("Richiesta Missione", "f", "itineration.autoinsertnew02");
                        mis.AddChild(m1);
                    }
                    if (true || menuitinerationlist)
                    {
                        MyMenuClass m2 = new MyMenuClass("Elenco Missioni", "f", "itineration.autolistnew02");
                        mis.AddChild(m2);
                    }

                    MyMenuClass m = new MyMenuClass("Missioni", "f", "itineration.defaultnew02");
                    mis.AddChild(m);
                }

                if (MissioniMyTeam)
                {
                    MyMenuClass m = new MyMenuClass("Missioni sui miei fondi", "f", "itineration.myteamnew02");
                    mis.AddChild(m);
                }
                if (MissioniAuth)
                {
                    MyMenuClass m = new MyMenuClass("Autorizza Missioni", "f", "itinerationauthview.defaultnew02");
                    mis.AddChild(m);
                }
                if (CataniaMissioni)
                {
                    MyMenuClass m = new MyMenuClass("Missioni(Catania)", "f", "itineration.ct_default");
                    mis.AddChild(m);
                }
            }

            if (bil != null || fin != null || ep != null || mag != null || mis != null)
            {
                MyMenuClass funz = new MyMenuClass("Funzioni");
                myMenu.AddChild(funz);

                if (bil != null)
                {
                    funz.AddChild(bil);
                }
                if (fin != null)
                {
                    funz.AddChild(fin);
                }
                if (mag != null)
                {
                    funz.AddChild(mag);
                }
                if (mis != null)
                {
                    funz.AddChild(mis);
                }
                if (ep != null)
                {
                    funz.AddChild(ep);
                }
            }
            // Vanno aggiunti i filtri per la vetrina e la prenotazione
            UsrConn.Close();
            return;
        }
Пример #24
0
        //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() + ")");
        }
Пример #25
0
        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();
        }
Пример #26
0
        void CreaPaginaParametri()
        {
            DataAccess Conn = GetVars.GetUserConn(this);
            DataTable  Params;

            GetParamfromDB();           //Leggo i parametri del report dal DB e imposta var. di sessione
            Params = (DataTable)Session["ParamData"];
            if (Params == null)
            {
                return;
            }
            DataTable UserPar = (DataTable)Session["UserPar"];

            if (UserPar == null)
            {
                return;
            }
            DataRow Par = UserPar.Rows[0];

            TxtBoxArr = new WebControl[15];

            //Disegno la tabella dei parametri
            Table1.Width       = 800;
            Table1.BorderStyle = BorderStyle.Solid;
            //Table1.BackColor = Color.LightSteelBlue;


            int CountParam = 0;

            foreach (DataRow MyRowParam in Params.Rows)
            {
                if (MyRowParam["selectioncode"].ToString() == "costant.hidden")
                {
                    continue;
                }
                CountParam++; //Incrementa il contatore di parametri che mi server per generare gli ID dei controlli
                //Aggiunge una riga alla tabella
                TableRow tRow = new TableRow();
                Table1.Rows.Add(tRow);
                //Aggiunge una cella
                TableCell tCell1 = new TableCell();
                tRow.Cells.Add(tCell1);
                tCell1.Width     = 200;
                tCell1.Font.Bold = true;
                //tCell1.BackColor = Color.LightSteelBlue;
                tCell1.Font.Size = FontUnit.Small;
                tCell1.Text      = MyRowParam["description"].ToString(); //Descrizione del parametro


                //Nome parametro
                string ParamName       = MyRowParam["paramname"].ToString();
                string FlagCombo       = MyRowParam["iscombobox"].ToString();
                bool   FlagNoSelection = MyRowParam["noselectionforall"].ToString().ToUpper() == "S";
                if (IsParamLocked(MyRowParam))
                {
                    TableCell tCell2 = new TableCell();
                    tRow.Cells.Add(tCell2);

                    //Crea una TextBox
                    TextBox myTextBox = new TextBox();

                    //Memorizza la TextBox nell'array di TextBox
                    //TxtBoxArr[countTxt] = myTextBox;
                    myTextBox.Width = 220;
                    tCell2.Controls.Add(myTextBox);
                    MyRowParam["__WebControlID"] = myTextBox.UniqueID;
                    MyRowParam.AcceptChanges();
                    /////////////////////////////////////////////////////////////////////////////////
                    ///Attenzione: Inserire in questa sezione i controlli per il blocco dei parametri
                    //Controllo per Responsabile
                    if (MyRowParam["datasource"].ToString().ToLower() == "manager")
                    {
                        myTextBox.ReadOnly  = true;
                        myTextBox.BackColor = System.Drawing.Color.LightGray;
                        myTextBox.Text      = Session["Responsabile"].ToString();
                        if (MyRowParam["valuemember"].ToString() == "idman")
                        {
                            Par[ParamName] = Session["codiceresponsabile"];
                        }
                        else
                        {
                            Par[ParamName] = Session["Responsabile"];
                        }

                        continue;
                    }

                    if (MyRowParam["datasource"].ToString().ToLower() == "registryreference")
                    {
                        myTextBox.ReadOnly  = true;
                        myTextBox.BackColor = System.Drawing.Color.LightGray;
                        myTextBox.Text      = Session["Fornitore"].ToString();
                        myTextBox.Width     = 300;
                        if (MyRowParam["valuemember"].ToString() == "idreg")
                        {
                            Par[ParamName] = Session["codicefornitore"];
                        }
                        else
                        {
                            Par[ParamName] = Session["Fornitore"];
                        }
                        continue;
                    }
                }

                if (FlagCombo.ToUpper() == "S")
                {
                    //////////////////Aggiunge una DropDownList
                    TableCell tCell2 = new TableCell();
                    tRow.Cells.Add(tCell2);
                    //Crea una dropDownList
                    DropDownList myDropList = new DropDownList();
                    tCell2.Controls.Add(myDropList);
                    DataTable myDtCombo;
                    MyRowParam["__WebControlID"] = myDropList.UniqueID;
                    MyRowParam.AcceptChanges();

                    //Esegue la select per leggere i valori da visualizzare nella dropDownList
                    myDtCombo = GetDataTableXcombo(MyRowParam);
                    foreach (DataRow drCombo in myDtCombo.Rows)
                    {
                        string myValue = drCombo[MyRowParam["displaymember"].ToString()].ToString();
                        if (myValue.Trim() == "")
                        {
                            continue;
                        }
                        myDropList.Items.Add(myValue);
                    }

                    if (FlagNoSelection)
                    {
                        myDropList.Items.Add("%");
                        myDropList.SelectedValue = "%";
                    }
                    if ((ParamName.ToLower().IndexOf("livello") >= 0 || ParamName.ToLower().IndexOf("level") >= 0) &&
                        (MyRowParam["hintkind"].ToString().ToUpper() == "NOHINT")
                        )
                    {
                        if (myDropList.Items.Count > 0)
                        {
                            myDropList.SelectedIndex = 1;
                        }
                    }
                    if (MyRowParam["hintkind"].ToString().ToUpper() != "NOHINT")
                    {
                        try {
                            object    def = DefaultForParameter(MyRowParam);
                            DataRow[] Val = myDtCombo.Select(MyRowParam["valuemember"].ToString() +
                                                             "=" + QueryCreator.quotedstrvalue(def, false));
                            if ((Val != null) && (Val.Length > 0))
                            {
                                myDropList.SelectedValue = Val[0][MyRowParam["displaymember"].ToString()].ToString();
                            }

                            //int NNN = 0;
                            //foreach (DataRow drCombo2 in myDtCombo.Rows) {
                            //    string myValue = drCombo2[0].ToString();
                            //    if (myValue.Trim() == "")
                            //        continue;
                            //    if (myValue == def.ToString()) {
                            //        myDropList.SelectedIndex = NNN;
                            //        break;
                            //    }
                            //    NNN++;
                            //}
                        }
                        catch (Exception E) {
                            QueryCreator.MarkEvent(QueryCreator.GetErrorString(E));
                        };
                    }
                    else
                    {
                        myDropList.SelectedIndex = myDropList.Items.Count - 1;
                    }
                }
                else
                {
                    //////////////////Aggiunge una TextBox

                    TableCell tCell2 = new TableCell();
                    tRow.Cells.Add(tCell2);

                    //Crea una TextBox
                    TextBox myTextBox = new TextBox();

                    //Memorizza la TextBox nell'array di TextBox
                    //TxtBoxArr[countTxt] = myTextBox;
                    myTextBox.Width = 220;
                    tCell2.Controls.Add(myTextBox);
                    MyRowParam["__WebControlID"] = myTextBox.UniqueID;
                    MyRowParam.AcceptChanges();

                    string tag = "x.y" + MyRowParam["tag"].ToString();

                    //Inserisce il valore di default del parametro
                    myTextBox.Text = HelpForm.StringValue(
                        DefaultForParameter(MyRowParam), tag);

                    // myTextBox.ID = "IdParam" + CountParam;  //Assegna un nome ID alla TextBox;


                    ///////////////////////////////////////////////////////////////////////////////////

                    //////////////////Aggiunge la cella di Help
                    TableCell tCell3 = new TableCell();
                    tCell3.Width     = 400;
                    tCell3.Font.Size = FontUnit.XSmall;
                    //tCell3.BackColor = Color.LightSteelBlue;
                    tRow.Cells.Add(tCell3);
                    tCell3.Text = MyRowParam["help"].ToString();
                }
            }
        }
Пример #27
0
        void LeggiParametri()
        {
            DataAccess Conn = GetVars.GetUserConn(this);
            DataTable  Params;

            //Si ricarica dalla Session il Dataset di GetParamFromDB
            Params = (DataTable)Session["ParamData"];
            if (Params != null)
            {
                Params.RejectChanges();
            }
            DataTable UserPar = (DataTable)Session["UserPar"];

            if (Params == null)
            {
                return;
            }
            if (UserPar == null)
            {
                return;
            }
            DataRow Par = UserPar.Rows[0];

            int i = 0;

            foreach (DataRow drParam in Params.Rows)
            {
                if (drParam["selectioncode"].ToString() == "costant.hidden")
                {
                    continue;
                }
                string paramname = drParam["paramname"].ToString();
                i++;
                if (IsParamLocked(drParam))
                {
                    continue;
                }
                //Myid è il nome dato al controllo nella webpage
                string myId = drParam["__WebControlID"].ToString();

                //Leggo i parametri inseriti dall'utente e li memorizzo in variabili di sessione
                //Attenzione: se si tratta di una combo
                string UserValue = (string)Request.Form[myId];
                object ResValue  = DBNull.Value; //valore decodificato

                if (drParam["iscombobox"].ToString().ToUpper() == "S")
                {
                    //Legge la tabella che carica la combo
                    DataTable dtCombo = GetDataTableXcombo(drParam);
                    if (dtCombo != null)
                    {
                        DataRow[] DtComboFiltrata = dtCombo.Select((drParam["displaymember"].ToString() + " = " +
                                                                    QueryCreator.quotedstrvalue(UserValue, true)));
                        if (DtComboFiltrata.Length > 0)
                        {
                            //legge il combocodefield che mi serve per la stored procedure
                            //l'utente a video vedeva invece il combodescfield
                            ResValue = DtComboFiltrata[0][drParam["valuemember"].ToString()];
                        }
                        else
                        {
                            ResValue = UserValue;
                        }
                    }
                }
                else
                {
                    string     tag = "x.y." + drParam["tag"].ToString();
                    DataColumn C   = UserPar.Columns[paramname];
                    ResValue = HelpForm.GetObjectFromString(C.DataType, UserValue, tag);
                }
                if (((ResValue == null) || (ResValue.ToString() == "") || (ResValue.ToString() == "%")) &&
                    (drParam["noselectionforall"].ToString().ToLower() == "s"))
                {
                    if ((GetTypeFromSysType(drParam["systype"].ToString()) == typeof(int)))
                    {
                        ResValue = DBNull.Value;
                    }
                    else
                    {
                        ResValue = "%";
                    }
                }

                if (ResValue == null || (ResValue.ToString() == ""))
                {
                    ResValue = DBNull.Value;
                }
                //Nella colonna ParamValue della Table dei parametri memorizzo il valore inserito dal'utente
                Par[paramname] = ResValue;
            }
        }
Пример #28
0
        void ScaricaPrenotazione(DataAccess Conn, string idbooking)
        {
            vistaform_storeunload_magazzino DS = new vistaform_storeunload_magazzino();
            CQueryHelper QHC = new CQueryHelper();

            QueryHelper QHS = Conn.GetQueryHelper();

            //WebLog.Log(this, "Visualizza Login_Servizi");
            object Obooking_on_invoice = Conn.DO_READ_VALUE("config", QHS.CmpEq("ayear", Conn.GetSys("esercizio")), "booking_on_invoice");

            if (Obooking_on_invoice == null || Obooking_on_invoice == DBNull.Value || Obooking_on_invoice.ToString() == "")
            {
                Obooking_on_invoice = "N";
            }
            Obooking_on_invoice = Obooking_on_invoice.ToString().ToUpper();
            bool booking_on_invoice = (Obooking_on_invoice.ToString() == "S");



            DataTable BookingToUnload = Conn.RUN_SELECT("booktotalview", "*", null,
                                                        QHS.AppAnd(QHS.CmpGt("allocated", 0), QHS.CmpEq("idbooking", idbooking)), null, true);

            DataTable TStockView = Conn.CreateTableByName("stockview", "*");

            TStockView.PrimaryKey = new DataColumn[] { TStockView.Columns["idstock"] };

            Meta_EasyDispatcher Disp = new Meta_EasyDispatcher(Conn);

            MetaData MetaStoreUnload = Disp.Get("storeunload");

            MetaStoreUnload.SetDefaults(DS.storeunload);
            MetaData MetaStoreUnloadDetail = Disp.Get("storeunloaddetail");

            MetaStoreUnloadDetail.SetDefaults(DS.storeunloaddetail);


            DataRow[] Selected = BookingToUnload.Select();
            if (Selected.Length == 0)
            {
                //niente da scaricare
                lblMessaggio.Text = "Non c'è nulla da scaricare";
                txtCodice.Text    = "";
                return;
            }

            DataRow RStoreUnload = MetaStoreUnload.Get_New_Row(null, DS.storeunload);

            RStoreUnload["description"] = "Scarico prenotazione da magazzino";
            RStoreUnload["idstore"]     = Selected[0]["idstore"];
            RStoreUnload["adate"]       = DateTime.Now;

            Hashtable idlistToStock = new Hashtable();//l'elemento della hashtable è un list<int>

            //Prende una riga di prenotazione
            foreach (DataRow R in Selected)    // riga di prenotazione
            {
                string filterbooking       = QHS.CmpEq("idbooking", R["idbooking"]);
                string filterbookingdetail = QHS.AppAnd(filterbooking,
                                                        QHS.CmpEq("idlist", R["idlist"]));

                DataTable B     = Conn.RUN_SELECT("bookingdetail", "*", null, filterbookingdetail, null, false);
                DataTable Bmain = Conn.RUN_SELECT("booking", "*", null, filterbooking, null, false);

                DataRow BookingDetail = null;


                string filterstock = QHS.AppAnd(QHS.CmpEq("idstore", R["idstore"]),
                                                QHS.CmpEq("idlist", R["idlist"]),
                                                QHS.CmpGt("residual", 0));
                string filterstockds = QHC.AppAnd(QHC.CmpEq("idstore", R["idstore"]),
                                                  QHC.CmpEq("idlist", R["idlist"]),
                                                  QHC.CmpGt("residual", 0));


                //legge in TStockView i cespiti di stock disponibili ad essere scaricati

                if (booking_on_invoice)
                {
                    filterstock   = QHS.AppAnd(filterstock, QHS.CmpEq("idstock", R["idstock"]));
                    filterstockds = QHC.AppAnd(filterstockds, QHC.CmpEq("idstock", R["idstock"]));
                }

                if (TStockView.Select(filterstockds).Length == 0)
                {
                    Conn.RUN_SELECT_INTO_TABLE(TStockView, "expiry asc, idstock asc", filterstock, null, true);
                }

                ///SViewRows = cespiti disponibili (da stockview) allo scarico
                DataRow[] SViewRows = TStockView.Select(filterstockds);
                if (SViewRows.Length == 0)
                {
                    continue;
                }

                DataRow RS;
                decimal tounload = CfgFn.GetNoNullDecimal(R["allocated"]);

                int i = 0;
                //Cerca di scaricare prendendo le righe in SViewRows
                while (i < SViewRows.Length && tounload > 0)
                {
                    DataRow RStock     = SViewRows[i];
                    decimal unloadable = CfgFn.GetNoNullDecimal(RStock["residual"]);
                    if (unloadable > tounload)
                    {
                        unloadable = tounload;
                    }
                    //devo scaricare unloadable
                    string fbooking = filterbooking;


                    //devo scaricare unloadable
                    fbooking = QHC.AppAnd(fbooking, QHC.CmpEq("idstock", RStock["idstock"]));

                    //cerca una riga in storeunloaddetail di pari idstock e idbooking (idstock è sempre noto a questo punto)
                    if (DS.storeunloaddetail.Select(fbooking).Length > 0)
                    {
                        RS           = DS.storeunloaddetail.Select(fbooking)[0];
                        RS["number"] = CfgFn.GetNoNullDecimal(RS["number"]) + unloadable;
                    }
                    else
                    {
                        RS              = MetaStoreUnloadDetail.Get_New_Row(DS.storeunload.Rows[0], DS.storeunloaddetail);
                        RS["number"]    = unloadable;
                        RS["idbooking"] = R["idbooking"];
                        // Determino idstock
                        // io ho una serie di di idlist e idstore
                        // in base ai dettagli selezionati mi servono
                        // per accedere alla vista delle giacenze di stock e creo
                        // una tabella che deve essere filtrata per idlist
                        // idstore e giacenza > 0
                        RS["idstock"] = RStock["idstock"];//T.Rows[0]["idstock"];
                        if (B.Rows.Count > 0)
                        {
                            BookingDetail = B.Rows[0];
                            RS["idsor1"]  = BookingDetail["idsor1"];
                            RS["idsor2"]  = BookingDetail["idsor2"];
                            RS["idsor3"]  = BookingDetail["idsor3"];
                            RS["idman"]   = Bmain.Rows[0]["idman"];
                        }
                    }
                    tounload          -= unloadable;
                    RStock["residual"] = CfgFn.GetNoNullDecimal(RStock["residual"]) - unloadable;
                    i++;
                }
            }
            StoreUnloadSendMail SUSM = new StoreUnloadSendMail(Conn);

            SUSM.PrepareMailToSend(DS);

            Easy_PostData EP = new Easy_PostData();

            EP.InitClass(DS, Conn);
            ProcedureMessageCollection PC = EP.DO_POST_SERVICE();

            if (PC.Count > 0)
            {
                string err = "";
                foreach (EasyProcedureMessage PM in PC)
                {
                    err += PM.AuditID + "/" + PM.TableName + "/" + PM.Operation + "/" + PM.EnforcementNumber + "(" + PM.LongMess + ") ";
                }
                string data = "";
                foreach (DataRow r in DS.storeunloaddetail.Rows)
                {
                    data += "[idstock=" + r["idstock"].ToString() + ",number=" + r["number"].ToString() + ",idbooking=" + r["idbooking"].ToString() +
                            ",idman=" + r["idman"].ToString() + "] ";
                }
                lblMessaggio.Text = "Errore in fase di salvataggio dati: " + err + " Data: " + data;
                GetVars.ClearUserConn(this);
            }
            else
            {
                EP.DO_POST_SERVICE();
                DataRow Curr = DS.storeunload.Rows[0];
                StampaReport(Conn, CfgFn.GetNoNullInt32(Curr["idstoreunload"]));
                SUSM.SendMail();
                lblMessaggio.Text = "Scarico effettuato.";
                txtCodice.Text    = "";
            }
        }
Пример #29
0
        protected void Page_Load(object sender, System.EventArgs e)
        {
            string  FileName;
            DataRow Rep = Session["ModuleReportRow"] as DataRow;

            if (Rep == null)
            {
                return;
            }

            string MyGuid = Session.SessionID.ToString();
            string str;

            str = DateTime.Now.ToString();
            str = str.Replace("/", "");
            str = str.Replace(".", "");
            str = str.Replace(" ", "");
            //Costruisce il nome del File (AnnoMeseGiornoOraMinutiSecondi)
            //FileName = str.Substring(4,4) + str.Substring(2,2) + str.Substring(0,2) + "h" + str.Substring(8,str.Length - 8);
            string prefix = Session["TipoUtente"] as String;

            if (prefix == "fornitore")
            {
                prefix += "-" + Session["CodiceFornitore"].ToString();
            }
            if (prefix == "responsabile")
            {
                prefix += "-" + Session["CodiceResponsabile"].ToString();
            }
            prefix = GetVars.GetUsrVar(this, "CodiceDipartimento").ToString() + "-" + prefix + "-";
            prefix = prefix.Replace("\\", "");
            prefix = prefix.Replace("/", "");
            prefix = prefix.Replace("*", "");
            prefix = prefix.Replace("?", "");
            prefix = prefix.Replace("$", "");
            prefix = prefix.Replace("%", "");


            FileName = prefix + Rep["reportname"].ToString() + "-" + System.Guid.NewGuid().ToString();

            DataTable UserPar = (DataTable)Session["UserPar"];

            if (UserPar == null)
            {
                return;
            }
            DataRow Par = UserPar.Rows[0];
            string  errmess;

            Easy_DataAccess Conn     = GetVars.GetUserConn(this);
            ReportDocument  myRptDoc = Easy_DataAccess.GetReport(Conn, Rep, Par, out errmess);

            if (myRptDoc == null)
            {
                Session["Messaggio"]       = errmess;
                Session["CloseWindow"]     = true;
                Session["UserPar"]         = null;
                Session["ModuleReportRow"] = null;

                Response.Redirect("Messaggio.aspx");
                return;
            }


            // Restituisce il percorso fisico locale della cartella ReportPDF  ex: c:\inetpub\wwwroot\.....
            string FilePath = this.MapPath("ReportPDF");

            if (!FilePath.EndsWith("\\"))
            {
                FilePath += "\\";
            }

            string filenametodelete = FilePath + prefix + "*.*";

            string  [] existingreports = System.IO.Directory.GetFiles(
                FilePath, prefix + "*.*");
            foreach (string filename in existingreports)
            {
                System.IO.File.Delete(filename);
            }

            string PDFfilePathRedir =                   //FilePath +
                                      "ReportPDF/" +
                                      FileName + ".pdf";
            string myFilePdf = ExportToPdf(myRptDoc, FileName, FilePath);

            myRptDoc.Close();
            myRptDoc.Dispose();
            if (myFilePdf == null)
            {
                string mym = "Non è stato possibile completare l'esportazione in formato PDF. \r";
                mym += "E' probabile che i parametri inseriti non siano corretti. \r";
                mym += "Qualora avesse bisogno di assistenza può contattare il servizio assistenza ";
                Session["CloseWindow"] = true;
                Session["Messaggio"]   = mym;
                Response.Redirect("Messaggio.aspx");
                return;
            }
            //Visualizza il Report in formato PDF
            //WebLog.Log(this,"Visualizza il file in formato PDF");
            Session["UserPar"]         = null;
            Session["ModuleReportRow"] = null;
            GC.Collect();
            Response.Redirect(PDFfilePathRedir);
        }
Пример #30
0
        protected void Page_Load(object sender, EventArgs e)
        {
            DataAccess Conn = GetVars.GetUserConn(Page);

            if (Conn == null)
            {
                return;
            }

            QHS = Conn.GetQueryHelper();
            string idcustomuser = Conn.GetSys("user").ToString();
            object currdate     = Conn.GetSys("datacontabile");
            object idflowchart  = Conn.GetSys("idflowchart");
            object ndetail      = Conn.GetSys("ndetail");

            if (idcustomuser == "")
            {
                return;
            }
            string def_val = "";

            string f1 = QHS.AppAnd(QHS.CmpEq("U.idcustomuser", idcustomuser),
                                   QHS.NullOrLe("U.start", currdate), QHS.NullOrGe("U.stop", currdate));

            f1 = QHS.AppAnd(f1, QHS.CmpEq("F.ayear", Conn.GetSys("esercizio")));
            bool err = false;

            DataTable T = Conn.SQLRunner("select U.idflowchart, isnull(U.title,F.title) as title, " +
                                         "U.ndetail from flowchartuser U join " +
                                         " flowchart F on U.idflowchart=F.idflowchart where " + f1, true, -1);

            if (T == null)
            {
                err = true;

                T = Conn.SQLRunner("select U.idflowchart, F.title, " +
                                   "U.ndetail from flowchartuser U join " +
                                   " flowchart F on U.idflowchart=F.idflowchart where " + f1, true, -1);

                T.PrimaryKey = new DataColumn[] { T.Columns["idflowchart"] };

                T.Columns.Add(new DataColumn("k", typeof(String)));
                foreach (DataRow R in T.Rows)
                {
                    R["k"] = R["idflowchart"].ToString() + "§" +
                             R["ndetail"].ToString();
                }
            }
            else
            {
                err = false;
                T.Columns.Add(new DataColumn("k", typeof(String)));
                foreach (DataRow R in T.Rows)
                {
                    R["k"] = R["idflowchart"].ToString() + "§" +
                             R["ndetail"].ToString();
                }
            }

            def_val = idflowchart.ToString() + "§" + ndetail.ToString();

            T.PrimaryKey = new DataColumn[] { T.Columns["k"] };
            if (T.Rows.Count == 0)
            {
                return;
            }

            if (!IsPostBack)
            {
                cmbruolo.DataSource    = T;
                cmbruolo.DataTextField = "title";


                cmbruolo.DataValueField = "k";
            }
            cmbruolo.DataBind();

            if (!IsPostBack)
            {
                if (err)
                {
                    try {
                        if (T.Rows.Count > 0)
                        {
                            cmbruolo.SelectedValue = def_val;
                        }
                    }
                    catch { }
                }
                else
                {
                    try {
                        if (T.Rows.Count > 0 && ndetail != null && ndetail != DBNull.Value)
                        {
                            cmbruolo.SelectedValue = def_val;
                        }
                    }
                    catch { }
                }
            }
        }