Ejemplo n.º 1
0
        /// <summary>
        /// 删除模糊排除关键字
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void Button_Click_1(object sender, RoutedEventArgs e)
        {
            var exclude = guolvList.SelectedItem as exclude;

            if (exclude == null)
            {
                return;
            }
            var guanjianzi = exclude.excludeappname;
            var result     = MessageBox.Show("确定删除已排除的关键字[" + guanjianzi + "]?", "删除确认", MessageBoxButton.OKCancel, MessageBoxImage.Information);

            if (result == MessageBoxResult.OK)
            {
                using (var db = SqlSugarHelper.GetInstance())
                {
                    var count = db.Deleteable <exclude>(exclude).ExecuteCommand();
                    if (count > 0)
                    {
                        excludeList.Remove(exclude);
                        //MessageBox.Show("已从排除的名称库中删除:[" + guanjianzi + "]关键字.");
                    }
                    else
                    {
                        MessageBox.Show("删除关键字失败,请联系管理员.");
                    }
                }
            }
        }
Ejemplo n.º 2
0
 /// <summary>
 /// 谁在用这个APP
 /// </summary>
 /// <param name="appName"></param>
 private void LoadWhoUsed(string appName)
 {
     appsList.Clear();
     using (var db = SqlSugarHelper.GetInstance())
     {
         var li = db.Queryable <apps>().Where(c => c.appname == appName).ToList();
         foreach (var item in li)
         {
             appsList.Add(item);
         }
         whoUsed.ItemsSource = appsList;
     }
 }
Ejemplo n.º 3
0
 /// <summary>
 /// 加载统计
 /// </summary>
 private void LoadStatistics()
 {
     using (var db = SqlSugarHelper.GetInstance())
     {
         var li = db.Queryable <statistics_apps>().OrderBy("count desc").ToList();
         foreach (var item in li)
         {
             statistics_appsList.Add(item);
         }
         lvStatistics.ItemsSource = statistics_appsList;
         loadTime.Text            = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss:fff");
     }
 }
Ejemplo n.º 4
0
 /// <summary>
 /// 加载排除的名称列表
 /// </summary>
 private void LoadExclude()
 {
     using (var db = SqlSugarHelper.GetInstance())
     {
         var li = db.Queryable <exclude>().OrderBy("excludeappname asc").ToList();
         foreach (var item in li)
         {
             excludeList.Add(item);
         }
         guolvList.ItemsSource       = excludeList;
         guolvList.DisplayMemberPath = "excludeappname";
     }
 }
Ejemplo n.º 5
0
 /// <summary>
 /// 刷新
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void Button_Click_2(object sender, RoutedEventArgs e)
 {
     using (var db = SqlSugarHelper.GetInstance())
     {
         var li = db.Queryable <statistics_apps>().OrderBy("count desc").ToList();
         statistics_appsList.Clear();
         foreach (var item in li)
         {
             statistics_appsList.Add(item);
         }
         loadTime.Text = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss:fff");
     }
 }
Ejemplo n.º 6
0
        /// <summary>
        /// 添加模糊排除关键字
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            var guanjianzi = tbAppName.Text.Trim();

            if (guanjianzi.Length == 0)
            {
                return;
            }
            bool findFlag = false;

            foreach (var item in excludeList)
            {
                if (item.excludeappname == guanjianzi)
                {
                    findFlag = true;
                    break;
                }
            }

            if (!findFlag)
            {
                using (var db = SqlSugarHelper.GetInstance())
                {
                    try
                    {
                        var id = db.Insertable <exclude>(new exclude()
                        {
                            excludeappname = guanjianzi
                        }).ExecuteReturnIdentity();
                        if (id > 0)
                        {
                            var exclude = db.Queryable <exclude>().Single(c => c.id == id);
                            if (exclude != null)
                            {
                                excludeList.Insert(0, exclude);
                            }
                        }
                    }
                    catch (Exception ex)
                    {
                        MessageBox.Show(ex.Message);
                    }
                }
            }
        }