Exemple #1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void BttConferma_Click(object sender, System.EventArgs e)
        {
            Classi.Sicurezza _Sic    = new Classi.Sicurezza();
            Classi.Utente    _Utente = new TheSite.Classi.Utente();

            txtsPasword.Text = _Sic.EncryptMD5(txtsPasword.Text);
            //txtsPasword.Text = _Sic.EncryptSHA1(txtsPasword.Text);
            try
            {
                int i_IdUtente = _Utente.Login(this);

                if (i_IdUtente > 0)
                {
                    string url = FormsAuthentication.GetRedirectUrl(txtsUserName.Text, false);
                    //					FormsAuthentication.SetAuthCookie(txtsUserName.Text,false);
                    //
                    //					Response.Redirect(url);
                    string[] a_roles = _Utente.GetRuoli(txtsUserName.Text);

                    string roleStr = "";
                    double ore     = 8;
                    foreach (String role in a_roles)
                    {
                        //if(role.ToUpper()=="CALLCENTER")
                        //	ore=8;
                        roleStr += role;
                        roleStr += ";";
                    }

                    FormsAuthenticationTicket ticket = new FormsAuthenticationTicket(
                        1,
                        txtsUserName.Text,
                        DateTime.Now,                                           // issue time
                        DateTime.Now.AddHours(ore),                             // expires every hour
                        false,                                                  // don't persist cookie
                        roleStr,                                                // roles
                        FormsAuthentication.FormsCookiePath);

                    // Encrypt the ticket.
                    string encTicket = FormsAuthentication.Encrypt(ticket);

                    // Create the cookie.
                    Response.Cookies.Add(new HttpCookie(FormsAuthentication.FormsCookieName, encTicket));

                    // Redirect back to original URL.
                    Response.Redirect(url);
                }
                else
                {
                    PanelMess.ShowError("Utenza o Password errati", true);
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
                //PanelMess.ShowError("Errore interno al Data Base.", true);
                PanelMess.ShowError(ex.Message.ToString(), true);
            }
        }
Exemple #2
0
		/// <summary>
		/// 
		/// </summary>
		/// <param name="IdMenuPadre"></param>
		/// <param name="xTextWriter"></param>
		private void ItemMenu(int IdMenuPadre, XmlTextWriter xTextWriter,string url)
		{
			if (IdMenuPadre > 0)
				xTextWriter.WriteStartElement("subMenu");			
			
			try 
			{				
				DataSet _MyDs = this.GetItemMenuData(IdMenuPadre);
				
				if (_MyDs.Tables[0].Rows.Count > 0)
				{
					Sicurezza _Sic = new Sicurezza();
					foreach(DataRow DtRo in _MyDs.Tables[0].Rows)
					{				
													
						xTextWriter.WriteStartElement("menuItem");
						xTextWriter.WriteElementString("text",DtRo["DESCRIZIONE"].ToString());
						if (DtRo["LINK"] != DBNull.Value && DtRo["LINK"].ToString() != "")
						{
							string s_FunzioneId = DtRo["FUNZIONE_ID"].ToString();
							string s_Link = DtRo["LINK"].ToString();
							s_Link += "?FunId=" + s_FunzioneId;
							s_Link +=url;
							xTextWriter.WriteElementString("url",s_Link);
						}
						
						xTextWriter.WriteElementString("target",DtRo["TARGET"].ToString());
						xTextWriter.WriteElementString("tooltip",DtRo["TOOLTIP"].ToString());
						xTextWriter.WriteElementString("cssclass",DtRo["CSSCLASS"].ToString());
				
						int i_Totf = 0;
						if (DtRo["TOTF"].ToString().Trim() == "")
							i_Totf = 0;
						else
							i_Totf = Convert.ToInt32(DtRo["TOTF"].ToString());
						if (i_Totf > 0)
							ItemMenu(Convert.ToInt32(DtRo["FUNZIONE_MENU_ID"]), xTextWriter,url);

						xTextWriter.WriteEndElement();
				
					}
				}
			}
			catch (Exception ex)
			{
				throw ex;
			}
			finally
			{
				if (IdMenuPadre > 0)
					xTextWriter.WriteEndElement();
			}
		}
Exemple #3
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="IdMenuPadre"></param>
        /// <param name="xTextWriter"></param>
        private void ItemMenu(int IdMenuPadre, XmlTextWriter xTextWriter, string url)
        {
            if (IdMenuPadre > 0)
            {
                xTextWriter.WriteStartElement("subMenu");
            }

            try
            {
                DataSet _MyDs = this.GetItemMenuData(IdMenuPadre);

                if (_MyDs.Tables[0].Rows.Count > 0)
                {
                    Sicurezza _Sic = new Sicurezza();
                    foreach (DataRow DtRo in _MyDs.Tables[0].Rows)
                    {
                        xTextWriter.WriteStartElement("menuItem");
                        xTextWriter.WriteElementString("text", DtRo["DESCRIZIONE"].ToString());
                        if (DtRo["LINK"] != DBNull.Value && DtRo["LINK"].ToString() != "")
                        {
                            string s_FunzioneId = DtRo["FUNZIONE_ID"].ToString();
                            string s_Link       = DtRo["LINK"].ToString();
                            if (s_Link != "http://test.cofasir.it/HOME_PAGE_SNAM_rv.aspx")
                            {
                                s_Link += "?FunId=" + s_FunzioneId;
                            }
                            else
                            {
                                s_Link += "?user="******"url", s_Link);
                        }

                        xTextWriter.WriteElementString("target", DtRo["TARGET"].ToString());
                        xTextWriter.WriteElementString("tooltip", DtRo["TOOLTIP"].ToString());
                        xTextWriter.WriteElementString("cssclass", DtRo["CSSCLASS"].ToString());

                        int i_Totf = 0;
                        if (DtRo["TOTF"].ToString().Trim() == "")
                        {
                            i_Totf = 0;
                        }
                        else
                        {
                            i_Totf = Convert.ToInt32(DtRo["TOTF"].ToString());
                        }
                        if (i_Totf > 0)
                        {
                            ItemMenu(Convert.ToInt32(DtRo["FUNZIONE_MENU_ID"]), xTextWriter, url);
                        }

                        xTextWriter.WriteEndElement();
                    }
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                if (IdMenuPadre > 0)
                {
                    xTextWriter.WriteEndElement();
                }
            }
        }