Exemplo n.º 1
0
        private static void _setSeachMgr(ref GetValueModel model)
        {
            while (string.IsNullOrEmpty(model.TypeName))
            {
                CheckSysValueHelper.WriteLine("【0】直接输完整数据类型; 【其它模糊输入】; 【q:退出】", ConsoleColor.Red);
                string cmd = Console.ReadLine();
                if (!cmd.Equals("0"))
                {
                    if (!cmd.Equals("q"))
                    {
                        CheckSysValueHelper.WriteLine("请输入模糊类型名", ConsoleColor.Red);
                        cmd = Console.ReadLine();
                        cmd = CheckSysValueHelper._setResult(RelationMapModel.FuzzySeachType(cmd), "类型名模糊结果", model);
                        if (!cmd.Equals("q"))
                        {
                            model.TypeName = cmd;
                            continue;
                        }
                    }
                    return;
                }
                CheckSysValueHelper.WriteLine("请直接输入类型名", ConsoleColor.Red);
                model.TypeName = Console.ReadLine().Trim();
            }
            CheckSysValueHelper._setSeach(model);
            List <string> attrList = RelationMapModel.GetSeachAttr(model.TypeName);

            while (string.IsNullOrEmpty(model.SeachName))
            {
                CheckSysValueHelper.WriteLine("一共有" + attrList.Count + "条属性,【0】查看全部, 【其它】模糊查询属性,【q:退出】", ConsoleColor.Red);
                string cmd = Console.ReadLine();
                if (cmd.Equals("0"))
                {
                    cmd = CheckSysValueHelper._setResult(attrList, "可查询属性", model);
                }
                else
                {
                    if (cmd.Equals("q"))
                    {
                        return;
                    }
                    CheckSysValueHelper.WriteLine("请输入匹配关键字", ConsoleColor.Red);
                    cmd = CheckSysValueHelper._setResult(RelationMapModel.FuzzySeach(Console.ReadLine(), attrList), "可查询属性", model);
                }
                model.SeachName = cmd;
            }
            CheckSysValueHelper._setSeach(model);
        }
Exemplo n.º 2
0
 public static void GetValue(string cmd = null)
 {
     try
     {
         cmd = "";
         GetValueModel model = new GetValueModel();
         model.SeachDataList = new List <SeachData>();
         for (;;)
         {
             if (string.IsNullOrEmpty(model.TypeName) || string.IsNullOrEmpty(model.SeachName))
             {
                 CheckSysValueHelper._setSeachMgr(ref model);
             }
             if (string.IsNullOrEmpty(model.TypeName) || string.IsNullOrEmpty(model.SeachName))
             {
                 break;
             }
             bool isLen = model.SeachDataList.Count > 0;
             if (isLen)
             {
                 CheckSysValueHelper.WriteLine("【0】重新输入所有, 【1】清空所有seach 【2】 删除一个seach,【3】修改当前seach 【4】打印筛选条件 【5】添加筛选条件 【q】退出 【其它】查看结果", ConsoleColor.Red);
             }
             else
             {
                 CheckSysValueHelper.WriteLine("【0】重新输入所有 【4】打印筛选条件 【5】添加筛选条件 【q】退出 【其它】查看结果", ConsoleColor.Red);
             }
             cmd = Console.ReadLine();
             if (cmd.Equals("0"))
             {
                 model = new GetValueModel();
                 model.SeachDataList = new List <SeachData>();
             }
             else if (cmd.Equals("1") && isLen)
             {
                 model.SeachDataList.Clear();
             }
             else if (cmd.Equals("2") && isLen)
             {
                 if (model.SeachDataList.Count > 0)
                 {
                     model.SeachDataList.RemoveAt(model.SeachDataList.Count - 1);
                 }
             }
             else if (cmd.Equals("3") && isLen)
             {
                 if (model.SeachDataList.Count > 0)
                 {
                     SeachData seach = model.SeachDataList[model.SeachDataList.Count - 1];
                     CheckSysValueHelper.WriteLine(string.Format("当前查询属性[-{0}-],要修改 y ?", seach.AttName), ConsoleColor.Red);
                     cmd = Console.ReadLine();
                     if (cmd.Equals("y"))
                     {
                         seach = new SeachData();
                         model.SeachDataList.RemoveAt(model.SeachDataList.Count - 1);
                         List <string> dlist;
                         if (CheckSysValueHelper.AttrDict.TryGetValue(CheckSysValueHelper._getSeachKey(model), out dlist))
                         {
                             if (dlist.Count > 0)
                             {
                                 while (string.IsNullOrEmpty(seach.AttName))
                                 {
                                     CheckSysValueHelper.WriteLine("一共有" + dlist.Count + "条属性,【0】查看全部,【1】直接输入 【其它】模糊查询属性", ConsoleColor.Red);
                                     cmd = Console.ReadLine();
                                     if (cmd.Equals("0"))
                                     {
                                         cmd = CheckSysValueHelper._setResult(dlist, "可查询属性", model);
                                     }
                                     else if (cmd.Equals("1"))
                                     {
                                         CheckSysValueHelper.WriteLine("输入要查询的属性名", ConsoleColor.Red);
                                         cmd = Console.ReadLine();
                                     }
                                     else
                                     {
                                         CheckSysValueHelper.WriteLine("请输入匹配关键字", ConsoleColor.Red);
                                         cmd = CheckSysValueHelper._setResult(RelationMapModel.FuzzySeach(Console.ReadLine(), dlist), "可查询属性", model);
                                     }
                                     if (!cmd.Equals("q"))
                                     {
                                         seach.AttName = cmd;
                                     }
                                 }
                                 seach.SeachVal = "";
                                 CheckSysValueHelper.WriteLine("输入筛选 名字,值,比较关系, 例如 name,liu,0", ConsoleColor.Red);
                                 seach.SeachVal = Console.ReadLine();
                             }
                             else
                             {
                                 CheckSysValueHelper.WriteLine("无缓存记录 输入要查询的属性名", ConsoleColor.Red);
                                 seach.AttName = Console.ReadLine();
                                 CheckSysValueHelper.WriteLine("输入筛选 名字,值,比较关系, 例如 name,liu,0", ConsoleColor.Red);
                                 seach.SeachVal = Console.ReadLine();
                             }
                             model.SeachDataList.Add(seach);
                         }
                     }
                     else
                     {
                         CheckSysValueHelper.WriteLine(string.Format("当前筛选条件[-{0}-],要修改 y ?", seach.SeachVal), ConsoleColor.Red);
                         cmd = Console.ReadLine();
                         if (cmd.Equals("y"))
                         {
                             CheckSysValueHelper.WriteLine("输入新的SeachVal", ConsoleColor.Red);
                             seach.SeachVal = Console.ReadLine();
                         }
                     }
                 }
             }
             else if (cmd.Equals("4"))
             {
                 CheckSysValueHelper._setSeach(model);
             }
             else if (cmd.Equals("5"))
             {
                 CheckSysValueHelper._AddSeach(ref model);
             }
             else
             {
                 if (cmd.Equals("q"))
                 {
                     break;
                 }
                 CheckSysValueHelper._SetCheck(model);
                 CheckSysValueHelper.WriteLine("", ConsoleColor.Green);
             }
         }
         return;
     }
     catch (Exception ex)
     {
         CheckSysValueHelper.WriteLine("异常失败", ConsoleColor.Green);
         LogManager.WriteLog(LogTypes.Exception, string.Format("[ljl_WriteMap]{0}", ex.ToString()), null, true);
     }
     CheckSysValueHelper.WriteLine("已经结束 。。。。。 help 查看帮助", ConsoleColor.Green);
 }