public async Task <string> SystemKeyEdit([FromBody] SystemKey systemKeyAddIn)
        {
            var dsdelete = await _SqlLiteContext.SystemKeys.AsNoTracking().Where(o => o.KeyName == systemKeyAddIn.KeyName).FirstOrDefaultAsync();

            _SqlLiteContext.SystemKeys.Remove(dsdelete);
            if (await _SqlLiteContext.SaveChangesAsync() == 0)
            {
                return(System.Text.Json.JsonSerializer.Serialize(new ResponseCommon {
                    msg = "修改组织机构失败", code = "-1"
                }));
            }
            Dtos.Models.SystemKey systemKeyadd = new SystemKey
            {
                KeyName  = systemKeyAddIn.KeyName,
                KeyValue = systemKeyAddIn.KeyValue
            };
            await _SqlLiteContext.SystemKeys.AddAsync(systemKeyadd);

            var addresult = await _SqlLiteContext.SaveChangesAsync();

            if (addresult > 0)
            {
                return(System.Text.Json.JsonSerializer.Serialize(new ResponseCommon {
                    msg = "", code = "0"
                }));
            }
            else
            {
                return(System.Text.Json.JsonSerializer.Serialize(new ResponseCommon {
                    msg = "修改组织变量失败", code = "-1"
                }));
            }
        }
 public EncyclopediaScientistsStage(SystemKey scientist)
     : base(YND.CelestialGenerator[SystemKey.Empty])
 {
     _scientist = scientist;
     Enum.TryParse(_scientist + "Title", out _speechKeyTitle);
     Enum.TryParse(_scientist.ToString(), out _speechKey);
 }
        //string FType, string GUID, string Name, string IsStart, string MainKey, string GroupSqlString, string SqlString, string AfterSqlString, string AfterSqlstring2
        public async Task <string> SystemKeyAdd([FromBody] SystemKey systemKeyAddIn)
        {
            //判断当前是否有重复
            if (_SqlLiteContext.SystemKeys.AsNoTracking().Contains(systemKeyAddIn))
            {
                return(System.Text.Json.JsonSerializer.Serialize(new ResponseCommon {
                    msg = "已有重复的项,请检查后重试", code = "-1"
                }));
            }
            Dtos.Models.SystemKey systemKeyAdd = new Dtos.Models.SystemKey
            {
                KeyName  = systemKeyAddIn.KeyName,
                KeyValue = systemKeyAddIn.KeyValue
            };
            await _SqlLiteContext.SystemKeys.AddAsync(systemKeyAdd);

            var addresult = await _SqlLiteContext.SaveChangesAsync();

            if (addresult > 0)
            {
                return(System.Text.Json.JsonSerializer.Serialize(new ResponseCommon {
                    msg = "", code = "0"
                }));
            }
            else
            {
                return(System.Text.Json.JsonSerializer.Serialize(new ResponseCommon {
                    msg = "新增系统变量失败", code = "-1"
                }));
            }
        }
Exemple #4
0
        public ActionResult DeleteConfirmed(int id)
        {
            SystemKey systemKey = db.SystemKeys.Find(id);

            db.SystemKeys.Remove(systemKey);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Exemple #5
0
 public ActionResult Edit([Bind(Include = "Id,UserId,UserName,Key,System,Url,CreatedOn")] SystemKey systemKey)
 {
     if (ModelState.IsValid)
     {
         db.Entry(systemKey).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(systemKey));
 }
Exemple #6
0
 public static string GetSystemUrl(SystemKey key)
 {
     var path = CmsService.Instance.GetSystemPath(key.ToString());
     if (string.IsNullOrEmpty(path))
         return null;
     var page = CmsService.Instance.GetItem<Page>(path);
     if (page == null)
         return null;
     return page.Url;
 }
Exemple #7
0
 public void UpdateContsuppVersionNumber(int newVersion)
 {
     using (RiftEntities context = new RiftEntities())
     {
         SystemKey systemKey = (from sk in context.SystemKeys.Where(sk => sk.Key == Contsupp_LastVersion) select sk).FirstOrDefault();
         if (systemKey != null)
         {
             systemKey.Value = newVersion.ToString();
             context.Entry(systemKey).State = System.Data.Entity.EntityState.Modified;
             context.SaveChanges();
         }
     }
 }
Exemple #8
0
        // GET: SystemKeys/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            SystemKey systemKey = db.SystemKeys.Find(id);

            if (systemKey == null)
            {
                return(HttpNotFound());
            }
            return(View(systemKey));
        }
Exemple #9
0
        public ActionResult Create([Bind(Include = "Id,UserId,UserName,Key,System,Url,CreatedOn")] SystemKey systemKey)
        {
            if (ModelState.IsValid)
            {
                systemKey.CreatedOn = DateTime.Now;
                systemKey.UserId    = User.Identity.GetUserId();
                systemKey.UserName  = User.Identity.Name;
                systemKey.Key       = Guid.NewGuid().ToString();
                db.SystemKeys.Add(systemKey);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(systemKey));
        }
Exemple #10
0
        public bool IsSystemKeyDown(SystemKey key)
        {
            switch (key)
            {
            case SystemKey.Alt:
                return(_state.CurrentKeyboardState.KeyModifiers.Contains(KeyModifiers.Alt));

            case SystemKey.Control:
                return(_state.CurrentKeyboardState.KeyModifiers.Contains(KeyModifiers.Ctrl));

            case SystemKey.Shift:
                return(_state.CurrentKeyboardState.KeyModifiers.Contains(KeyModifiers.Shift));

            default:
                throw new ArgumentOutOfRangeException("key");
            }
        }
        public SpaceModel<SpaceObject> this[SystemKey key]
        {
            get
            {
                if (key == SystemKey.PlanetarySystem) return MakeMainMenuModel();
                if (key == SystemKey.OrbitingButtons) return MakeOrbitingButtons();
                if (key == SystemKey.Sunset) return MakeSunset();

                if (key == SystemKey.Planet) return MakeEncyclopediaPlanet();
                if (key == SystemKey.Nebula) return MakeNebula();
                if (key == SystemKey.Star) return MakeStar();
                if (key == SystemKey.Galaxy) return MakeEncyclopediaGalaxy();
                if (key == SystemKey.SolarSystem) return MakeEncyclopediaSolarSystem();
                if (key == SystemKey.DiscPlanetarySystem) return MakeDiscSolarSystem();
                if (key == SystemKey.PlanetarySystemFast) return MakeFastSolarSystem();
                if (key == SystemKey.BurningPlanet) return MakeBurningPlanet();
                if (key == SystemKey.ShootingOutPlanet) return MakeShootingOutPlanet();
                return new SpaceModel<SpaceObject>();
            }
        }
Exemple #12
0
        private void UpdateSystemKeyState(SystemKey syskey)
        {
            switch (syskey)
            {
            case SystemKey.Shift:
                if (d_leftShift || d_rightShift)
                {
                    d_current |= (uint)SystemKey.Shift;
                }
                else
                {
                    d_current &= ~(uint)SystemKey.Shift;
                }
                break;

            case SystemKey.Control:
                if (d_leftCtrl || d_rightCtrl)
                {
                    d_current |= (uint)SystemKey.Control;
                }
                else
                {
                    d_current &= ~(uint)SystemKey.Control;
                }
                break;

            case SystemKey.Alt:
                if (d_leftAlt || d_rightAlt)
                {
                    d_current |= (uint)SystemKey.Alt;
                }
                else
                {
                    d_current &= ~(uint)SystemKey.Alt;
                }
                break;
            }
        }
Exemple #13
0
 public static string GetSystemPath(SystemKey key)
 {
     return CmsService.Instance.GetSystemPath(key.ToString());
 }
 public EncyclopediaCelestialsStage(SystemKey system)
     : base(YND.CelestialGenerator[system])
 {
     Enum.TryParse("Encyclopedia" + system + "Title", out _speechKeyTitle);
     Enum.TryParse("Encyclopedia" + system.ToString(), out _speechKey);
 }
Exemple #15
0
 public bool IsPressed(SystemKey key)
 {
     throw new NotImplementedException();
     //return (d_current & key) || (!key && !d_current);
 }