Пример #1
0
        public JsonResult Rights(MenuSubVM A)
        {
            bool   status = false;
            string mes    = "";
            int    v      = (int)A.UserID;

            if (ModelState.IsValid)
            {
                try
                {
                    using (PEPSIEntities dc = new PEPSIEntities())
                    {
                        foreach (var i in A.menudetail)
                        {
                            if (i.IsSelected == 1)
                            {
                                MenuSub ulog = new MenuSub
                                {
                                    UserID      = (int)A.UserID,
                                    SubMenu     = i.SubMenu,
                                    RoleId      = A.RoleId,
                                    Controller  = i.Controller,
                                    Action      = i.Action,
                                    MainMenuId  = i.MainMenuId,
                                    WarehouseID = A.WarehouseID,
                                    MenuCode    = i.MenuCode,
                                    Status      = "A",
                                    CreateBy    = User.Identity.Name,
                                    CreateDate  = System.DateTime.Now
                                };

                                dc.MenuSubs.Add(ulog);
                            }
                        }

                        dc.SaveChanges();
                        status = true;
                        dc.Dispose();
                    }
                }
                catch (Exception ex)
                {
                    return(new JsonResult {
                        Data = new { status = false, mes = mes, v = v }
                    });
                    //throw ex;
                }
            }
            else
            {
                status = false;
            }

            return(new JsonResult {
                Data = new { status = true, mes = mes, v = v }
            });
        }
Пример #2
0
        //delete tipo produto
        public static void DeleteMenuSubId(Int16 id)
        {
            //busca o arquivo q sera apagado
            MenuSub           objretorno = new MenuSub();
            MenuSubRepository tpprod     = new MenuSubRepository();

            objretorno = tpprod.Find(id);

            //passa a entidade recuperada para deletar
            tpprod.Delete(objretorno);
            tpprod.Save();
        }
Пример #3
0
        public static void InsertMenuSub(MenuSubModelView model)
        {
            MenuSub objretorno = new MenuSub();

            //faz o de para: objModelView para objEntity
            Mapper.CreateMap <MenuSubModelView, MenuSub>();
            var objtpprod = Mapper.Map <MenuSub>(model);

            MenuSubRepository tpprod = new MenuSubRepository();

            tpprod.Add(objtpprod);
            tpprod.Save();
        }
Пример #4
0
        public static void UpdateMenuSub(MenuSubModelView model)
        {
            MenuSub objretorno = new MenuSub();

            //faz o de para: objModelView para objEntity
            Mapper.CreateMap <MenuSubModelView, MenuSub>();
            var objtpprod = Mapper.Map <MenuSub>(model);

            //objtpprod.dataincl = DateTime.Now;
            MenuSubRepository tpprod = new MenuSubRepository();

            tpprod.Edit(objtpprod);
            tpprod.Save();
        }
Пример #5
0
        //get produto ID
        public static MenuSubModelView GetMenuSubId(Int16 id)
        {
            MenuSub objretorno = new MenuSub();

            MenuSubRepository tpprod = new MenuSubRepository();

            objretorno = tpprod.Find(id);

            //faz o de para: objEntity para objModelView
            Mapper
            .CreateMap <MenuSub, MenuSubModelView>();
            //.ForMember(x => x.imagem, option => option.Ignore());
            var vretorno = Mapper.Map <MenuSubModelView>(objretorno);

            return(vretorno);
        }
Пример #6
0
        public List <MenuSub> LoadMenus(NZString userCD)
        {
            IMenuDAO dao = DAOFactory.CreateMenuDAO(CommonLib.Common.CurrentDatabase);

            List <MenuSub> menuSubList = dao.GetAllMenuSubFromUser(userCD, CommonLib.Common.SystemLanguage);

            for (int i = 0; i < menuSubList.Count; i++)
            {
                MenuSub menuSub = menuSubList[i];

                List <MenuSubItemDTO> menuSubItemList = dao.GetAllMenuSubItem(menuSub.MENU_SUB_CD.StrongValue, userCD.StrongValue);
                menuSub.MenuSubItemList = menuSubItemList;
            }


            return(menuSubList);
        }
Пример #7
0
        private void menuTree1_MenuBarSelectedChange(object sender, MenuBar bar)
        {
            if (bar == null)
            {
                workflowViewer1.CloseDocument();
                return;
            }

            for (int i = 0; i < m_workflowDocumentList.Count; i++)
            {
                MenuSub menuSub = bar.Tag as MenuSub;
                if (menuSub != null)
                {
                    if (menuSub.WORKFLOW_ID.NVL(String.Empty) == m_workflowDocumentList[i].WorkflowID)
                    {
                        workflowViewer1.LoadDocument(m_workflowDocumentList[i]);
                        return;
                    }
                }
            }
        }
Пример #8
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);
        }