/// <summary>
        /// 从数据库中读取资源数据 ,在程序初始化的时候执行,模块内部会执行,其他地方不允许执行
        /// </summary>
        private void InnerLoad()
        {
            DicClassic.Clear();
            var ssss = Convert.ToInt32(SqlLiteHelper.ExecuteQuery(
                                           "SELECT COUNT(*) as count FROM sqlite_master WHERE type='table' and name= 'menu_classic'").
                                       Tables[0].Rows[0][0].ToString().Trim());


            if (ssss < 1)
            {
                SqlLiteHelper.ExecuteQuery(
                    "CREATE TABLE 'menu_classic' ('id' integer PRIMARY KEY,'name' text,'" +
                    "content' text)");
            }


            try
            {
                DataSet ds = SqlLiteHelper.ExecuteQuery("select * from menu_classic", null);
                if (ds == null)
                {
                    return;
                }
                int mCount = ds.Tables[0].Rows.Count;
                for (int i = 0; i < mCount; i++)
                {
                    try
                    {
                        // (id integer NOT NULL,tag text,name text NOT NULL,tooltips text)
                        int id = Convert.ToInt32(ds.Tables[0].Rows[i]["id"].ToString().Trim());
                        if (id >= MenuIdControlAssign.MenuClassicIdMin &&
                            id <= MenuIdControlAssign.MenuClassicIdMax)
                        {
                            string name    = ds.Tables[0].Rows[i]["name"].ToString().Trim();
                            string content = ds.Tables[0].Rows[i]["content"].ToString().Trim();
                            this.UpdateMneu(id, name, content);
                        }
                    }
                    catch (Exception ex)
                    {
                        WriteLog.WriteLogError(ex.ToString());
                    }
                }
            }
            catch (Exception ex)
            {
                WriteLog.WriteLogError(
                    "Class SupperClassicDataHoldingExtend Function loadItem from SQLlite table menu_classic  Occer an Error:" +
                    ex.ToString());
            }

            var args = new PublishEventArgs()
            {
                EventId =
                    EventIdAssign.ClassicMenuLoadUpdate,
                EventType = PublishEventType.Core
            };

            EventPublish.PublishEvent(args);
        }
Exemplo n.º 2
0
        /// <summary>
        /// 从数据库中读取资源数据
        /// 在程序初始化的时候执行
        /// </summary>
        private void InnerLoad()
        {
            var ssss = Convert.ToInt32(SqlLiteHelper.ExecuteQuery(
                                           "SELECT COUNT(*) as count FROM sqlite_master WHERE type='table' and name= 'menu_shortcuts'").
                                       Tables[0].Rows[0][0].ToString().Trim());


            if (ssss < 1)
            {
                SqlLiteHelper.ExecuteQuery(
                    "CREATE TABLE 'menu_shortcuts' ('id' integer PRIMARY KEY,'shortcut' text)");
            }


            try
            {
                DataSet ds = SqlLiteHelper.ExecuteQuery("select * from menu_shortcuts", null);
                if (ds == null)
                {
                    return;
                }
                int mCount = ds.Tables[0].Rows.Count;
                for (int i = 0; i < mCount; i++)
                {
                    try
                    {
                        // (id integer NOT NULL,tag text,name text NOT NULL,tooltips text)
                        int    id       = Convert.ToInt32(ds.Tables[0].Rows[i]["id"].ToString().Trim());
                        string shortcut = ds.Tables[0].Rows[i]["shortcut"].ToString().Trim();
                        this.AddShortCut(id, shortcut);
                    }
                    catch (Exception ex)
                    {
                        WriteLog.WriteLogError(ex.ToString());
                    }
                }
            }
            catch (Exception ex)
            {
                WriteLog.WriteLogError(
                    "Class MenuShortCutsHoldingExtend Function loadItem from SQLlite table menu_shortcuts  Occer an Error:" +
                    ex.ToString());
            }
            var args = new PublishEventArgs()
            {
                EventId =
                    EventIdAssign.MenuShourtCutsLoadUpdate,
                EventType = PublishEventType.Core
            };

            EventPublish.PublishEvent(args);
        }
Exemplo n.º 3
0
        private void UpdateKeyVauleDb(string key, string value)
        {
            var ssss = Convert.ToInt32(SqlLiteHelper.ExecuteQuery(
                                           "SELECT COUNT(*) as count FROM login_setting WHERE key='" + key + "'").Tables[0].Rows[0][0].ToString().
                                       Trim());

            if (ssss < 1)
            {
                SqlLiteHelper.ExecuteQuery(
                    "insert into login_setting(key,value) values ('" + key + "','" + value + "')");
            }
            else
            {
                SqlLiteHelper.ExecuteQuery(
                    "update login_setting set value='" + value + "' where key='" + key + "'");
            }
        }
Exemplo n.º 4
0
        private void GetValueFromDb()
        {
            try
            {
                var ssss = Convert.ToInt32(SqlLiteHelper.ExecuteQuery(
                                               "SELECT COUNT(*) as count FROM sqlite_master WHERE type='table' and name= 'login_setting'")
                                           .Tables[0].Rows[0][0].ToString().Trim());

                if (ssss < 1)
                {
                    SqlLiteHelper.ExecuteQuery(
                        "CREATE TABLE 'login_setting' ('key' text, 'value' text)");
                }

                DataSet ds = SqlLiteHelper.ExecuteQuery("select * from login_setting", null);
                if (ds == null)
                {
                    return;
                }
                int mCount = ds.Tables[0].Rows.Count;
                for (int i = 0; i < mCount; i++)
                {
                    try
                    {
                        string key   = ds.Tables[0].Rows[i]["key"].ToString().Trim();
                        string value = ds.Tables[0].Rows[i]["value"].ToString().Trim();
                        UpdateKeyVaule(key, value);
                    }
                    catch (Exception ex)
                    {
                        WriteLog.WriteLogError(ex.ToString());
                    }
                }
            }
            catch (Exception ex)
            {
                WriteLog.WriteLogError("Class login GetValueFromDb has an Error:" + ex.ToString());
            }
        }
Exemplo n.º 5
0
        /// <summary>
        /// 获取当前数据库中的汉化内容
        /// </summary>
        /// <returns></returns>
        public string GetCulturefromDb()
        {
            var ssss = System.Convert.ToInt32(SqlLiteHelper.ExecuteQuery(
                                                  "SELECT COUNT(*) as count FROM sqlite_master WHERE type='table' and name= 'i36n_culture'").
                                              Tables[0].Rows[0][0].ToString().Trim());


            if (ssss < 1)
            {
                SqlLiteHelper.ExecuteQuery(
                    "CREATE TABLE 'i36n_culture' ('culture' text)");
            }


            try
            {
                DataSet ds = SqlLiteHelper.ExecuteQuery("select * from i36n_culture", null);
                if (ds == null)
                {
                    return("zh-CN");
                }
                int mCount = ds.Tables[0].Rows.Count;
                for (int i = 0; i < mCount; i++)
                {
                    string name = ds.Tables[0].Rows[i]["culture"].ToString().Trim();
                    return(name);
                }
            }
            catch (Exception ex)
            {
                WriteLog.WriteLogError(
                    "Class I36N Function loadItem from SQLlite table i36n_culture  Occer an Error:" +
                    ex.ToString());
            }
            return("zh-CN");
        }
Exemplo n.º 6
0
        private void LoadBase()
        {
            TreeItems.Clear();
            var ssss = Convert.ToInt32(SqlLiteHelper.ExecuteQuery(
                                           "SELECT COUNT(*) as count FROM sqlite_master WHERE type='table' and name= 'menu_instances_relation'").
                                       Tables[0].Rows[0][0].ToString().Trim());


            if (ssss < 1)
            {
                SqlLiteHelper.ExecuteQuery(
                    "CREATE TABLE 'menu_instances_relation' ('father_id' integer,'id' integer,'sort_index' integer,'name' text,'" +
                    "instances_id' integer)");
            }


            try
            {
                DataSet ds = SqlLiteHelper.ExecuteQuery("select * from menu_instances_relation", null);
                if (ds == null)
                {
                    return;
                }
                int mCount = ds.Tables[0].Rows.Count;
                for (int i = 0; i < mCount; i++)
                {
                    try
                    {
                        // (id integer NOT NULL,tag text,name text NOT NULL,tooltips text)
                        int fatherId = Convert.ToInt32(ds.Tables[0].Rows[i]["father_id"].ToString().Trim());
                        int id       = Convert.ToInt32(ds.Tables[0].Rows[i]["id"].ToString().Trim());

                        if ((id >= MenuIdControlAssign.MenuFileGroupIdMin &&
                             id <= MenuIdControlAssign.MenuFileGroupIdMax) ||
                            (id >= MenuIdControlAssign.MenuIdMin &&
                             id <= MenuIdControlAssign.MenuIdMax))
                        {
                            int    sortIndex   = Convert.ToInt32(ds.Tables[0].Rows[i]["sort_index"].ToString().Trim());
                            string name        = ds.Tables[0].Rows[i]["name"].ToString().Trim();
                            int    instancesId = Convert.ToInt32(ds.Tables[0].Rows[i]["instances_id"].ToString().Trim());

                            if (instancesId == 2920022) //moban weizhi

                            {
                                if (fatherId == 0)
                                {
                                    if (!DicType.ContainsKey(id))
                                    {
                                        DicType.Add(id, name);
                                    }
                                    else
                                    {
                                        DicType[id] = name;
                                    }
                                }
                                else
                                {
                                    if (DicType.ContainsKey(fatherId))
                                    {
                                        TreeItems.Add(new TreeItemViewMode()
                                        {
                                            Id          = id,
                                            Name        = name,
                                            IsChecked   = false,
                                            Description = DicType[fatherId],
                                            FatherId    = fatherId
                                        });
                                    }
                                }
                            }
                        }
                    }
                    catch (Exception ex)
                    {
                        WriteLog.WriteLogError(ex.ToString());
                    }
                }
            }
            catch (Exception ex)
            {
                WriteLog.WriteLogError(
                    "Class MenuInstanceRelationHoldingExtend Function loadItem from SQLlite table menu_instances_relation  Occer an Error:" +
                    ex.ToString());
            }
            var args = new PublishEventArgs()
            {
                EventId =
                    EventIdAssign.MenuInstanceRelationLoadUpdate,
                EventType = PublishEventType.Core
            };

            EventPublish.PublishEvent(args);


            //var lst = new List<MenuInstancesRelation>();
            //foreach (var f in TreeItems)
            //    lst.Add(new MenuInstancesRelation()
            //                {
            //                    FatherId = f.FatherId,
            //                    Id = f.Id,
            //                    InstancesId = 2920022,
            //                    Name = f.Name,
            //                    SortIndex =0,
            //                });
            //ServerInstanceRelation.UpdateMenuInstanceRelation(2920022, "MainMenuMa", lst);
        }
Exemplo n.º 7
0
        private void LoadNow()
        {
            var ssss = Convert.ToInt32(SqlLiteHelper.ExecuteQuery(
                                           "SELECT COUNT(*) as count FROM sqlite_master WHERE type='table' and name= 'menu_instances_relation'").
                                       Tables[0].Rows[0][0].ToString().Trim());


            if (ssss < 1)
            {
                SqlLiteHelper.ExecuteQuery(
                    "CREATE TABLE 'menu_instances_relation' ('father_id' integer,'id' integer,'sort_index' integer,'name' text,'" +
                    "instances_id' integer)");
            }


            try
            {
                DataSet ds = SqlLiteHelper.ExecuteQuery("select * from menu_instances_relation", null);
                if (ds == null)
                {
                    return;
                }
                int mCount = ds.Tables[0].Rows.Count;
                for (int i = 0; i < mCount; i++)
                {
                    try
                    {
                        int fatherId = Convert.ToInt32(ds.Tables[0].Rows[i]["father_id"].ToString().Trim());
                        int id       = Convert.ToInt32(ds.Tables[0].Rows[i]["id"].ToString().Trim());

                        if ((id >= MenuIdControlAssign.MenuFileGroupIdMin &&
                             id <= MenuIdControlAssign.MenuFileGroupIdMax) ||
                            (id >= MenuIdControlAssign.MenuIdMin &&
                             id <= MenuIdControlAssign.MenuIdMax))
                        {
                            int    sortIndex   = Convert.ToInt32(ds.Tables[0].Rows[i]["sort_index"].ToString().Trim());
                            string name        = ds.Tables[0].Rows[i]["name"].ToString().Trim();
                            int    instancesId = Convert.ToInt32(ds.Tables[0].Rows[i]["instances_id"].ToString().Trim());

                            if (instancesId == 2920002)
                            {
                                foreach (var t in TreeItems)
                                {
                                    if (t.Id == id && t.FatherId == fatherId)
                                    {
                                        t.IsChecked = true;
                                        break;
                                    }
                                }
                            }
                        }
                    }
                    catch (Exception ex)
                    {
                        WriteLog.WriteLogError(ex.ToString());
                    }
                }
            }
            catch (Exception ex)
            {
                WriteLog.WriteLogError(
                    "Class MenuInstanceRelationHoldingExtend Function loadItem from SQLlite table menu_instances_relation  Occer an Error:" +
                    ex.ToString());
            }
            var args = new PublishEventArgs()
            {
                EventId =
                    EventIdAssign.MenuInstanceRelationLoadUpdate,
                EventType = PublishEventType.Core
            };

            EventPublish.PublishEvent(args);
        }
        /// <summary>
        /// 从数据库中读取资源数据
        /// 在程序初始化的时候执行
        /// </summary>
        private void InnerLoad()
        {
            DicInstanceRelation.Clear();
            var ssss = Convert.ToInt32(SqlLiteHelper.ExecuteQuery(
                                           "SELECT COUNT(*) as count FROM sqlite_master WHERE type='table' and name= 'menu_instances_relation'").
                                       Tables[0].Rows[0][0].ToString().Trim());


            if (ssss < 1)
            {
                SqlLiteHelper.ExecuteQuery(
                    "CREATE TABLE 'menu_instances_relation' ('father_id' integer,'id' integer,'sort_index' integer,'name' text,'" +
                    "instances_id' integer)");
            }


            try
            {
                DataSet ds = SqlLiteHelper.ExecuteQuery("select * from menu_instances_relation", null);
                if (ds == null)
                {
                    return;
                }
                int mCount = ds.Tables[0].Rows.Count;
                for (int i = 0; i < mCount; i++)
                {
                    try
                    {
                        // (id integer NOT NULL,tag text,name text NOT NULL,tooltips text)
                        int fatherId = Convert.ToInt32(ds.Tables[0].Rows[i]["father_id"].ToString().Trim());
                        int id       = Convert.ToInt32(ds.Tables[0].Rows[i]["id"].ToString().Trim());

                        if ((id >= MenuIdControlAssign.MenuFileGroupIdMin &&
                             id <= MenuIdControlAssign.MenuFileGroupIdMax) ||
                            (id >= MenuIdControlAssign.MenuIdMin &&
                             id <= MenuIdControlAssign.MenuIdMax))
                        {
                            int    sortIndex   = Convert.ToInt32(ds.Tables[0].Rows[i]["sort_index"].ToString().Trim());
                            string name        = ds.Tables[0].Rows[i]["name"].ToString().Trim();
                            int    instancesId = Convert.ToInt32(ds.Tables[0].Rows[i]["instances_id"].ToString().Trim());
                            this.UpdateMenuInstanceRelation(fatherId, id, sortIndex, name, instancesId);
                        }
                    }
                    catch (Exception ex)
                    {
                        WriteLog.WriteLogError(ex.ToString());
                    }
                }
            }
            catch (Exception ex)
            {
                WriteLog.WriteLogError(
                    "Class MenuInstanceRelationHoldingExtend Function loadItem from SQLlite table menu_instances_relation  Occer an Error:" +
                    ex.ToString());
            }
            var args = new PublishEventArgs()
            {
                EventId =
                    EventIdAssign.MenuInstanceRelationLoadUpdate,
                EventType = PublishEventType.Core
            };

            EventPublish.PublishEvent(args);
        }