Пример #1
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,LanguageId,Info_Name")] InfoName infoName)
        {
            if (id != infoName.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(infoName);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!InfoNameExists(infoName.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(infoName));
        }
Пример #2
0
 public InfoNameTest()
 {
     this.model = new InfoName(
         "Super Cool Sector",
         DefinitionFactory.Make(),
         DocblockFactory.Make(),
         CommentFactory.Make()
         );
 }
Пример #3
0
        public async Task <IActionResult> Create([Bind("Id,LanguageId,Info_Name")] InfoName infoName)
        {
            if (ModelState.IsValid)
            {
                _context.Add(infoName);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(infoName));
        }
Пример #4
0
 private bool _IsRed()
 {
     string[] arr = InfoName.Split('/');
     if (arr.Length > 1)
     {
         int act = 0;
         if (int.TryParse(arr[1], out act))
         {
             if (act > 0)
             {
                 return(false);
             }
         }
         return(true);
     }
     return(false);
 }
Пример #5
0
        public InfoName GetLastName(string first)
        {
            var result = new InfoName(first, "Not Found");

            return(result);
        }
Пример #6
0
        public async Task GetFromMongo()
        {
            var mongo = new MongoDBManager("211.249.60.69", 27017, "next", "next!!@@##$$", "baybName");

            mongo.SetCollection("nationalBabyName");

            mongo.ClearFilter();
            mongo.AddFIlterStringRegex("Name", InfoName.Substring(0, 3));
            mongo.AddFilterStringEq("Gender", InfoGender);
            mongo.AddFilterEqInt("Year", InfoYear);

            var part1 = await mongo.GetResult();

            part1.Sort(delegate(BabyNameInfo A, BabyNameInfo B)
            {
                if (A.Count > B.Count)
                {
                    return(-1);
                }
                else if (A.Count < B.Count)
                {
                    return(1);
                }
                else
                {
                    return(0);
                }
            });

            mongo.ClearFilter();
            mongo.AddFIlterStringRegex("Name", InfoName.Substring(0, 2));
            mongo.AddFilterStringEq("Gender", InfoGender);
            mongo.AddFilterEqInt("Year", InfoYear);

            var part2 = await mongo.GetResult();

            part2.Sort(delegate(BabyNameInfo A, BabyNameInfo B)
            {
                if (A.Count > B.Count)
                {
                    return(-1);
                }
                else if (A.Count < B.Count)
                {
                    return(1);
                }
                else
                {
                    return(0);
                }
            });
            mongo.ClearFilter();
            mongo.AddFIlterStringRegex("Name", InfoName.Substring(0, 1));
            mongo.AddFilterStringEq("Gender", InfoGender);
            mongo.AddFilterEqInt("Year", InfoYear);

            var part3 = await mongo.GetResult();

            part3.Sort(delegate(BabyNameInfo A, BabyNameInfo B)
            {
                if (A.Count > B.Count)
                {
                    return(-1);
                }
                else if (A.Count < B.Count)
                {
                    return(1);
                }
                else
                {
                    return(0);
                }
            });
            var tempList = new List <BabyNameInfo>();

            tempList.AddRange(part1);

            foreach (var info in part2)
            {
                if (!tempList.Exists(x => x.Name == info.Name))
                {
                    tempList.Add(info);
                }
            }

            foreach (var info in part3)
            {
                if (!tempList.Exists(x => x.Name == info.Name))
                {
                    tempList.Add(info);
                }
            }

            var item = new List <BabyNameInfo>();

            item.AddRange(tempList.Distinct());

            ResultView.ItemsSource = item;
        }
Пример #7
0
 public override void SetDefaults()
 {
     // This is the name that will show up when hovering over icon of this info display
     InfoName.SetDefault("Minion Count");
 }
Пример #8
0
 public int CompareTo(TwitterTimeZone other)
 {
     return(InfoName.CompareTo(other.InfoName));
 }
Пример #9
0
        public void ReComb()
        {
            #region 异步后台刷新方法5   初始化深度选择下拉框显示状态

            ThreadPool.QueueUserWorkItem((obj) =>
            {
                if (InfoName == null || InfoName.Equals(""))
                {
                    return;
                }
                string sql   = "select isGears, fet from info where name = '" + InfoName + "'";
                DataTable dt = SQLiteHelper.ExecuteDataTable(sql, null);
                if (dt.Rows.Count == 0)
                {
                    return;
                }
                bool isVisible   = dt.Rows[0].ItemArray[0].ToString().Equals("1");
                string fet       = dt.Rows[0].ItemArray[1].ToString();
                List <string> ds = new List <string>();

                if (InvokeRequired && IsHandleCreated)
                {
                    this.BeginInvoke(new Action <object>(delegate(object arg)
                    {
                        //当前版本号是否已读取
                        if (labelControl11.Text == "")
                        {
                            return;
                        }

                        //比较版本,是否显示深度选择
                        float NowVersion = Convert.ToSingle(labelControl11.Text.Remove(0, 1));
                        if (NowVersion < 7.2f)
                        {
                            return;
                        }

                        //深度选择显示与否
                        if (!isVisible)
                        {
                            return;
                        }
                        comboBox1.Visible = isVisible;

                        if (fet.Equals("") && BLECode.GetIntance.CurrentService != null)
                        {
                            fet = XmlHelper.getValue("flag");
                        }

                        foreach (KeyValuePair <string, string[]> kvp in ComboxDSHelper.DepthMap)
                        {
                            if (kvp.Key.Equals(fet))
                            {
                                for (int i = 0; i < kvp.Value.Length; i++)
                                {
                                    if (kvp.Value[i].Contains("wt"))
                                    {
                                        string s = kvp.Value[i].Split(new char[] { 'w', 't', 'a' })[2] + "米";
                                        ds.Add(s);
                                    }
                                    else
                                    {
                                        string s = kvp.Value[i].Split(new char[] { 'g', 'p' })[1] + "米";
                                        ds.Add(s);
                                    }
                                }
                            }
                        }
                        comboBox1.DataSource = ds;
                    }), new object[] { null });
                }
            });

            #endregion
        }
Пример #10
0
 public InfoTest()
 {
     this.infoName = new InfoName(
         "Super Cool Sector",
         DefinitionFactory.Make(),
         DocblockFactory.Make(),
         CommentFactory.Make()
         );
     this.infoCallsign = new InfoCallsign(
         "LON_CTR",
         DefinitionFactory.Make(),
         DocblockFactory.Make(),
         CommentFactory.Make()
         );
     this.infoAirport = new InfoAirport(
         "EGLL",
         DefinitionFactory.Make(),
         DocblockFactory.Make(),
         CommentFactory.Make()
         );
     this.infoLatitude = new InfoLatitude(
         "123",
         DefinitionFactory.Make(),
         DocblockFactory.Make(),
         CommentFactory.Make()
         );
     this.infoLongitude = new InfoLongitude(
         "456",
         DefinitionFactory.Make(),
         DocblockFactory.Make(),
         CommentFactory.Make()
         );
     this.infoPerDegreeLatitude = new InfoMilesPerDegreeLatitude(
         60,
         DefinitionFactory.Make(),
         DocblockFactory.Make(),
         CommentFactory.Make()
         );
     this.infoPerDegreeLongitude = new InfoMilesPerDegreeLongitude(
         40.24,
         DefinitionFactory.Make(),
         DocblockFactory.Make(),
         CommentFactory.Make()
         );
     this.infoMagVar = new InfoMagneticVariation(
         2.1,
         DefinitionFactory.Make(),
         DocblockFactory.Make(),
         CommentFactory.Make()
         );
     this.infoScale = new InfoScale(
         1,
         DefinitionFactory.Make(),
         DocblockFactory.Make(),
         CommentFactory.Make()
         );
     this.model = new Info(
         this.infoName,
         this.infoCallsign,
         this.infoAirport,
         this.infoLatitude,
         this.infoLongitude,
         this.infoPerDegreeLatitude,
         this.infoPerDegreeLongitude,
         this.infoMagVar,
         this.infoScale
         );
 }