Exemplo n.º 1
0
        /// <summary>
        /// Key:
        /// <para>SEL, SCREEN_CD, SCREEN_NAME</para>
        /// </summary>
        /// <param name="menuSubCD"></param>
        /// <returns></returns>
        public DataTable LoadScreenFromMenuSub(NZString menuSubCD)
        {
            MenuSubItemBIZ bizMenuSubItem = new MenuSubItemBIZ();
            ScreenBIZ      bizScreen      = new ScreenBIZ();

            //NZString langCD = CommonLib.Common.CurrentUserInfomation.LanguageCD;
            List <MenuSubItemDTO> listMenuSubItem = bizMenuSubItem.LoadMenuSubItemOfMenuSub(menuSubCD);

            DataTable dtView = new DataTable("SCREEN_LIST");

            dtView.Columns.Add("SEL", typeof(bool));
            dtView.Columns.Add("SCREEN_CD", typeof(string));
            dtView.Columns.Add("SCREEN_NAME", typeof(string));

            for (int i = 0; i < listMenuSubItem.Count; i++)
            {
                // Load screen detail
                NZString       screenCD = listMenuSubItem[i].SCREEN_CD;
                DatabaseScreen dbScreen = bizScreen.LoadScreen(screenCD);

                dtView.Rows.Add(
                    false,
                    dbScreen.ScreenCD.StrongValue,
                    dbScreen.ScreenDescription.NVL(string.Empty)
                    );
            }

            return(dtView);
        }
Exemplo n.º 2
0
        public DataTable LoadAllScreenForRegister(NZString menuSubCD)
        {
            MenuSubItemBIZ bizMenuSubItem = new MenuSubItemBIZ();
            ScreenBIZ      bizScreen      = new ScreenBIZ();

            List <ScreenDTO> listMenuSubItem = bizMenuSubItem.LoadAllScreenForRegister(menuSubCD);

            DataTable dtView = new DataTable("SCREEN_LIST");

            dtView.Columns.Add("SEL", typeof(bool));
            dtView.Columns.Add("SCREEN_CD", typeof(string));
            dtView.Columns.Add("SCREEN_NAME", typeof(string));

            for (int i = 0; i < listMenuSubItem.Count; i++)
            {
                // Load screen detail
                NZString       screenCD = listMenuSubItem[i].SCREEN_CD;
                DatabaseScreen dbScreen = bizScreen.LoadScreen(screenCD);

                dtView.Rows.Add(
                    false,
                    dbScreen.ScreenCD.StrongValue,
                    dbScreen.ScreenDescription.NVL(string.Empty)
                    );
            }

            return(dtView);
        }
        private void ShowDatabaseScreen()
        {
            Column1.Children.Clear();
            ShowLeftPanel();
            DatabaseScreen databaseScreen = new DatabaseScreen();

            Column1.Children.Add(databaseScreen);
        }
Exemplo n.º 4
0
        public bool IsScreenAlreadyExist(string ScreenCD)
        {
            ScreenBIZ biz      = new ScreenBIZ();
            NZString  screenCD = new NZString();

            screenCD.Value = ScreenCD;
            DatabaseScreen dbscreen = biz.LoadScreen(screenCD);

            return(dbscreen != null);
        }
Exemplo n.º 5
0
        /// <summary>
        /// Select all screen on database which is the main screen for set authorize
        /// </summary>
        /// <param name="database"></param>
        /// <param name="userLangCD"></param>
        /// <param name="defLangCD"></param>
        /// <returns></returns>
        public DatabaseScreenList SelectScreenWithAuthorize(Database database, NZString userLangCD, NZString defLangCD)
        {
            Database db = this.UseDatabase(database);

            StringBuilder sb = new StringBuilder();

            sb.AppendLine(" SELECT ");
            sb.AppendLine("   SCREEN_CD ");
            sb.AppendLine("   ,SCREEN_NAME ");
            sb.AppendLine("   ,IMAGE_CD ");
            sb.AppendLine("   ,SCREEN_TYPE ");
            sb.AppendLine("   ,SCREEN_ACTION ");
            sb.AppendLine("   ,EXT_PROGRAM ");
            sb.AppendLine("   ,CRT_BY ");
            sb.AppendLine("   ,CRT_DATE ");
            sb.AppendLine("   ,CRT_MACHINE ");
            sb.AppendLine("   ,UPD_BY ");
            sb.AppendLine("   ,UPD_DATE ");
            sb.AppendLine("   ,UPD_MACHINE ");
            sb.AppendLine(String.Format("   ,{0}FNZ_GET_SCREEN_DESC(T.SCREEN_CD,:LANG_CD, :DEF_LANG_CD) AS SCREEN_DESC",
                                        (db.Credential.Provider == DatabaseProvider.SQLSERVER) ? "dbo." : string.Empty));
            sb.AppendLine("   ,ORIGINAL_TITLE ");
            sb.AppendLine(" FROM TZ_SCREEN_MS T");
            sb.AppendLine(" WHERE T.IS_AUTHORIZE = '1' ");
            sb.AppendLine(" ORDER BY T.SCREEN_CD");

            DataRequest request = new DataRequest(sb.ToString());

            request.Parameters.Add("LANG_CD", DataType.NVarChar, userLangCD.Value);
            request.Parameters.Add("DEF_LANG_CD", DataType.NVarChar, defLangCD.Value);

            DataTable table = db.ExecuteQuery(request);

            DatabaseScreenList listDatabaseScreen = new DatabaseScreenList();

            for (int i = 0; i < table.Rows.Count; i++)
            {
                DatabaseScreen screen = new DatabaseScreen();
                screen.ScreenCD.Value   = table.Rows[i][ScreenDTO.eColumns.SCREEN_CD.ToString()];
                screen.ScreenName.Value = table.Rows[i][ScreenDTO.eColumns.SCREEN_NAME.ToString()];
                screen.ImageCD.Value    = table.Rows[i][ScreenDTO.eColumns.IMAGE_CD.ToString()];
                object obj = table.Rows[i][ScreenDTO.eColumns.SCREEN_TYPE.ToString()];
                screen.ScreenType = (eScreenType)Enum.Parse(typeof(eScreenType), obj.ToString());
                obj = table.Rows[i][ScreenDTO.eColumns.SCREEN_ACTION.ToString()];
                screen.ShowAction              = (eShowAction)Enum.Parse(typeof(eShowAction), obj.ToString());
                screen.ExternalProgram.Value   = table.Rows[i][ScreenDTO.eColumns.EXT_PROGRAM.ToString()];
                screen.ScreenDescription.Value = table.Rows[i][ScreenLangDTO.eColumns.SCREEN_DESC.ToString()];


                listDatabaseScreen.Add(screen);
            }

            return(listDatabaseScreen);
        }
Exemplo n.º 6
0
        /// <summary>
        /// Add button into favorite.
        /// </summary>
        /// <param name="data"></param>
        /// <returns></returns>
        private bool AddButtonFavorite(ScreenFavoriteData data)
        {
            // Check duplicate control on container.
            for (int i = 0; i < flowFavorite.Controls.Count; i++)
            {
                ScreenFavoriteData tagData = (ScreenFavoriteData)flowFavorite.Controls[i].Tag;
                if (tagData.SCREEN_CD == data.SCREEN_CD)
                {
                    MessageDialog.ShowBusiness(this, Message.LoadMessage(Messages.eValidate.VLM9017.ToString()));
                    return(false);
                }
            }

            // Save favorite into Container.
            try
            {
                FavoriteButton button = new FavoriteButton();
                button.Tag         = data;
                button.Size        = m_defaultButtonSize;
                button.BackColor   = flowFavorite.BackColor;
                button.BorderColor = ColorHelper.ShiftBrighness(button.BackColor, -100);

                DatabaseScreen dbScreen = m_databaseScreenCache.Get(data.SCREEN_CD);
                if (dbScreen != null)
                {
                    button.Text = dbScreen.ScreenDescription.NVL(string.Empty);

                    ImageItem imageItem = m_imageCache[dbScreen.ImageCD.StrongValue];
                    if (imageItem == null)
                    {
                        button.Image = Properties.Resources.img_not_found;
                    }
                    else
                    {
                        button.Image = imageItem.ImageBin;
                    }
                }

                button.MouseDown += new MouseEventHandler(btnFavorite_MouseDown);
                button.MouseMove += new MouseEventHandler(btnFavorite_MouseMove);
                button.MouseUp   += new MouseEventHandler(btnFavorite_MouseUp);
                button.Click     += new EventHandler(btnFavorite_Click);
                flowFavorite.Controls.Add(button);
                return(true);
            }
            catch (Exception err)
            {
                MessageDialog.ShowBusiness(this, "Can't add favorite. " + err.Message);
                return(false);
            }
        }
Exemplo n.º 7
0
        public void RaiseChangedLanguage()
        {
            this.SuspendLayout();

            //MenuSubList menuList = m_menuManager.GetMenu();
            List <MenuSub> menuList = m_menuController.LoadMenuHierachy();

            // Load buffer workflow document list.
            m_workflowDocumentList.Clear();
            for (int i = 0; i < menuList.Count; i++)
            {
                WorkflowDocument doc = WorkflowDocument.LoadDatabase(Common.CurrentDatabase, menuList[i].WORKFLOW_ID.NVL(String.Empty), Common.CurrentUserInfomation.UserCD);
                m_workflowDocumentList.Add(doc);
            }

            // Load Menu control.
            menuTree1.BeginUpdateMenuBar();
            menuTree1.ClearMenuBars();
            for (int i = 0; i < menuList.Count; i++)
            {
                MenuSub menuSub = menuList[i];

                MenuBar menuBar = new MenuBar();
                menuBar.Host = menuTree1;
                menuBar.Text = menuSub.MENU_SUB_DESC.NVL(string.Empty);
                menuBar.Tag  = menuSub;


                for (int iScreen = 0; iScreen < menuSub.MenuSubItemList.Count; iScreen++)
                {
                    MenuSubItemDTO menuSubItem = menuSub.MenuSubItemList[iScreen];

                    MenuItem menuItem = new MenuItem(menuBar);

                    DatabaseScreen dbScreen = m_databaseScreenCache[menuSubItem.SCREEN_CD.StrongValue];

                    if (dbScreen == null)
                    {
#if DEBUG
                        MessageDialog.ShowBusiness(this, "Not found screen code: " + menuSubItem.SCREEN_CD.StrongValue);
#endif
                        continue;
                    }
                    menuItem.Tag  = menuSubItem;
                    menuItem.Text = dbScreen.ScreenDescription.StrongValue;

                    ImageItem imgItem = m_imageCache.Get(dbScreen.ImageCD.NVL(String.Empty));
                    Image     img     = null;
                    if (imgItem != null)
                    {
                        img = imgItem.ImageBin;
                    }
                    if (img != null)
                    {
                        try
                        {
                            menuItem.Image = ImageHelper.GetThumbnailImage(img, 16, 16);
                        }
                        catch (Exception err)
                        {
                            MessageDialog.ShowBusiness(this, err.Message);
                        }
                    }
                    menuBar.MenuItems.Add(menuItem);
                }


                menuTree1.AddMenuBar(menuBar);
            }

            if (menuTree1.MenuBars.Count > 0)
            {
                menuTree1.MenuBarSelected = menuTree1.MenuBars[0];
            }

            menuTree1.EndUpdateMenuBar();

            // Load Favorite button
            flowFavorite.Controls.Clear();
            LoadFavorite();

            this.ResumeLayout(false);
        }