Ejemplo n.º 1
0
        private void AddItem()
        {
            nbcMeun.Items.Clear();
            DataRow[] rows    = smmprogTable.Select(string.Format("parentid='{0}' and ProgType='{1}'", string.Empty, "m"));
            IList     list    = SysService.GetList("SelectSmmprogByMeIco", null);
            DataTable dt_list = DataConverter.ToDataTable(list);

            nbcMeun.LargeImages = ImageListRes.GetimageList(28, dt_list);
            IList     list2    = SysService.GetList("SelectSmmprogByFormIco", null);
            DataTable dt_list2 = DataConverter.ToDataTable(list2);

            nbcMeun.SmallImages = ImageListRes.GetimageList(22, dt_list2);
            foreach (DataRow row in rows)
            {
                DevExpress.XtraNavBar.NavBarGroup nbg = new DevExpress.XtraNavBar.NavBarGroup();
                nbg.Name       = row["progname"].ToString();
                nbg.Tag        = DataConverter.RowToObject <Smmprog>(row);
                nbg.Caption    = row["progname"].ToString();
                nbg.Hint       = row["progname"].ToString();
                nbg.LargeImage = ((ImageList)nbcMeun.LargeImages).Images[row["ProgIco"].ToString()];

                DataRow[] childrows = smmprogTable.Select(string.Format("parentid='{0}' and ProgType='{1}'", row["progid"].ToString(), "m"));
                foreach (DataRow itemrow in childrows)
                {
                    VsmdgroupProg smdgroup2 = new VsmdgroupProg();
                    smdgroup2 = MIS.GetProgRight(itemrow["ProgId"].ToString(), MIS.ProgUID);
                    if (smdgroup2 != null && Convert.ToInt32(smdgroup2.run) <= 0)
                    {
                        continue;
                    }
                    DevExpress.XtraNavBar.NavBarItem nbi = new DevExpress.XtraNavBar.NavBarItem();
                    nbi.Name       = itemrow["progname"].ToString();
                    nbi.Tag        = DataConverter.RowToObject <Smmprog>(itemrow);
                    nbi.Caption    = itemrow["progname"].ToString();
                    nbi.SmallImage = ((ImageList)nbcMeun.SmallImages).Images[itemrow["ProgIco"].ToString()];
                    nbi.Hint       = itemrow["progname"].ToString();
                    nbcMeun.Items.Add(nbi);
                    nbg.ItemLinks.Add(nbi);
                }
                nbcMeun.Groups.Add(nbg);
                nbcMeun.Refresh();
            }
        }
Ejemplo n.º 2
0
        private void listmian_ItemActivate(object sender, EventArgs e)
        {
            Smmprog prog = listmian.FocusedItem.Tag as Smmprog;

            if (prog == null || string.IsNullOrEmpty(prog.AssemblyName))
            {
                return;
            }
            labhelp.Text = prog.Remark;
            IList <Project> IlistProject = new List <Project>();
            VsmdgroupProg   smdgroup     = new VsmdgroupProg();

            //string projectuid = "";
            IlistProject.Add(pj);
            IlistProject.Add(pj1);
            smdgroup = MIS.GetProgRight(prog.ProgId, pj.UID);
            bool bl = true;

            if (Itop.Client.MIS.UserNumber.ToLower() == "admin")
            {
                bl = false;
            }

            if (bl)
            {
                if (smdgroup.run == null)
                {
                    MsgBox.Show("您无权浏览!");
                    return;
                }

                if (int.Parse(smdgroup.run) <= 0)
                {
                    MsgBox.Show("您无权浏览!");
                    return;
                }
            }
            if (prog.AssemblyName.ToLower().Contains(".exe") && prog.ClassName == "")
            {
                int    pos   = prog.AssemblyName.ToLower().LastIndexOf(".exe");
                string param = prog.AssemblyName.Substring(pos + 4).Trim();
                string exe   = prog.AssemblyName.Substring(0, pos) + ".exe";
                System.Diagnostics.Process.Start(Application.StartupPath + "\\" + exe, param);
                return;
            }

            object[] para = new object[3];
            para.SetValue(IlistProject, 0);
            para.SetValue(smdgroup, 1);
            para.SetValue(prog, 2);

            object classInstance = null;

            //初始化标准数据
            Itop.Common.MethodInvoker.Execute(prog.AssemblyName, prog.ClassName, "InitData", para, ref classInstance);

            para = new object[0];

            if (Itop.Common.MethodInvoker.Execute(prog.AssemblyName, prog.ClassName, prog.MethodName, para, ref classInstance) != null)
            {
                MIS.SaveLog(prog.ProgName, "打开" + prog.ProgName);
            }
        }