Beispiel #1
0
        public List <InputItem> GetSupplierData()
        {
            var supplierData = appCacheService.GetItem("Supplier") as List <InputItem>;

            if (supplierData == null || supplierData.Count == 0)
            {
                var supplierList = supplierService.GetSupplierData();
                appCacheService.AddItem("Supplier", supplierList);
                return(supplierList);
            }
            else
            {
                return(supplierData);
            }
        }
Beispiel #2
0
        public void LoginAsERPUser(string userCode, string password, string CompCode, string CompName)
        {
            //检查公司
            if (string.IsNullOrWhiteSpace(CompCode))
            {
                throw new AppException("请选择公司");
            }
            appCacheService.AddItem("Company", CompCode);
            appCacheService.AddItem("CompName", CompName);
            //1.0检查用户名密码
            sysUserService.CheckUserPassword(userCode, password);
            var user = sysUserService.GetUserByUserCode(userCode);
            //XElement userDataXml = XElementService.Instance.GetXElement("u", user);
            var roles = sysRolesService.GetRolesByUserId(user.Id).FirstOrDefault();
            //XElement rolesDataXml = XElementService.Instance.GetXElement("r", roles);
            var menus = sysMenuService.GetMenusByUserId(user.Id);

            var      company      = companyService.GetList().Where(a => a.CompCode == user.CompCode).FirstOrDefault();
            XElement menusDataXml = XElementService.Instance.GetXElement("m", menus);

            var dd = (from m in menusDataXml.Descendants("m")
                      where m.Element("ParentMenuId").Value == ""
                      select new { name = m.Element("MenuName").Value, id = m.Element("Id").Value, ParentMenuId = m.Element("ParentMenuId").Value }).ToList();

            appCacheService.AddItem("user", user);
            appCacheService.AddItem("roles", roles);
            appCacheService.AddItem("menus", menus);
            appCacheService.AddItem("company", menus);
            // XElement roleDataXml = XElement
            //PermissionUser per = new PermissionUser();
            if (task1 != null && !task1.IsCompleted)
            {
                return;
            }
            task1 = new Task(() =>
            {
                try
                {
                    var supplierList = supplierService.GetSupplierData();
                    appCacheService.AddItem("Supplier", supplierList);
                    var customerList = customerService.GetCustomerInputData();
                    appCacheService.AddItem("Customer", customerList);
                }
                catch (Exception ef)
                {
                }
                finally
                {
                }
            });
            task1.Start();
        }
Beispiel #3
0
        private void OpenFirstMenu(tb_Sys_Menu menuInfo)
        {
            if (menuInfo.MenuName.Trim() == "主页")
            {
                var form = this.MdiChildren.Where(i => i.Text == "主页").FirstOrDefault();
                if (form != null)
                {
                    this.xtraTabbedMdiManager1.SelectedPage = this.xtraTabbedMdiManager1.Pages[form];
                    return;
                }
                DashboardMain frmDashboard = new DashboardMain();
                frmDashboard.MdiParent = this;
                frmDashboard.Text      = menuInfo.MenuName.Trim();
                frmDashboard.Show();
                //this.xtraTabbedMdiManager1.Pages[frmDashboard]
                return;
            }
            appCacheService.AddItem("ParentMenu", menuInfo);//当前一级菜单信息存入缓存
            string formText = menuInfo.MenuName;
            //if (SelecedTabByName(formText))
            //    return;
            var m = this.MdiChildren.Where(i => i.Name == "HomeForm").FirstOrDefault() as HomeForm;

            if (m != null)
            {
                m.IntitData();
                // m.WindowState = FormWindowState.Maximized;
                m.Text = formText;
                // m.Show();
                this.xtraTabbedMdiManager1.SelectedPage = this.xtraTabbedMdiManager1.Pages[m];
                return;
            }

            string nameSpece = menuInfo.NameSpeace;//ERP.Winform.SysModule.HomForm
            Type   type      = Type.GetType(nameSpece);

            if (type == null)
            {
                throw new AppException("没有对应的窗体类型,创建失败");
            }
            HomeForm obj = (HomeForm)Activator.CreateInstance(type);

            obj.Text = formText;
            obj.Name = "HomeForm";
            obj.IntitData();
            obj.OnShowDig += new HomeForm.del(obj_OnShowDig);
            obj.MdiParent  = this;
            //obj.WindowState = FormWindowState.Maximized;
            obj.Show();
        }