Beispiel #1
0
        protected void Page_Load(object sender, System.EventArgs e)
        {
            try
            {
                Controller = new BBStoreController();

                LocaleController            lc  = new LocaleController();
                Dictionary <string, Locale> loc = lc.GetLocales(PortalId);

                ModuleController objModules = new ModuleController();

                // If this is the first visit to the page
                if (Page.IsPostBack == false)
                {
                    UnitInfo unit = null;

                    if (Request["unitid"] != null)
                    {
                        UnitId = Convert.ToInt32(Request["unitid"]);
                    }

                    // if unit exists
                    if (UnitId > 0)
                    {
                        unit = Controller.GetUnit(UnitId);
                    }

                    List <ILanguageEditorInfo> dbLangs = new List <ILanguageEditorInfo>();
                    if (unit == null)
                    {
                        txtDecimals.Text = "0";
                        foreach (KeyValuePair <string, Locale> keyValuePair in loc)
                        {
                            UnitLangInfo unitLang = new UnitLangInfo();
                            unitLang.Language = keyValuePair.Key;
                            dbLangs.Add(unitLang);
                        }
                    }
                    else
                    {
                        txtDecimals.Text = unit.Decimals.ToString();
                        foreach (UnitLangInfo unitLang in Controller.GetUnitLangs(UnitId))
                        {
                            dbLangs.Add(unitLang);
                        }
                    }
                    lngUnits.Langs = dbLangs;
                }
            }

            catch (Exception exc)
            {
                //Module failed to load
                Exceptions.ProcessModuleLoadException(this, exc);
            }
        }