Esempio n. 1
0
        /// <summary>
        /// 刷新数据.
        /// </summary>
        public void RefData()
        {
            //删除数据.
            EmpMenus mymes = new EmpMenus();

            mymes.Delete(EmpMenuAttr.FK_App, this.No);

            //删除系统.
            EmpApps empApps = new EmpApps();

            empApps.Delete(EmpMenuAttr.FK_App, this.No);

            //查询出来菜单.
            Menus menus = new Menus();

            menus.Retrieve(EmpMenuAttr.FK_App, this.No);

            //查询出来人员.
            Emps emps = new Emps();

            emps.RetrieveAllFromDBSource();

            foreach (Emp emp in emps)
            {
                #region 初始化系统访问权限.

                EmpApp me = new EmpApp();
                me.Copy(this);
                me.FK_Emp = emp.No;
                me.FK_App = this.No;
                me.MyPK   = this.No + "_" + me.FK_Emp;
                me.Insert();
                #endregion 初始化系统访问权限.
            }
        }
Esempio n. 2
0
        public void RefData()
        {
            //删除数据.
            EmpMenus mymes = new EmpMenus();

            mymes.Delete(EmpMenuAttr.FK_App, this.No);

            //删除系统.
            EmpApps empApps = new EmpApps();

            empApps.Delete(EmpMenuAttr.FK_App, this.No);

            //查询出来菜单.
            Menus menus = new Menus();

            menus.Retrieve(EmpMenuAttr.FK_App, this.No);

            //查询出来人员.
            Emps emps = new Emps();

            emps.RetrieveAllFromDBSource();

            foreach (Emp emp in emps)
            {
                #region 初始化系统访问权限.

                EmpApp me = new EmpApp();
                me.Copy(this);
                me.FK_Emp = emp.No;
                me.FK_App = this.No;
                me.MyPK   = this.No + "_" + me.FK_Emp;
                me.Insert();
                #endregion 初始化系统访问权限.

                //#region 初始化菜单权限.
                //foreach (Menu menu in menus)
                //{
                //    /* 把此人能看到的菜单 init 里面去。*/
                //    if (Glo.IsCanDoIt(menu.No, menu.HisCtrlWay, emp.No) == false)
                //        continue;

                //    EmpMenu em = new EmpMenu();
                //    em.Copy(menu);
                //    em.FK_Emp = emp.No;
                //    em.FK_Menu = menu.No;  //菜单编号.
                //    em.FK_App = menu.FK_App; //系统编号

                //    em.MyPK = menu.No + "_" + emp.No;
                //    em.Insert();
                //}
                //#endregion 初始化菜单权限.
            }
        }
Esempio n. 3
0
        protected override bool beforeDelete()
        {
            Menu appMenu = new Menu(this.RefMenuNo);

            if (appMenu != null && appMenu.Flag.Contains("Flow"))
            {
                throw new Exception("@删除失败,此项为工作流菜单,不能删除。");
            }
            // 删除该系统.
            Menu menu = new Menu();

            menu.Delete(MenuAttr.FK_App, this.No);

            // 删除用户数据.
            EmpMenu em = new EmpMenu();

            em.Delete(MenuAttr.FK_App, this.No);

            EmpApp ea = new EmpApp();

            ea.Delete(MenuAttr.FK_App, this.No);

            return(base.beforeDelete());
        }
Esempio n. 4
0
        /// <summary>
        /// 安装包
        /// </summary>
        public static void DoInstallDataBase(string lang, string yunXingHuanjing)
        {
            ArrayList al   = null;
            string    info = "BP.En.Entity";

            al = BP.En.ClassFactory.GetObjects(info);

            #region 1, 修复表
            foreach (Object obj in al)
            {
                Entity en = null;
                en = obj as Entity;
                if (en == null)
                {
                    continue;
                }

                if (en.ToString() == null)
                {
                    continue;
                }

                if (en.ToString().Contains("BP.Port."))
                {
                    continue;
                }

                string table = null;
                try
                {
                    table = en.EnMap.PhysicsTable;
                    if (table == null)
                    {
                        continue;
                    }
                }
                catch
                {
                    continue;
                }

                switch (table)
                {
                case "WF_EmpWorks":
                case "WF_GenerEmpWorkDtls":
                case "WF_GenerEmpWorks":
                case "WF_NodeExt":
                    continue;

                case "Sys_Enum":
                    en.CheckPhysicsTable();
                    break;

                default:
                    en.CheckPhysicsTable();
                    break;
                }

                en.PKVal = "123";
                try
                {
                    en.RetrieveFromDBSources();
                }
                catch (Exception ex)
                {
                    Log.DebugWriteWarning(ex.Message);
                    en.CheckPhysicsTable();
                }
            }
            #endregion 修复

            #region 2, 注册枚举类型 sql
            // 2, 注册枚举类型。
            BP.Sys.Xml.EnumInfoXmls xmls = new BP.Sys.Xml.EnumInfoXmls();
            xmls.RetrieveAll();
            foreach (BP.Sys.Xml.EnumInfoXml xml in xmls)
            {
                BP.Sys.SysEnums ses = new BP.Sys.SysEnums();
                ses.RegIt(xml.Key, xml.Vals);
            }
            #endregion 注册枚举类型

            #region 3, 执行基本的 sql
            string sqlscript = SystemConfig.PathOfWebApp + "\\GPM\\SQLScript\\Port_Inc_CH_BPM.sql";
            /*孙战平将RunSQLScript改为RunSQLScriptGo*/
            BP.DA.DBAccess.RunSQLScript(sqlscript);
            #endregion 修复

            #region 5, 初始化数据。

            sqlscript = SystemConfig.PathOfWebApp + "\\GPM\\SQLScript\\InitPublicData.sql";
            BP.DA.DBAccess.RunSQLScript(sqlscript);

            //sqlscript = SystemConfig.PathOfWebApp + "\\Data\\Install\\SQLScript\\GO.sql";
            //BP.DA.DBAccess.RunSQLScriptGo(sqlscript);
            #endregion 初始化数据

            #region 6, 创建视图。

            if (DBAccess.IsExitsObject("V_GPM_EmpGroup"))
            {
                BP.DA.DBAccess.RunSQL("DROP VIEW V_GPM_EmpGroup");
            }

            if (DBAccess.IsExitsObject("V_GPM_EmpGroupMenu"))
            {
                BP.DA.DBAccess.RunSQL("DROP VIEW V_GPM_EmpGroupMenu");
            }

            if (DBAccess.IsExitsObject("V_GPM_EmpStationMenu"))
            {
                BP.DA.DBAccess.RunSQL("DROP VIEW V_GPM_EmpStationMenu");
            }

            if (DBAccess.IsExitsObject("V_GPM_EmpMenu_GPM"))
            {
                BP.DA.DBAccess.RunSQL("DROP VIEW V_GPM_EmpMenu_GPM");
            }

            if (DBAccess.IsExitsObject("V_GPM_EmpMenu"))
            {
                BP.DA.DBAccess.RunSQL("DROP VIEW V_GPM_EmpMenu");
            }



            sqlscript = SystemConfig.PathOfWebApp + "\\GPM\\SQLScript\\MSSQL_GPM_VIEW.sql";

            //MySQL 语法有所区别
            if (BP.Sys.SystemConfig.AppCenterDBType == DBType.MySQL)
            {
                sqlscript = SystemConfig.PathOfWebApp + "\\GPM\\SQLScript\\MySQL_GPM_VIEW.sql";
            }
            //Oracle 语法有所区别
            if (BP.Sys.SystemConfig.AppCenterDBType == DBType.Oracle)
            {
                sqlscript = SystemConfig.PathOfWebApp + "\\GPM\\SQLScript\\Oracle_GPM_VIEW.sql";
            }
            BP.DA.DBAccess.RunSQLScriptGo(sqlscript);
            #endregion 创建视图

            #region 7, 初始化系统访问权限
            //查询出来系统
            Apps apps = new Apps();
            apps.RetrieveAll();

            //查询出来人员.
            Emps emps = new Emps();
            emps.RetrieveAllFromDBSource();
            //查询出来菜单
            Menus menus = new Menus();
            menus.RetrieveAllFromDBSource();

            //删除数据.
            BP.DA.DBAccess.RunSQL("DELETE FROM GPM_EmpApp");
            BP.DA.DBAccess.RunSQL("DELETE FROM GPM_EmpMenu");


            foreach (Emp emp in emps)
            {
                #region 初始化系统访问权限.
                foreach (App app in apps)
                {
                    EmpApp me = new EmpApp();
                    me.Copy(app);
                    me.FK_Emp = emp.No;
                    me.FK_App = app.No;
                    me.Name   = app.Name;
                    me.MyPK   = app.No + "_" + me.FK_Emp;
                    me.Insert();
                }
                #endregion 初始化系统访问权限.

                #region 初始化人员菜单权限
                foreach (Menu menu in menus)
                {
                    EmpMenu em = new EmpMenu();
                    em.Copy(menu);
                    em.FK_Emp  = emp.No;
                    em.FK_App  = menu.FK_App;
                    em.FK_Menu = menu.No;
                    em.MyPK    = menu.No + "_" + emp.No;
                    em.Insert();
                }
                #endregion
            }
            #endregion
        }