Example #1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="index"></param>
        /// <returns></returns>
        /// <exception cref="IndexOutOfRangeException"><c>IndexOutOfRangeException</c>.</exception>
        public ProgramScreen this[int index]
        {
            get
            {
                if (index < 0 || index > this.Count)
                {
                    throw new IndexOutOfRangeException();
                }

                MapKeyValue <string, ProgramScreen> keyValue = m_programScreenList[index];
                if (keyValue == null)
                {
                    return(null);
                }

                return(keyValue.Value);
            }
            set
            {
                if (index < 0 || index > this.Count)
                {
                    throw new IndexOutOfRangeException();
                }

                MapKeyValue <string, ProgramScreen> keyValue = m_programScreenList[index];
                if (keyValue != null)
                {
                    keyValue.Value = value;
                }

                throw new IndexOutOfRangeException(String.Format("Not found item at index: {0}", index));
            }
        }
Example #2
0
        /// <summary>
        /// Initialize all control text following by stored data on database, depend on current user's language.
        /// </summary>
        protected virtual void InitializeControlText()
        {
            if (this.ScreenCode == string.Empty)
            {
                return;
            }

            Map <string, ScreenDetail> mapControlList      = this.GetControlList();
            ScreenDetailLangBIZ        bizScreenDetailLang = new ScreenDetailLangBIZ();

            string langCD = CommonLib.Common.SystemLanguage.StrongValue;

            if (CommonLib.Common.CurrentUserInfomation != null)
            {
                langCD = CommonLib.Common.CurrentUserInfomation.LanguageCD.StrongValue;
            }

            // Load screen detail depend on language.
            List <ScreenDetailLangDTO> listScreenDetailLang = bizScreenDetailLang.LoadScreenDetailByLangCD(this.ScreenCode, langCD);

            for (int i = 0; i < listScreenDetailLang.Count; i++)
            {
                ScreenDetailLangDTO dto = listScreenDetailLang[i];
                MapKeyValue <string, ScreenDetail> mapKeyValue = mapControlList[dto.CONTROL_CD.StrongValue];
                if (mapKeyValue == null)
                {
                    continue;
                }

                ScreenDetail screenDetail = mapKeyValue.Value;
                Control      ctrl         = null;
                switch (screenDetail.Type)
                {
                case ScreenDetail.TYPE_FORM:
                    ctrl = screenDetail.ObjOwner as Control;
                    if (ctrl != null)
                    {
                        ctrl.Text = ScreenAttribute.GetScreenAttribute(screenDetail.ObjOwner.GetType()).ScreenCD + ": " + dto.CONTROL_CAPTION.NVL(string.Empty);
                    }
                    break;

                case ScreenDetail.TYPE_BUTTON:
                case ScreenDetail.TYPE_CHECKBOX:
                case ScreenDetail.TYPE_GROUPBOX:
                case ScreenDetail.TYPE_LABEL:
                case ScreenDetail.TYPE_RADIOBUTTON:
                case ScreenDetail.TYPE_TABPAGE:
                    ctrl = screenDetail.ObjOwner as Control;
                    if (ctrl != null)
                    {
                        ctrl.Text = dto.CONTROL_CAPTION.NVL(string.Empty);
                    }

                    break;

                case ScreenDetail.TYPE_SPREAD_COLUMN:
                    Column column = screenDetail.ObjOwner as Column;
                    if (column != null)
                    {
                        column.Label = dto.CONTROL_CAPTION.NVL(string.Empty);
                    }
                    break;
                }
            }
        }