Example #1
0
        protected override void Render(HtmlTextWriter writer)
        {
            if (IdResource != 0)
            {
                string Context = String.Empty;
                try
                {
                    SessionLanguage Language = (SessionLanguage)System.Web.HttpContext.Current.Session["SessionLanguage"];

                    if (!IsStatic)
                    {
                        Global._ResorceManagerPool.SelectPhrase(IdResource, Language.GetLanguage(), ref Context);
                    }
                    else
                    {
                        Global._ResorceManagerPool.SelectStaticPhrase(IdResource, ref Context);
                    }
                }
                catch (SQLException ex)
                {
                    Context = ex.Message;
                }

                base.Text = Context;
            }

            base.Render(writer);
        }
Example #2
0
        public static String GetPhrase(Int32 i32IdResource, Boolean blnIsStatic, ref Boolean blnRetVal)
        {
            String strRetVal = String.Empty;

            try
            {
                SessionLanguage Language = (SessionLanguage)System.Web.HttpContext.Current.Session["SessionLanguage"];

                if (blnIsStatic)
                {
                    Global._ResorceManagerPool.SelectStaticPhrase(i32IdResource, ref strRetVal);
                }
                else
                {
                    Global._ResorceManagerPool.SelectPhrase(i32IdResource, Language.GetLanguage(), ref strRetVal);
                }
            }
            catch (SQLException Ex)
            {
                Global.ErrorMessage(Ex, System.Web.HttpContext.Current);
                blnRetVal = false;
                return(Ex.Message);
            }
            catch (NullReferenceException Ex)
            {
                Global.ErrorMessage(Ex, System.Web.HttpContext.Current);
                blnRetVal = false;
                return(Ex.Message);
            }

            return(strRetVal);
        }
Example #3
0
        public String GetPhrase(Int32 i32IdResource, Boolean blnIsStatic, ref Boolean blnRetVal)
        {
            String strRetVal = String.Empty;

            try
            {
                SQLDatabase DBConnection = new SQLDatabase(ConfigurationManager.ConnectionStrings["dbConnectionString"].ToString());
                if (DBConnection == null)
                {
                    blnRetVal = false;
                    return(String.Empty);
                }

                DBConnection.Connect();

                ResorceManager Function = new ResorceManager(DBConnection, System.Web.HttpContext.Current.Session);
                if (Function == null)
                {
                    blnRetVal = false;
                    return(String.Empty);
                }

                if (blnIsStatic)
                {
                    Function.SelectStaticPhrase(i32IdResource, ref strRetVal);
                }
                else
                {
                    Function.SelectPhrase(i32IdResource, ref strRetVal);
                }

                DBConnection.Disconnect();

                if (strRetVal == String.Empty)
                {
                    SessionLanguage Language = (SessionLanguage)System.Web.HttpContext.Current.Session["SessionLanguage"];

                    String strError = String.Format("Missing data for phrase witch IdResource = {0} and IdLanguage = {1}!", i32IdResource, Language.GetLanguage());
                    blnRetVal = false;

                    Global.ErrorMessage(strError, System.Web.HttpContext.Current);
                    return("No data for this phrase!");
                }
            }
            catch (SQLException Ex)
            {
                Global.ErrorMessage(Ex, System.Web.HttpContext.Current);
                blnRetVal = false;
                return(Ex.Message);
            }
            catch (NullReferenceException Ex)
            {
                Global.ErrorMessage(Ex, System.Web.HttpContext.Current);
                blnRetVal = false;
                return(Ex.Message);
            }

            return(strRetVal);
        }
Example #4
0
 public ResorceManager(HttpSessionState Session)
 {
     Language = (SessionLanguage)Session["SessionLanguage"];
     if (Language == null)
     {
         throw new NullReferenceException("Not valid instance SESION LANGUAGE !");
     }
 }
Example #5
0
        protected override void Render(HtmlTextWriter writer)
        {
            if (IdResource != 0)
            {
                string Context = String.Empty;

                try
                {
                    SessionLanguage Language = (SessionLanguage)System.Web.HttpContext.Current.Session["SessionLanguage"];
                    Global._ResorceManagerPool.SelectPhrase(IdResource, Language.GetLanguage(), ref Context);
                }
                catch (SQLException ex)
                {
                    Context = ex.Message;
                }

                base.ErrorMessage = String.Format(Context, base.MaximumValue);
            }

            base.Render(writer);
        }
Example #6
0
        protected override void Render(HtmlTextWriter writer)
        {
            if (IdResource.Length == Items.Count)
            {
                String          Context    = String.Empty;
                SessionLanguage Language   = (SessionLanguage)System.Web.HttpContext.Current.Session["SessionLanguage"];
                int             IdLanguage = Language.GetLanguage();

                try
                {
                    foreach (ListItem Item in Items)
                    {
                        Global._ResorceManagerPool.SelectPhrase(Convert.ToInt32(Item.Attributes["ResourceId"]), IdLanguage, ref Context);
                        Item.Text = Context;
                    }
                }
                catch (SQLException ex)
                {
                    Context = ex.Message;
                }
            }

            base.Render(writer);
        }