Beispiel #1
0
        /// <summary>
        /// SysEnumMain
        /// </summary>
        /// <param name="no"></param>
        public SysEnumMain(string no)
        {
            try
            {
                this.No = no;
                this.Retrieve();
            }
            catch (Exception ex)
            {
                SysEnums ses = new SysEnums(no);
                if (ses.Count == 0)
                {
                    throw ex;
                }

                this.No   = no;
                this.Name = "未命名";
                string cfgVal = "";
                foreach (SysEnum item in ses)
                {
                    cfgVal += "@" + item.IntKey + "=" + item.Lab;
                }
                this.CfgVal = cfgVal;
                this.Insert();
            }
        }
Beispiel #2
0
        public void RegIt(string EnumKey, string vals)
        {
            try
            {
                string[] strs = vals.Split('@');
                SysEnums ens  = new SysEnums();
                ens.Delete(SysEnumAttr.EnumKey, EnumKey);
                this.Clear();

                foreach (string s in strs)
                {
                    if (s == "" || s == null)
                    {
                        continue;
                    }

                    string[] vk = s.Split('=');
                    SysEnum  se = new SysEnum();
                    se.IntKey  = int.Parse(vk[0]);
                    se.Lab     = vk[1];
                    se.EnumKey = EnumKey;
                    se.Lang    = BP.Web.WebUser.SysLang;
                    se.Insert();
                    this.AddEntity(se);
                }
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message + " - " + vals);
            }
            //  this.Full(EnumKey);
        }
Beispiel #3
0
        /// <summary>
        /// BindSysEnum
        /// </summary>
        /// <param name="key">Key</param>
        /// <param name="isShowKey">isShowKey</param>
        /// <param name="alllocal">alllocal</param>
        public void BindSysEnum(string key, bool isShowKey, AddAllLocation alllocal)
        {
            Sys.SysEnums ens = new BP.Sys.SysEnums(key);
            this.Items.Clear();
            if (alllocal == AddAllLocation.TopAndEnd || alllocal == AddAllLocation.Top)
            {
                this.Items.Add(new ListItem(">>", "all"));
            }
            foreach (SysEnum en in ens)
            {
                if (this.SelfIsShowVal)
                {
                    this.Items.Add(new ListItem(en.IntKey + " " + en.Lab, en.IntKey.ToString()));
                }
                else
                {
                    ListItem li = new ListItem(en.Lab, en.IntKey.ToString());
                    //li.Attributes.CssStyle.Add("style","color:"+en.Style);
                    //li.Attributes.Add("color",en.Style);
                    //li.Attributes.Add("style","color:"+en.Style);
                    //li.Attributes.A.CssStyle.Add("color",en.Style);
                    this.Items.Add(li);
                }
            }

            if (alllocal == AddAllLocation.TopAndEnd || alllocal == AddAllLocation.End)
            {
                this.Items.Add(new ListItem("-=全部=-", "all"));
            }
            //this.BindEntities(ens.ToEntitiesNoName(),isShowKey,alllocal);
        }
Beispiel #4
0
        protected override bool beforeDelete()
        {
            // 检查这个类型是否被使用?
            MapAttrs    attrs = new MapAttrs();
            QueryObject qo    = new QueryObject(attrs);

            qo.AddWhere(MapAttrAttr.UIBindKey, this.No);
            int i = qo.DoQuery();

            if (i == 0)
            {
                BP.Sys.SysEnums ses = new SysEnums();
                ses.Delete(BP.Sys.SysEnumAttr.EnumKey, this.No);
            }
            else
            {
                string msg = "错误:下列数据已经引用了枚举您不能删除它。"; // "错误:下列数据已经引用了枚举您不能删除它。";
                foreach (MapAttr attr in attrs)
                {
                    msg += "\t\n" + attr.Field + "" + attr.Name + " Table = " + attr.FK_MapData;
                }

                //抛出异常,阻止删除.
                throw new Exception(msg);
            }
            return(base.beforeDelete());
        }
Beispiel #5
0
        /// <summary>
        /// 把所有的枚举注册一遍.
        /// </summary>
        public static void RegAll()
        {
            BP.Sys.XML.EnumInfoXmls xmls = new BP.Sys.XML.EnumInfoXmls();
            xmls.RetrieveAll();
            SysEnums ses = new SysEnums();

            foreach (BP.Sys.XML.EnumInfoXml xml in xmls)
            {
                ses.RegIt(xml.Key, xml.Vals);
            }
        }
Beispiel #6
0
        /// <summary>
        /// 税务编号
        /// </summary>
        /// <param name="_No">编号</param>
        public SysEnum(string EnumKey, int val)
        {
            this.EnumKey = EnumKey;
            this.Lang    = BP.Web.WebUser.SysLang;
            this.IntKey  = val;
            this.MyPK    = this.EnumKey + "_" + this.Lang + "_" + this.IntKey;
            int i = this.RetrieveFromDBSources();

            if (i == 0)
            {
                i = this.Retrieve(SysEnumAttr.EnumKey, EnumKey, SysEnumAttr.Lang, BP.Web.WebUser.SysLang,
                                  SysEnumAttr.IntKey, this.IntKey);
                SysEnums ses = new SysEnums();
                ses.Full(EnumKey);
                if (i == 0)
                {
                    throw new Exception("@ EnumKey=" + EnumKey + " Val=" + val + " Lang=" + Web.WebUser.SysLang + " ...Error");
                }
            }
        }
Beispiel #7
0
        public SysEnum(string enumKey, string Lang, int val)
        {
            this.EnumKey = enumKey;
            this.Lang    = Lang;
            this.IntKey  = val;
            this.MyPK    = this.EnumKey + "_" + this.Lang + "_" + this.IntKey;
            int i = this.RetrieveFromDBSources();

            if (i == 0)
            {
                i = this.Retrieve(SysEnumAttr.EnumKey, enumKey, SysEnumAttr.Lang, Lang,
                                  SysEnumAttr.IntKey, this.IntKey);

                SysEnums ses = new SysEnums();
                ses.Full(enumKey);

                if (i == 0)
                {
                    throw new Exception("@ EnumKey=" + enumKey + " Val=" + val + " Lang=" + Lang + " Error");
                }
            }
        }
Beispiel #8
0
        public void RegIt(string EnumKey, string vals)
        {
            try
            {
                string[] strs = vals.Split('@');
                SysEnums ens  = new SysEnums();
                ens.Delete(SysEnumAttr.EnumKey, EnumKey);
                this.Clear();

                foreach (string s in strs)
                {
                    if (s == "" || s == null)
                    {
                        continue;
                    }

                    string[] vk = s.Split('=');
                    SysEnum  se = new SysEnum();
                    se.IntKey = int.Parse(vk[0]);
                    //杨玉慧
                    //解决当  枚举值含有 ‘=’号时,保存不进去的方法
                    string[] kvsValues = new string[vk.Length - 1];
                    for (int i = 0; i < kvsValues.Length; i++)
                    {
                        kvsValues[i] = vk[i + 1];
                    }
                    se.Lab     = string.Join("=", kvsValues);
                    se.EnumKey = EnumKey;
                    se.Lang    = BP.Web.WebUser.SysLang;
                    se.Insert();
                    this.AddEntity(se);
                }
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message + " - " + vals);
            }
            //  this.Full(EnumKey);
        }
    protected void Page_Load(object sender, EventArgs e)
    {
        this.UCSys1.AddTable();
        this.UCSys1.AddCaptionLeft("站点全局信息配置:(您也可以打开web.config中直接修改它)");
        this.UCSys1.AddTR();
        this.UCSys1.AddTDTitle("IDX");
        this.UCSys1.AddTDTitle("项目Key");
        this.UCSys1.AddTDTitle("名称");
        this.UCSys1.AddTDTitle("值");
        this.UCSys1.AddTDTitle("描述");
        this.UCSys1.AddTREnd();

        // BP.Web.WebUser.Style

        WebConfigDescs ens = new WebConfigDescs();

        ens.RetrieveAll();
        Configuration      cfg        = System.Web.Configuration.WebConfigurationManager.OpenWebConfiguration(Request.ApplicationPath);
        AppSettingsSection appSetting = cfg.AppSettings;
        bool is1 = false;
        int  i   = 1;

        foreach (System.Configuration.KeyValueConfigurationElement mycfg in appSetting.Settings)
        {
            WebConfigDesc en = ens.GetEnByKey("No", mycfg.Key) as WebConfigDesc;
            if (en == null)
            {
                en    = new WebConfigDesc();
                en.No = mycfg.Key;
            }

            is1 = this.UCSys1.AddTR(is1);
            this.UCSys1.AddTDIdx(i++);
            this.UCSys1.AddTD(en.No);
            this.UCSys1.AddTD(en.Name);
            switch (en.DBType)
            {
            case "Boolen":

                RadioButton rb1 = new RadioButton();
                rb1.Text      = "是";
                rb1.GroupName = en.No;
                rb1.ID        = "rb1" + en.No;
                rb1.Enabled   = en.IsEnable;

                RadioButton rb0 = new RadioButton();
                rb0.Text      = "否";
                rb0.GroupName = en.No;
                rb0.ID        = "rb0" + en.No;
                rb0.Enabled   = en.IsEnable;


                if (System.Web.Configuration.WebConfigurationManager.AppSettings[en.No] == "1")
                {
                    rb1.Checked = true;
                }
                else
                {
                    rb0.Checked = true;
                }


                this.UCSys1.AddTDBegin();
                this.UCSys1.Add(rb1);
                this.UCSys1.Add(rb0);
                this.UCSys1.AddTDEnd();
                break;

            case "Enum":
                BP.Web.Controls.DDL ddl = new BP.Web.Controls.DDL();
                ddl.ID      = "DDL_" + en.No;
                ddl.Enabled = en.IsEnable;

                BP.Sys.SysEnums ses = new BP.Sys.SysEnums(en.No, en.Vals);
                ddl.BindSysEnum(en.No, int.Parse(System.Web.Configuration.WebConfigurationManager.AppSettings[en.No]));
                this.UCSys1.AddTD(ddl);
                break;

            case "String":
            default:
                TextBox tb = new TextBox();
                tb.ID      = "TB_" + en.No;
                tb.Text    = System.Web.Configuration.WebConfigurationManager.AppSettings[en.No];
                tb.Columns = 80;
                tb.Enabled = en.IsEnable;
                this.UCSys1.AddTD(tb);
                break;
            }
            this.UCSys1.AddTD(en.Note);
            //    this.UCSys1.AddTDBigDoc(en.Note);

            this.UCSys1.AddTREnd();
        }
        this.UCSys1.AddTRSum();
        this.UCSys1.AddTD();
        this.UCSys1.AddTD();
        this.UCSys1.AddTD();

        Button btn = new Button();

        btn.ID       = "Btn_Save";
        btn.Text     = " 保存全局设置 ";
        btn.CssClass = "Btn";

        this.UCSys1.AddTD(btn);
        btn.Click += new EventHandler(btn_Click);
        this.UCSys1.AddTD();
        this.UCSys1.AddTREnd();
        this.UCSys1.AddTableEnd();
    }
Beispiel #10
0
        /// <summary>
        /// 安装包
        /// </summary>
        public static void DoInstallDataBase()
        {
            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;
                }

                if (en.ToString().Contains("BP.GPM.") == false)
                {
                    continue;
                }

                //if (en.ToString().Contains("BP.GPM."))
                //    continue;
                //if (en.ToString().Contains("BP.Demo."))
                //    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":
                    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";
            BP.DA.DBAccess.RunSQLScript(sqlscript);
            #endregion 修复

            #region 5, 初始化数据。
            sqlscript = SystemConfig.PathOfWebApp + "\\GPM\\SQLScript\\InitPublicData.sql";
            BP.DA.DBAccess.RunSQLScript(sqlscript);
            #endregion 初始化数据

            #region 6, 创建视图。
            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 创建视图


            //处理全路径
            Depts depts = new Depts();
            depts.RetrieveAll();
            foreach (Dept dept in depts)
            {
                dept.GenerNameOfPath();
            }
        }
        /// <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
        }