Exemplo n.º 1
0
        public String GetLevelList(int cubeId, int dimensionId, int hierarchyId)
        {
            using (AdomdConnection mdConn = new AdomdConnection())
            {
                mdConn.ConnectionString = "provider=msolap;Data Source=V1LGORPC\\ASMAIN;initial catalog=AdventureWorksDW2014Multidimensional-EE;";
                mdConn.Open();

                List <CubeDef> realCubeList = Utilities.Utilities.GetRealCubeList(mdConn.Cubes);

                CubeDef cubeDef = realCubeList[cubeId];

                Microsoft.AnalysisServices.AdomdClient.Hierarchy hierarchy = cubeDef.Dimensions[dimensionId].Hierarchies[hierarchyId];

                List <Models.Level> levelList = new List <Models.Level>();

                foreach (Microsoft.AnalysisServices.AdomdClient.Level level in hierarchy.Levels)
                {
                    Models.Level newLevel = new Models.Level(level);

                    levelList.Add(newLevel);
                }

                return(JsonConvert.SerializeObject(levelList, Formatting.Indented));
            }
        }
Exemplo n.º 2
0
 public Harness()
 {
     EngineOutput     = new Engine.Output();
     GameCurrentLevel = new Models.Level00();
     RefreshOutput();
     EngineInput = new Engine.Input();
 }
Exemplo n.º 3
0
        public Guid Maintaintestcall(Models.Level level)
        {
            Guid record_IDNUM = new Guid();

            //con = new NpgsqlConnection(conFIG.ConnFor_PG_QAData);
            //cmd = new NpgsqlCommand(@"SELECT public.maintain_apitestcall(@row_idnum, @client_idnumber, @apicall, @callname_identifier,@testcasenumber, @loggedinas, @status);", con);

            //cmd.Parameters.Add("@row_idnum", NpgsqlTypes.NpgsqlDbType.Uuid).Value = item.row_idnumber;
            //cmd.Parameters.Add("@client_idnumber", NpgsqlTypes.NpgsqlDbType.Uuid).Value = item.client_idnumber;
            //cmd.Parameters.Add("@apicall", NpgsqlTypes.NpgsqlDbType.Varchar).Value = item.callname ?? "";
            //cmd.Parameters.Add("@callname_identifier", NpgsqlTypes.NpgsqlDbType.Varchar).Value = item.testcallidentifier ?? "";
            //cmd.Parameters.Add("@testcasenumber", NpgsqlTypes.NpgsqlDbType.Varchar).Value = item.testcasenumber ?? "";

            //cmd.Parameters.Add("@loggedinas", NpgsqlTypes.NpgsqlDbType.Varchar).Value = LoggedInAs;
            //cmd.Parameters.Add("@status", NpgsqlTypes.NpgsqlDbType.Integer).Value = item.Status;


            //da = new NpgsqlDataAdapter(cmd);
            //DataSet ds = new DataSet();
            //da.Fill(ds);

            //record_IDNUM = new Guid(Convert.ToString(ds.Tables[0].Rows[0]["maintain_apitestcall"]));

            return(record_IDNUM);
        }
Exemplo n.º 4
0
 public static void LoadGame()
 {
     try
     {
         using (StreamReader inputFile = new StreamReader(FilePath.Get("save.dat")))
         {
             string lastLevel = Base64Decode(inputFile.ReadToEnd().TrimEnd());
             if (lastLevel.Equals("LogicGates.Models.Level00"))
             {
                 Harness.GameCurrentLevel = new Level01();
             }
             else
             {
                 Type type = Type.GetType(lastLevel, false);
                 if (type == null)
                 {
                     Harness.GameCurrentLevel = new Level99();
                 }
                 else
                 {
                     Harness.GameCurrentLevel = (Level)Activator.CreateInstance(type);
                 }
             }
         }
     }
     catch (FileNotFoundException)
     {
         Harness.GameCurrentLevel = new Level01();
         SaveGame();
     }
     Harness.RefreshOutput();
 }
Exemplo n.º 5
0
        private ErrorDate checkLevelName(Models.Level newLevel)
        {
            List <Models.Level> levels          = _context.Level.ToList();
            ErrorDate           operationOutput = new ErrorDate();

            if (levels == null)
            {
                operationOutput.Message = null;
                operationOutput.Name    = "Name";
                operationOutput.State   = true;
                return(operationOutput);
            }

            foreach (var level in levels)
            {
                if (level.Name == newLevel.Name)
                {
                    operationOutput.Message = "Nazwa tego poziomu już istnieje";
                    operationOutput.Name    = "Name";
                    operationOutput.State   = false;
                    return(operationOutput);
                }
            }

            operationOutput.Message = null;
            operationOutput.Name    = "Name";
            operationOutput.State   = true;
            return(operationOutput);
        }
Exemplo n.º 6
0
 public static Models.Level ReadLevel(int worldNumber, int levelNumber)
 {
     Models.Level result = new Models.Level (worldNumber, levelNumber);
     string levelFilePath = GetLevelFilePath (worldNumber, levelNumber);
     if (File.Exists (levelFilePath)) {
         string serializedLevel = File.ReadAllText (levelFilePath);
         result.LockGrid = Rules.LockGrid.Deserialize (serializedLevel);
     }
     return result;
 }
            public void Add()
            {
                var level = new Models.Level
                {
                    Name        = "Intro",
                    Description = "Introductory Topic",
                };

                Console.WriteLine(EventsXdService.Levels.Add(5577, level));
            }
Exemplo n.º 8
0
        public LevelDonePopup(Models.Level <NodaTime.LocalTime> level, CancellationTokenSource canceller) : base(canceller)
        {
            InitializeComponent();
            if (level == null)
            {
                throw new NullReferenceException("Attempt to show LevelDonePopup for null level");
            }

            //Title = $"Level {_level.Difficulty}";
            Message.Text = $"You scored {level.Percentage}%";
        }
            public void Update()
            {
                var level = new Models.Level
                {
                    Name        = "Introduction",
                    Description = "Introductory Topic",
                    Id          = "2784"
                };

                Console.WriteLine(EventsXdService.Levels.Update(5577, level));
            }
Exemplo n.º 10
0
        private ErrorDate checkLevelRange(Models.Level newLevel)
        {
            ErrorDate           operationOutput = new ErrorDate();
            List <Models.Level> levels          = _context.Level.ToList();

            foreach (var level in levels)
            {
                if (level.BeginOfRange == newLevel.BeginOfRange || level.EndOfRange == newLevel.BeginOfRange)
                {
                    operationOutput.Message = "Taki przedział już istnieje. Podaj inny.";
                    operationOutput.Name    = "BeginR";
                    operationOutput.State   = false;
                    return(operationOutput);
                }
                else if (level.BeginOfRange == newLevel.EndOfRange || level.EndOfRange == newLevel.EndOfRange)
                {
                    operationOutput.Message = "Taki przedział już istnieje. Podaj inny.";
                    operationOutput.Name    = "EndR";
                    operationOutput.State   = false;
                    return(operationOutput);
                }

                if (newLevel.BeginOfRange > level.BeginOfRange && newLevel.BeginOfRange < level.EndOfRange)
                {
                    operationOutput.Message = $"Przedział początkowy nie może być w istniejącym przedziale {level.BeginOfRange}-{level.EndOfRange}";
                    operationOutput.Name    = "BeginR";
                    operationOutput.State   = false;
                    return(operationOutput);
                }

                if (newLevel.EndOfRange > level.BeginOfRange && newLevel.EndOfRange < level.EndOfRange)
                {
                    operationOutput.Message = $"Przedział końcowy nie może być w istniejącym przedziale {level.BeginOfRange}-{level.EndOfRange}";
                    operationOutput.Name    = "EndR";
                    operationOutput.State   = false;
                    return(operationOutput);
                }
            }

            if (newLevel.BeginOfRange >= newLevel.EndOfRange)
            {
                operationOutput.Message = "Przedział początkowy nie może być większy lub równy od przedziału końcowego";
                operationOutput.Name    = "BeginR";
                operationOutput.State   = false;

                return(operationOutput);
            }

            operationOutput.Message = null;
            operationOutput.Name    = "Range";
            operationOutput.State   = true;
            return(operationOutput);
        }
Exemplo n.º 11
0
        public Hierarchy(Microsoft.AnalysisServices.AdomdClient.Hierarchy serverHierarchy)
        {
            Name      = serverHierarchy.Name;
            LevelList = new List <Models.Level>();

            foreach (Microsoft.AnalysisServices.AdomdClient.Level level in serverHierarchy.Levels)
            {
                Models.Level newLevel = new Models.Level(level);

                LevelList.Add(newLevel);
            }
        }
Exemplo n.º 12
0
        //Delete level
        public static bool DeleteLevel(Models.Level level)
        {
            try
            {
                using (var db = new Context.ContextDB())
                {
                    var toRemove = db.Levels.FirstOrDefault(t => t.Id == level.Id);
                    var query    = db.Levels.Remove(toRemove);
                    db.SaveChanges();
                    return(true);
                }
            }
            catch { }

            return(false);
        }
Exemplo n.º 13
0
        //Update level
        public static bool UpdateLevel(Models.Level level)
        {
            try
            {
                using (var db = new Context.ContextDB())
                {
                    var query = db.Levels.FirstOrDefault(q => (q.Id == level.Id));
                    query.Name         = level.Name;
                    query.CountOfEnter = level.CountOfEnter;
                    query.StartTime    = level.StartTime;
                    query.EndTime      = level.EndTime;
                    db.SaveChanges();
                    return(true);
                }
            }
            catch { }

            return(false);
        }
Exemplo n.º 14
0
        public static void NextLevel()
        {
            string currentLevel       = Harness.GameCurrentLevel.ToString();
            string currentLevelNumber = currentLevel.Substring(currentLevel.Length - 2);
            int    currentLevelInt    = -1;
            string nextLevelNumber    = "";
            string nextLevel          = "";

            if (Int32.TryParse(currentLevelNumber, out currentLevelInt))
            {
                if (++currentLevelInt < 10)
                {
                    nextLevelNumber = "0" + currentLevelInt.ToString();
                }
                else
                {
                    nextLevelNumber = currentLevelInt.ToString();
                }
            }
            else
            {
                Harness.GameCurrentLevel = new Level00();
            }
            nextLevel = "LogicGates.Models.Level" + nextLevelNumber;

            Type type = Type.GetType(nextLevel, false);

            if (type == null)
            {
                Harness.GameCurrentLevel = new Level99();
            }
            else
            {
                Harness.GameCurrentLevel = (Level)Activator.CreateInstance(type);
                Harness.SaveGame();
            }
            Harness.RefreshOutput();
        }
Exemplo n.º 15
0
 public static void ReloadLevel()
 {
     Harness.GameCurrentLevel = (Level)Activator.CreateInstance(Harness.GameCurrentLevel.GetType());
     Harness.RefreshOutput();
 }
Exemplo n.º 16
0
 public static void ResetGame()
 {
     Harness.GameCurrentLevel = new Level01();
     Harness.SaveGame();
     Harness.RefreshOutput();
 }
Exemplo n.º 17
0
 public override void OnLevelStart(Models.Level level, bool arcade)
 {
     Console.WriteLine($"{arcade}\t{Info.Name} - OnLevelStart : {level.levelname}");
 }
Exemplo n.º 18
0
 public virtual void OnLevelStart(Models.Level level, bool arcade)
 {
     return;
 }