Пример #1
0
        public TwoPlayerBaseGame(DataClasses.GameConfiguration gameConfig)
            : base(gameConfig)
        {
            // load ship 1
            SpriteObjects.Ship ship = gameConfig.Ship;
            player1BaseDamage = gameConfig.Ship.damage;
            player1BaseShield = gameConfig.Ship.sheilds;
            ship.ShipPosition = mMapLoader.shipStartPosP1;
            ship.World = base.mWorld;
            ship.ShipId = "1";

            // load ship 2
            SpriteObjects.Ship ship2 = gameConfig.Ship2;
            player2BaseDamage = gameConfig.Ship2.damage;
            player2BaseShield = gameConfig.Ship2.sheilds;
            ship2.ShipPosition = mMapLoader.shipStartPosP2;
            ship2.World = base.mWorld;
            ship2.ShipId = "2";

            mPlayer1 = new ControllerAgents.LocalAgent(ship);
            mPlayer2 = new ControllerAgents.LocalAgent(ship2);

            cam = new CameraControls.TwoPlayerCamera();
            _angle = 0.0f;
            initaliseHUD();
        }
        public static bool StoreData_TrunkStaticEcce_RemoteDB(DataClasses.GrucoxTrunkStaticEcce data, int UserID)
        {
            DataClasses.GrucoxDataClassesRemoteDBDataContext dc = new DataClasses.GrucoxDataClassesRemoteDBDataContext();

            var matchedItem = (from sessions in dc.GetTable<DataClasses.GrucoxTrunkStaticEcce>()          //**************************************
                               where sessions.Id == data.Id                              //******Check if customer already exists
                               select sessions).SingleOrDefault();                                     //**************************************

            if (matchedItem == null)                                                //If customer does not exist
            {
                try
                {
                    dc.GrucoxTrunkStaticEcces.InsertOnSubmit(data);
                    dc.GrucoxTrunkStaticEcces.Context.SubmitChanges();                      //Add the new customer to the Customers Table
                    return true;
                }
                catch (Exception ex)
                {
                    return false;
                }
            }
            else                                                                    //Customer already exists
            {
                try
                {
                    dc.SubmitChanges();
                    return true;
                }
                catch (Exception ex)
                {
                    return false;
                }
            }
        }
Пример #3
0
        public SinglePlayer(DataClasses.GameConfiguration gameConfig)
            : base(gameConfig)
        {
            SpriteObjects.Ship ship = gameConfig.Ship;
            player1BaseDamage = gameConfig.Ship.damage;
            player1BaseShield = gameConfig.Ship.sheilds;
            ship.ShipPosition = mMapLoader.shipStartPosP1;
            ship.World = base.mWorld;
            ship.ShipId = "1";

            SpriteObjects.Ship aIShip = gameConfig.Ship2;
            player2BaseDamage = gameConfig.Ship2.damage;
            player2BaseShield = gameConfig.Ship2.sheilds;
            aIShip.ShipPosition = mMapLoader.shipStartPosP2;
            aIShip.World = base.mWorld;
            aIShip.ShipId = "2";

            powerups.Add("shield");
            powerups.Add("Shotgun");
            powerups.Add("Machinegun");
            powerups.Add("Spiral");
            powerups.Add("Emp");
            powerups.Add("Net");

            mPlayer1 = new ControllerAgents.LocalAgent(ship);
            mAI2 = new ControllerAgents.AIAgent(aIShip, base.mWorld);
            this.cam = new CameraControls.Camera();
            initaliseHUD();
        }
Пример #4
0
        public ActionResult RegistrationForm()
        {
            //var files = objData.GetFiles();
            var files = DataClasses.GetFiles();

            return(View(files));
        }
        private static bool StoreData_RemoteDB1(DataClasses.GrucoxTrunkCustomSession customProgram, int UserID)
        {
            DataClasses.GrucoxDataClassesRemoteDBDataContext dc = new DataClasses.GrucoxDataClassesRemoteDBDataContext();

            try
            {
                var matchedItem = (from sessions in dc.GetTable<DataClasses.GrucoxTrunkCustomSession>()           //**************************************
                                   where sessions.Id == customProgram.Id                                          //******Check if customer already exists
                                   select sessions).SingleOrDefault();                                            //**************************************

                if (matchedItem == null)                                                       //If customer does not exist
                {
                    dc.GrucoxTrunkCustomSessions.InsertOnSubmit(customProgram);
                    dc.GrucoxTrunkCustomSessions.Context.SubmitChanges();                      //Add the new customer to the Customers Table
                    return true;
                }
                else                                                                           //Customer already exists
                {
                    dc.SubmitChanges();
                    return true;
                }
            }
            catch (Exception)
            {
                //For Diagnostics - Should be removed
                DataComms.CreateThreadInstance("DB Access / Upload Error for Custom Trunk Program");
                return false;
            }
        }
        public ReportDefinitionBuilder(DataClasses.ReportSettings settings)
        {
            _settings = settings;

            _report = new RdlSchema.Report();
            _report.DataSources = CreateDataSources();
            _report.DataSets = CreateDataSets();
            _report.Body = CreateBody();
        }
Пример #7
0
 public DogFight(DataClasses.GameConfiguration gameConfig)
     : base(gameConfig)
 {
     powerups.Add("shield");
     powerups.Add("Shotgun");
     powerups.Add("Machinegun");
     powerups.Add("Spiral");
     powerups.Add("Emp");
     powerups.Add("Net");
 }
Пример #8
0
        public GameScreen(DataClasses.GameConfiguration gameConfig)
        {
            mWorld = new World(new Vector2(0, 2));
            mMapLoader = new Maps.MapLoader(gameConfig.MapName, mWorld);
            SpriteObjects.Ship ship = gameConfig.Ship;
            ship.ShipPosition = mMapLoader.shipStartPosP1;
            ship.World = mWorld;
            mPlayer1 = new ControllerAgents.LocalAgent(ship);

            _cameraZoom = new Vector3(0.5f, 0.5f, 0.5f);
        }
Пример #9
0
        public FileResult Download(string id)
        {
            int fid = Convert.ToInt32(id);
            //var files = objData.GetFiles();
            var    files    = DataClasses.GetFiles();
            string filename = (from f in files
                               where f.FileId == fid
                               select f.FilePath).First();
            string contentType  = "application/pdf";
            string documentName = (from t in files
                                   where t.FileId == fid
                                   select t.FileName).First();

            return(File(filename, contentType, String.Format("{0}.pdf", documentName)));
        }
        /// <summary>
        /// Update or Register a new user
        /// </summary>
        /// <param name="NewUser"></param>
        public static bool RegisterNewUser(DataClasses.UserProfile NewUser)
        {
            DataClasses.GrucoxDataClassDataContext dc = new DataClasses.GrucoxDataClassDataContext();
            try
            {
                var matchedItem = (from users in dc.GetTable<DataClasses.UserProfile>()        //**************************************
                                   where users.id == NewUser.id                                 //******Check if customer already exists
                                   select users).SingleOrDefault();                             //**************************************

                if (matchedItem == null)                                                //If customer does not exist
                {
                    try
                    {
                        dc.UserProfiles.InsertOnSubmit(NewUser);
                        dc.UserProfiles.Context.SubmitChanges();                      //Add the new customer to the Customers Table
                        return true;
                    }
                    catch (Exception ex)
                    {
                        return false;
                    }
                }
                else                                                                    //Customer already exists
                {
                    try
                    {
                        dc.SubmitChanges();
                        return true;
                    }
                    catch (Exception ex)
                    {
                        return false;
                    }

                }
            }
            catch (System.Data.SqlClient.SqlException)
            {
                frmMessageDialog.DisplayBriefMessage("Local Database Connection Error");
                return false;
            }
            catch (Exception ex)
            {
                frmMessageDialog.DisplayBriefMessage(ex.Message);
                return false;
            }
        }
        public static bool TryRegisterNewSystem(ref DataClasses.GrucoxSystemInfo SystemInfo, string HardwareID)
        {
            DataClasses.GrucoxDataClassesRemoteDBDataContext dc = new DataClasses.GrucoxDataClassesRemoteDBDataContext();
            List<DataClasses.GrucoxSystemInfo> ListSystemInfo = new List<DataClasses.GrucoxSystemInfo>();

            try
            {
                var matchedItem = (from systems in dc.GetTable<DataClasses.GrucoxSystemInfo>()
                                       where systems.HardwareID == HardwareID
                                       select systems).SingleOrDefault();

                if (matchedItem == null)                                                //If customer does not exist
                {
                    try
                    {
                        dc.GrucoxSystemInfos.InsertOnSubmit(SystemInfo);
                        dc.GrucoxSystemInfos.Context.SubmitChanges();                      //Add the new customer to the Customers Table
                        return true;
                    }
                    catch (Exception ex)
                    {
                        return false;
                    }
                }
                else                                                                    //Customer already exists
                {
                    try
                    {
                        matchedItem.IPAddress = SystemInfo.IPAddress;
                        dc.SubmitChanges();
                        SystemInfo = matchedItem;
                        return true;
                    }
                    catch (Exception ex)
                    {
                        return false;
                    }

                }
            }
            catch (Exception)
            {
                //For Diagnostics - Should be removed
                DataComms.CreateThreadInstance("DB Access during RegisterNewSystem");
                return false;
            }
        }
 private void ResetData()
 {
     Name         = "";
     Title        = "";
     Domain       = "";
     BreachDate   = DateTime.Now;
     AddedDate    = DateTime.Now;
     ModifiedDate = DateTime.Now;
     PwnCount     = 0;
     Description  = "";
     DataClasses.Clear();
     IsVerified   = false;
     IsFabricated = false;
     IsSensitive  = false;
     IsRetired    = false;
     IsSpamList   = false;
     LogoPath     = "";
 }
        public static void DeleteUser(DataClasses.UserProfile CurrentUser)
        {
            DataClasses.GrucoxDataClassDataContext dc = new DataClasses.GrucoxDataClassDataContext();
            var matchedUser = (from sessions in dc.GetTable<DataClasses.UserProfile>()
                               where sessions.id == CurrentUser.id
                               select sessions).SingleOrDefault();

            try
            {
                dc.UserProfiles.DeleteOnSubmit(matchedUser);
                dc.SubmitChanges();
            }
            catch (Exception ex)
            {
                throw ex;
            }

        }
        /// <summary>
        /// Restituisce il contenuto dell'oggetto in formato JSON
        /// </summary>
        /// <returns>Contenuto dell'oggetto in formato JSON</returns>
        public JObject AsJSON()
        {
            JObject json = new JObject
            {
                { nameof(Name), new JValue(Name) },
                { nameof(Title), new JValue(Title) },
                { nameof(Domain), new JValue(Domain) },
                { nameof(BreachDate), new JValue(Newtonsoft.Json.JsonConvert.SerializeObject(BreachDate, dateTimeConverter)) },
                { nameof(AddedDate), new JValue(Newtonsoft.Json.JsonConvert.SerializeObject(AddedDate, dateTimeConverter)) },
                { nameof(ModifiedDate), new JValue(Newtonsoft.Json.JsonConvert.SerializeObject(ModifiedDate, dateTimeConverter)) },
                { nameof(PwnCount), new JValue(PwnCount) },
                { nameof(Description), new JValue(Description) },
                { nameof(DataClasses), new JArray(DataClasses.ToArray()) },
                { nameof(IsVerified), new JValue(IsVerified) },
                { nameof(IsFabricated), new JValue(IsFabricated) },
                { nameof(IsSensitive), new JValue(IsSensitive) },
                { nameof(IsRetired), new JValue(IsRetired) },
                { nameof(IsSpamList), new JValue(IsSpamList) },
                { nameof(LogoPath), new JValue(LogoPath) }
            };

            return(json);
        }
        public static bool StoreData_TrunkStaticEcce_LocalDB(DataClasses.GrucoxTrunkStaticEcce data, int UserID)
        {
            //DataClasses.GrucoxDataClassDataContext dc = new DataClasses.GrucoxDataClassDataContext();

            //var matchedItem = (from sessions in dc.GetTable<DataClasses.VO2MaxTestConcForward>()          //**************************************
            //                   where sessions.id == vO2MaxTestConcForw.id                              //******Check if customer already exists
            //                   select sessions).SingleOrDefault();                                     //**************************************

            //if (matchedItem == null)                                                //If customer does not exist
            //{
            //    try
            //    {
            //        dc.VO2MaxTestConcForwards.InsertOnSubmit(vO2MaxTestConcForw);
            //        dc.VO2MaxTestConcForwards.Context.SubmitChanges();                      //Add the new customer to the Customers Table
            //        return true;
            //    }
            //    catch (Exception ex)
            //    {
            //        return false;
            //    }
            //}
            //else                                                                    //Customer already exists
            //{
            //    try
            //    {
            //        dc.SubmitChanges();
            //        return true;
            //    }
            //    catch (Exception ex)
            //    {
            //        return false;
            //    }
            //}

            return true;
        }
Пример #16
0
        public MatrixBuilder(DataClasses.ReportSettings settings)
        {
            _settings = settings;

            foreach (DataClasses.ReportColumn column in settings.MatrixRows)
            {
                RowFields.Add(column.Name.RemoveAccent());
            }


            foreach (DataClasses.ReportColumn column in settings.Columns)
            {
                if (column.ReportDataTypeId != DataClasses.ReportDataType.Number)
                    ColumnFields.Add(column.Name);
                else
                    SummarizedFields.Add(column.Name);

            }

            if (SummarizedFields.Count == 0)
                SummarizedFields.Add("Qtd");

            //SummarizedFields.Add(settings.MatrixRows[0].Name);
        }
Пример #17
0
 public TopologiesController()
 {
     objData = new DataClasses();
 }
Пример #18
0
 private void gameSelectedHandler(object sender, DataClasses.GameSelectedEventArgs e)
 {
     if (this.gameSelected != null)
         this.gameSelected(sender, e);
 }
        private static bool StoreDataDynamicStrength_RemoteDB(DataClasses.DynamicStrengthTest dynamicStrengthTest, int UserID)
        {
            GrucoxDynamicStrengthTestSession DynamicStrengthTestSession = new GrucoxDynamicStrengthTestSession();
            DynamicStrengthTestSession.DeviceUID = (new Grucox.DataManager(CalibrationSettings.Default.DataManagerConnectionString)).GetDeviceMacAddress();
            DynamicStrengthTestSession.LiveUserID = UserID;
            DynamicStrengthTestSession.SessionDate = DateTime.Now.Subtract(TimeSpan.FromMinutes(10));
            DynamicStrengthTestSession.LeftMaxTorqueConc = Convert.ToDecimal(dynamicStrengthTest.LeftMaxTorqueConc);
            DynamicStrengthTestSession.LeftMaxTorqueEcce = Convert.ToDecimal(dynamicStrengthTest.LeftMaxTorqueEcce);
            DynamicStrengthTestSession.RightMaxTorqueConc = Convert.ToDecimal(dynamicStrengthTest.RightMaxTorqueConc);
            DynamicStrengthTestSession.RightMaxTorqueEcce = Convert.ToDecimal(dynamicStrengthTest.RightMaxTorqueEcce);
            DynamicStrengthTestSession.SpeedLeftMaxConc = Convert.ToDecimal(dynamicStrengthTest.SpeedLeftMaxConc);
            DynamicStrengthTestSession.SpeedLeftMaxEcce = Convert.ToDecimal(dynamicStrengthTest.SpeedLeftMaxEcce);
            DynamicStrengthTestSession.SpeedRightMaxConc = Convert.ToDecimal(dynamicStrengthTest.SpeedRightMaxConc);
            DynamicStrengthTestSession.SpeedRightMaxEcce = Convert.ToDecimal(dynamicStrengthTest.SpeedRightMaxEcce);

            DataClasses.GrucoxDataClassesRemoteDBDataContext dc = new DataClasses.GrucoxDataClassesRemoteDBDataContext();

            var matchedItem = (from sessions in dc.GetTable<DataClasses.GrucoxDynamicStrengthTestSession>()          //**************************************
                               where sessions.ItemID == dynamicStrengthTest.id                                       //******Check if customer already exists
                               select sessions).SingleOrDefault();                                                   //**************************************

            if (matchedItem == null)                                                //If customer does not exist
            {
                try
                {
                    dc.GrucoxDynamicStrengthTestSessions.InsertOnSubmit(DynamicStrengthTestSession);
                    dc.GrucoxDynamicStrengthTestSessions.Context.SubmitChanges();                      //Add the new customer to the Customers Table
                    return true;
                }
                catch (Exception ex)
                {
                    return false;
                }
            }
            else                                                                    //Customer already exists
            {
                try
                {
                    dc.SubmitChanges();
                    return true;
                }
                catch (Exception ex)
                {
                    return false;
                }
            }
        }
        private static bool StoreDataDynamicStrength_LocalDB(DataClasses.DynamicStrengthTest dynamicStrengthTest, int UserID)
        {
            DataClasses.GrucoxDataClassDataContext dc = new DataClasses.GrucoxDataClassDataContext();

            var matchedItem = (from sessions in dc.GetTable<DataClasses.DynamicStrengthTest>()          //**************************************
                               where sessions.id == dynamicStrengthTest.id                              //******Check if customer already exists
                               select sessions).SingleOrDefault();                                     //**************************************

            if (matchedItem == null)                                                //If customer does not exist
            {
                try
                {
                    dc.DynamicStrengthTests.InsertOnSubmit(dynamicStrengthTest);
                    dc.DynamicStrengthTests.Context.SubmitChanges();                      //Add the new customer to the Customers Table
                    return true;
                }
                catch (Exception ex)
                {
                    return false;
                }
            }
            else                                                                    //Customer already exists
            {
                try
                {
                    dc.SubmitChanges();
                    return true;
                }
                catch (Exception ex)
                {
                    return false;
                }
            }
        }
 private static bool StoreWeight_RemoteDB(DataClasses.UserProfile User, int UserID, double Weight)
 {
     GlobalVariables.LoggedInUser.Weight = Convert.ToInt32(Weight);
     Grucox.DataManager dataManager = new Grucox.DataManager(CalibrationSettings.Default.DataManagerConnectionString);
     string result = dataManager.SetUserWeight(User.EmailAddress, Weight.ToString());
     if (result == "OK")
         return true;
     else
         return false;
 }
 private static bool StoreData_LocalDB(DataClasses.GrucoxTrunkCustomSession customProgram, int UserID)
 {
     //Function not implemented
     return true;
 }
        //Try register remote user - move to controller?
        private bool TryRegisterUserOnline(out string RegisterResult, ref DataClasses.UserProfile newUser)
        {
            Grucox.DataManager DataManager = new Grucox.DataManager(CalibrationSettings.Default.DataManagerConnectionString);
            string Response = DataManager.RegisterUser(NewUser.Name, NewUser.Surname, NewUser.EmailAddress, NewUser.Password, NewUser.Weight.ToString());

            string[] Result = Response.Split('|');

            if (Result.Length == 1)
            {
                RegisterResult = "ServerConnectionFailed";
                return false;
            }

            if (Result[0] == "SUCCESS")
            {
                int userId;
                string[] userIdStringArray = Result[1].Split(new string[]{"\r\n\r\n</pre></table>"}, StringSplitOptions.None);
                RegisterResult = Result[0];
                bool result = Int32.TryParse(userIdStringArray[0], out userId);
                if (result == true)
                {
                    newUser.id = userId;
                    return true;
                }
                else
                {
                    RegisterResult = "StringParseError";
                    return false;
                }
            }
            else if (Result[1] == "UserAlreadyRegistered")
            {
                RegisterResult = "UserAlreadyRegistered";
                return false;
            }
            else if (Result[1] == "UsernameAlreadyExists")
            {
                RegisterResult = "UserAlreadyRegistered";
                return false;
            }
            else if (Result[1] == "Unable to connect to the remote server")
            {
                RegisterResult = "ServerConnectionFailed";
                return false;
            }
            else if (Result[1] == "The remote server returned an error: (403) Forbidden.")
            {
                RegisterResult = "ServerConnectionFailed";
                return false;
            }
            else if (Result[1] == "The remote server returned an error: (403) Forbidden.")
            {
                RegisterResult = "ServerConnectionFailed";
                return false;
            }
            else if (Result[1] == "UnexpectedError")
            {
                RegisterResult = "UnexpectedError";
                return false;
            }
            else
            {
                RegisterResult = "ServerConnectionFailed";
                return false;
            }
        }
        public static void ResetUserData(DataClasses.UserProfile CurrentUser)
        {
            DataClasses.GrucoxDataClassDataContext dc = new DataClasses.GrucoxDataClassDataContext();
            var matchedEntries = (from sessions in dc.GetTable<DataClasses.CustomProgram>()
                                  where sessions.UserID == CurrentUser.id
                                  select sessions).ToList<DataClasses.CustomProgram>();

            try
            {
                foreach (DataClasses.CustomProgram entry in matchedEntries)
                    dc.CustomPrograms.DeleteOnSubmit(entry);
                dc.SubmitChanges();
            }
            catch (Exception ex)
            {
                throw ex;
            }

        }
 public static bool StoreWeight(DataClasses.UserProfile User, int UserID, double Weight)
 {
     if (GlobalVariables.WriteToRemoteServer == true)
     {
         if (StoreWeight_RemoteDB(User, UserID, Weight) == true)
             return true;
         else
             return false;
     }
     else if (GlobalVariables.WriteToRemoteServer == false)
     {
         if (StoreWeight_LocalDB(User, UserID, Weight) == true)
             return true;
         else
             return false;
     }
     else
     { 
         return false;
     }
 }
        private static bool StoreDataProprioceptionProgram_LocalDB(DataClasses.ProprioceptionProgram proprioceptionProgram, int UserID, int DifficultyLevel)
        {
            DataClasses.GrucoxDataClassDataContext dc = new DataClasses.GrucoxDataClassDataContext();

            var matchedItem = (from sessions in dc.GetTable<DataClasses.ProprioceptionProgram>()           //**************************************
                               where sessions.id == proprioceptionProgram.id                               //******Check if customer already exists
                               select sessions).SingleOrDefault();                                 //**************************************

            if (matchedItem == null)                                                //If customer does not exist
            {
                try
                {
                    dc.ProprioceptionPrograms.InsertOnSubmit(proprioceptionProgram);
                    dc.ProprioceptionPrograms.Context.SubmitChanges();                      //Add the new customer to the Customers Table
                    return true;
                }
                catch (Exception ex)
                {
                    return false;
                }
            }
            else                                                                    //Customer already exists
            {
                try
                {
                    dc.SubmitChanges();
                    return true;
                }
                catch (Exception ex)
                {
                    return false;
                }

            }
        }
        /// <summary>
        /// Effettua il parsing del json e popola la struttura
        /// </summary>
        /// <param name="json">Oggetto JSON di cui fare il parsing</param>
        public void ParseJSON(JObject json)
        {
            ResetData();

            if (Utility.SafeTryGetJSONString(json, nameof(Name), out string value))
            {
                Name = value;
            }
            if (Utility.SafeTryGetJSONString(json, nameof(Title), out value))
            {
                Title = value;
            }
            if (Utility.SafeTryGetJSONString(json, nameof(Domain), out value))
            {
                Domain = value;
            }
            if (Utility.SafeTryGetJSONDeserialize <DateTime>(json, nameof(BreachDate), dateTimeConverter, out DateTime dtValue))
            {
                BreachDate = dtValue;
            }
            if (Utility.SafeTryGetJSONDeserialize <DateTime>(json, nameof(AddedDate), dateTimeConverter, out dtValue))
            {
                AddedDate = dtValue;
            }
            if (Utility.SafeTryGetJSONDeserialize <DateTime>(json, nameof(ModifiedDate), dateTimeConverter, out dtValue))
            {
                ModifiedDate = dtValue;
            }
            if (Utility.SafeTryGetJSONNumber(json, nameof(PwnCount), out double numberValue))
            {
                PwnCount = (int)Math.Truncate(numberValue);
            }
            if (Utility.SafeTryGetJSONString(json, nameof(Description), out value))
            {
                Description = value;
            }
            if (Utility.SafeTryGetJSON(json, nameof(DataClasses), out JToken jsonValue))
            {
                JArray jArray = jsonValue.ToObject <JArray>();
                foreach (JToken token in jArray)
                {
                    DataClasses.Add(token.ToString());
                }
            }
            if (Utility.SafeTryGetJSONBool(json, nameof(IsVerified), out bool bValue))
            {
                IsVerified = bValue;
            }
            if (Utility.SafeTryGetJSONBool(json, nameof(IsFabricated), out bValue))
            {
                IsFabricated = bValue;
            }
            if (Utility.SafeTryGetJSONBool(json, nameof(IsSensitive), out bValue))
            {
                IsSensitive = bValue;
            }
            if (Utility.SafeTryGetJSONBool(json, nameof(IsRetired), out bValue))
            {
                IsRetired = bValue;
            }
            if (Utility.SafeTryGetJSONBool(json, nameof(IsSpamList), out bValue))
            {
                IsSpamList = bValue;
            }
            if (Utility.SafeTryGetJSONString(json, nameof(LogoPath), out value))
            {
                LogoPath = value;
            }
        }
        public static bool StoreDataVO2Max_RemoteDB(DataClasses.VO2MaxProgram1 vO2MaxProgram1, int UserID)
        {
            GrucoxVO2MaxProgramSession VO2MaxProgramSession = new GrucoxVO2MaxProgramSession();
            VO2MaxProgramSession.DeviceUID = (new Grucox.DataManager(CalibrationSettings.Default.DataManagerConnectionString)).GetDeviceMacAddress();
            VO2MaxProgramSession.LiveUserID = UserID;
            VO2MaxProgramSession.SessionDate = DateTime.Now.Subtract(TimeSpan.FromMinutes(10));
            VO2MaxProgramSession.SessionDuration = TimeSpan.FromSeconds(vO2MaxProgram1.SessionDuration.Value);
            VO2MaxProgramSession.LeftMaxConcP = Convert.ToDecimal(vO2MaxProgram1.LeftMaxConcP);
            VO2MaxProgramSession.LeftMaxEcceP = Convert.ToDecimal(vO2MaxProgram1.LeftMaxEcceP);
            VO2MaxProgramSession.RightMaxConcP = Convert.ToDecimal(vO2MaxProgram1.RightMaxConcP);
            VO2MaxProgramSession.RightMaxEcceP = Convert.ToDecimal(vO2MaxProgram1.RightMaxEcceP);
            VO2MaxProgramSession.LeftAvgConcP = Convert.ToDecimal(vO2MaxProgram1.LeftAvgConcP);
            VO2MaxProgramSession.LeftAvgEcceP = Convert.ToDecimal(vO2MaxProgram1.LeftAvgEcceP);
            VO2MaxProgramSession.RightAvgConcP = Convert.ToDecimal(vO2MaxProgram1.RightAvgConcP);
            VO2MaxProgramSession.RightAvgEcceP = Convert.ToDecimal(vO2MaxProgram1.RightAvgEcceP);
            VO2MaxProgramSession.LeftStrengthIndex = Convert.ToDecimal(vO2MaxProgram1.LeftStrengthIndex);
            VO2MaxProgramSession.LeftEnduranceIndex = Convert.ToDecimal(vO2MaxProgram1.LeftEnduranceIndex);
            VO2MaxProgramSession.RightStrengthIndex = Convert.ToDecimal(vO2MaxProgram1.RightStrengthIndex);
            VO2MaxProgramSession.RightEnduranceIndex = Convert.ToDecimal(vO2MaxProgram1.RightEnduranceIndex);
            VO2MaxProgramSession.DistConc = Convert.ToDecimal(vO2MaxProgram1.DistConc);
            VO2MaxProgramSession.DistEcce = Convert.ToDecimal(vO2MaxProgram1.DistEcce);
            VO2MaxProgramSession.EnergyBurned = Convert.ToDecimal(vO2MaxProgram1.EnergyBurned);
            VO2MaxProgramSession.VO2MaxProgramEnum = vO2MaxProgram1.VO2MaxProgramEnum.Value;
            VO2MaxProgramSession.SessionDescription = "VO2 Max Program " + vO2MaxProgram1.VO2MaxProgramEnum.Value;

            DataClasses.GrucoxDataClassesRemoteDBDataContext dc = new DataClasses.GrucoxDataClassesRemoteDBDataContext();

            var matchedItem = (from sessions in dc.GetTable<DataClasses.GrucoxVO2MaxProgramSession>()           //**************************************
                               where sessions.ItemID == VO2MaxProgramSession.ItemID                             //******Check if customer already exists
                               select sessions).SingleOrDefault();                                              //**************************************

            if (matchedItem == null)                                                //If customer does not exist
            {
                try
                {
                    dc.GrucoxVO2MaxProgramSessions.InsertOnSubmit(VO2MaxProgramSession);
                    dc.GrucoxVO2MaxProgramSessions.Context.SubmitChanges();                      //Add the new customer to the Customers Table
                    return true;
                }
                catch (Exception ex)
                {
                    return false;
                }
            }
            else                                                                    //Customer already exists
            {
                try
                {
                    dc.SubmitChanges();
                    return true;
                }
                catch (Exception ex)
                {
                    return false;
                }

            }
        }
Пример #29
0
 public ReportsController()
 {
     objData = new DataClasses();
 }
        public static bool VerifyRemoteUser(DataClasses.UserProfile SelectedUser, out string VerifyUserResult)
        {
            Grucox.DataManager DataManager = new Grucox.DataManager(CalibrationSettings.Default.DataManagerConnectionString);
            string Response = DataManager.VerifyUser(SelectedUser.EmailAddress, SelectedUser.Password);
            string[] Result = Response.Split('|');
            VerifyUserResult = Response;

            try
            {
                if (Result[0] == "VALID")
                {
                    SelectedUser.id = Convert.ToInt32(Result[1]);
                    string WeightString = DataManager.GetUserWeight(SelectedUser.EmailAddress);
                    string[] GetWeightResult = WeightString.Split('|');
                    if (GetWeightResult[0] != "FAILED")
                        SelectedUser.Weight = Convert.ToInt32(GetWeightResult[1]);
                    GlobalFunctions.UserLogOff();
                    GlobalVariables.LoggedInUser = SelectedUser;
                    GlobalVariables.GlobUserLoggedIn = true;
                    return true;
                }
                else
                {
                    if (Result[1] == "Password Did Not Match.")
                        VerifyUserResult = Result[1];
                    else
                        VerifyUserResult = "Unknown Error";
                    return false;
                }
            }
            catch (Exception Ex)
            {
                VerifyUserResult = "Unknown Error";
                return false;
            }
        }
Пример #31
0
        /// <summary>
        /// Creates an FFB effect, stores it at a given slot and starts its playback.
        /// </summary>
        /// <param name="data">
        /// Parameters of the effect to be created.
        /// </param>
        /// <returns>
        /// Returns true if successful, otherwise returns false.
        /// </returns>
        public bool SendFFBEffect(DataClasses.FFBEffectData data)
        {
            //Check if the device is properly initialized
            if (ffbDevice == null)
            {
                MessageBox.Show("Device not initialized.", FFBInspector.Properties.Resources.errCap_devError,
                                MessageBoxButtons.OK, MessageBoxIcon.Stop);
                return false;
            }

            //If there is an effect already stored in this slot, remove it
            StopOneEffect(data.slot);

            int[] axes = new Int32[actuatorsObjectTypes.Count];
            int i = 0;
            foreach (int objt in actuatorsObjectTypes)
            {
                axes[i++] = objt;
            }

            //Set effect direction
            int[] dirs = data.effect.GetDirections();

            //Set the general effect parameters up
            EffectParameters eParams = new EffectParameters();
            eParams.Duration = data.effect.duration;
            eParams.Flags = EffectFlags.Cartesian | EffectFlags.ObjectIds;
            eParams.Gain = data.effect.gain;
            eParams.SetAxes(axes, dirs);
            eParams.StartDelay = data.effect.startDelay;
            eParams.SamplePeriod = 0; //Use the default sample period;
            eParams.TriggerButton = data.effect.trigButton;
            eParams.TriggerRepeatInterval = data.effect.trigRepInterval;

            //Set the type specific effect parameters up
            TypeSpecificParameters typeSpec = null;
            if (data.effect.effectGuid == EffectGuid.ConstantForce)
            {
                DataClasses.ConstantEffectTypeData cfEfd = (DataClasses.ConstantEffectTypeData)data.effect;
                typeSpec = new ConstantForce();
                typeSpec.AsConstantForce().Magnitude = cfEfd.magnitude;
            }
            else if (data.effect.effectGuid == EffectGuid.RampForce)
            {
                DataClasses.RampEffectTypeData rfEfd = (DataClasses.RampEffectTypeData)data.effect;
                typeSpec = new RampForce();
                typeSpec.AsRampForce().Start = rfEfd.start;
                typeSpec.AsRampForce().End = rfEfd.end;
            }
            else if (data.effect.effectGuid == EffectGuid.Sine || data.effect.effectGuid == EffectGuid.Triangle ||
                     data.effect.effectGuid == EffectGuid.Square ||
                     data.effect.effectGuid == EffectGuid.SawtoothUp ||
                     data.effect.effectGuid == EffectGuid.SawtoothDown)
            {
                DataClasses.PeriodicEffectTypeData pfEfd = (DataClasses.PeriodicEffectTypeData)data.effect;
                typeSpec = new PeriodicForce();
                typeSpec.AsPeriodicForce().Magnitude = pfEfd.magnitude;
                typeSpec.AsPeriodicForce().Offset = pfEfd.offset;
                typeSpec.AsPeriodicForce().Period = pfEfd.period;
                typeSpec.AsPeriodicForce().Phase = pfEfd.phase;
            }
            else if (data.effect.effectGuid == EffectGuid.Friction || data.effect.effectGuid == EffectGuid.Inertia ||
                     data.effect.effectGuid == EffectGuid.Damper || data.effect.effectGuid == EffectGuid.Spring)
            {
                DataClasses.ConditionEffectTypeData cdEfd = (DataClasses.ConditionEffectTypeData)data.effect;
                typeSpec = new ConditionSet();
                typeSpec.AsConditionSet().Conditions = new Condition[1];

                typeSpec.AsConditionSet().Conditions[0].DeadBand = cdEfd.deadBand;
                typeSpec.AsConditionSet().Conditions[0].Offset = cdEfd.offset;
                typeSpec.AsConditionSet().Conditions[0].NegativeCoefficient = cdEfd.negCoeff;
                typeSpec.AsConditionSet().Conditions[0].NegativeSaturation = cdEfd.negSat;
                typeSpec.AsConditionSet().Conditions[0].PositiveCoefficient = cdEfd.posCoeff;
                typeSpec.AsConditionSet().Conditions[0].PositiveSaturation = cdEfd.posSat;
            }
            eParams.Parameters = typeSpec;

            //Create an envelope
            if (data.envelope != null)
            {
                Envelope envp = new Envelope();
                envp.AttackLevel = data.envelope.attackLevel;
                envp.AttackTime = data.envelope.attackTime;
                envp.FadeLevel = data.envelope.fadeLevel;
                envp.FadeTime = data.envelope.fadeTime;

                eParams.Envelope = envp;
            }

            //Create an effect and add it to the list
            Effect ef;
            try
            {
                ef = new Effect(ffbDevice, data.effect.effectGuid, eParams);
                ffbEffects[data.slot] = ef;
            }
            catch (Exception ex)
            {
                MessageBox.Show("Cannot create effect.\n" + ex.Message + "\n" + ex.Data,
                                FFBInspector.Properties.Resources.errCap_effError,
                                MessageBoxButtons.OK, MessageBoxIcon.Error);
                return false;
            }

            return StartFFBEffect(ef);
        }
Пример #32
0
        /// <summary>
        /// Sets range of axes values reported by DirectInput.
        /// </summary>
        /// <param name="s">
        /// Range to be set.
        /// </param>
        /// <returns>
        /// Returns true if successful, otherwise returns false.
        /// </returns>
        public bool SetAxisRange(DataClasses.AxesRange s)
        {
            if (ffbDevice == null)
                return false;

            PauseAllEffects();
            ffbDevice.Unacquire();
            ffbDevice.Properties.SetRange(s.minimum, s.maximum);

            SlimDX.Result res = ffbDevice.Acquire();
            if (!(res != ResultCode.Success || res != ResultCode.Failure))
            {
                MessageBox.Show("Cannot reacquire the device.\n" +
                                "Make sure no other application is using the device\n" +
                                res.ToString(), FFBInspector.Properties.Resources.errCap_devError,
                                MessageBoxButtons.OK, MessageBoxIcon.Error);
                return false;
            }

            ResumeAllEffects();
            return true;
        }
Пример #33
0
 public AboutController()
 {
     objData = new DataClasses();
 }
        public static bool StoreData_VO2MaxTest_RemoteDB(DataClasses.VO2MaxTestConcForward vO2MaxTestConcForw, int UserID)
        {
            GrucoxVO2MaxTestSession VO2MaxTestSession = new GrucoxVO2MaxTestSession();
            VO2MaxTestSession.DeviceUID = (new Grucox.DataManager(CalibrationSettings.Default.DataManagerConnectionString)).GetDeviceMacAddress();
            VO2MaxTestSession.LiveUserID = UserID;
            VO2MaxTestSession.SessionDate = DateTime.Now.Subtract(TimeSpan.FromMinutes(10));
            VO2MaxTestSession.VO2Max = Convert.ToDecimal(vO2MaxTestConcForw.VO2Max.Value);
            VO2MaxTestSession.VO2MaxRel = Convert.ToDecimal(vO2MaxTestConcForw.VO2MaxRel.Value);
            VO2MaxTestSession.MaxConcPower = Convert.ToDecimal(vO2MaxTestConcForw.MaxConcPower.Value);

            DataClasses.GrucoxDataClassesRemoteDBDataContext dc = new DataClasses.GrucoxDataClassesRemoteDBDataContext();

            var matchedItem = (from sessions in dc.GetTable<DataClasses.GrucoxVO2MaxTestSession>()          //**************************************
                               where sessions.ItemID == VO2MaxTestSession.ItemID                              //******Check if customer already exists
                               select sessions).SingleOrDefault();                                     //**************************************

            if (matchedItem == null)                                                //If customer does not exist
            {
                try
                {
                    dc.GrucoxVO2MaxTestSessions.InsertOnSubmit(VO2MaxTestSession);
                    dc.GrucoxVO2MaxTestSessions.Context.SubmitChanges();                      //Add the new customer to the Customers Table
                    return true;
                }
                catch (Exception ex)
                {
                    return false;
                }
            }
            else                                                                    //Customer already exists
            {
                try
                {
                    dc.SubmitChanges();
                    return true;
                }
                catch (Exception ex)
                {
                    return false;
                }
            }
        }
        public static bool StoreData_FTPTest_RemoteDB(DataClasses.FTPTestConcForward FTPTestConcForwards, int UserID)
        {
            DataClasses.GrucoxFTPTestSession FTPtest = new GrucoxFTPTestSession();
            FTPtest.DeviceUID = (new Grucox.DataManager(CalibrationSettings.Default.DataManagerConnectionString)).GetDeviceMacAddress();
            FTPtest.LiveUserID = UserID;
            FTPtest.SessionDate = DateTime.Now.Subtract(TimeSpan.FromMinutes(10));
            FTPtest.FTPConcForwards = Convert.ToDecimal(FTPTestConcForwards.FTPConcForwards.Value);
            DataClasses.GrucoxDataClassesRemoteDBDataContext dc;
            var matchedItem = new object();

            try
            {
                dc = new DataClasses.GrucoxDataClassesRemoteDBDataContext();

                matchedItem = (from sessions in dc.GetTable<DataClasses.GrucoxFTPTestSession>()            //**************************************
                               where sessions.ItemID == FTPtest.ItemID                                                  //******Check if customer already exists
                               select sessions).SingleOrDefault();                                              //**************************************
            }
            catch (Exception)
            {
                return false;
            }

            if (matchedItem == null)                                                //If customer does not exist
            {
                try
                {
                    dc.GrucoxFTPTestSessions.InsertOnSubmit(FTPtest);
                    dc.GrucoxFTPTestSessions.Context.SubmitChanges();                      //Add the new customer to the Customers Table
                    return true;
                }
                catch (Exception ex)
                {
                    return false;
                }
            }
            else                                                                    //Customer already exists
            {
                try
                {
                    dc.SubmitChanges();
                    return true;
                }
                catch (Exception ex)
                {
                    return false;
                }
            }
        }
Пример #36
0
 public RegistrationController()
 {
     objData = new DataClasses();
 }
 private static bool StoreWeight_LocalDB(DataClasses.UserProfile User, int UserID, double Weight)
 {
     GlobalVariables.LoggedInUser.Weight = Convert.ToInt32(Weight);
     return RegisterNewUser(GlobalVariables.LoggedInUser);
 }
        public static bool StoreDataVO2Max_LocalDB(DataClasses.VO2MaxProgram1 vO2MaxProgram1, int UserID)
        {
            DataClasses.GrucoxDataClassDataContext dc = new DataClasses.GrucoxDataClassDataContext();

            var matchedItem = (from sessions in dc.GetTable<DataClasses.VO2MaxProgram1>()           //**************************************
                               where sessions.id == vO2MaxProgram1.id                               //******Check if customer already exists
                               select sessions).SingleOrDefault();                                 //**************************************

            if (matchedItem == null)                                                //If customer does not exist
            {
                try
                {
                    dc.VO2MaxProgram1s.InsertOnSubmit(vO2MaxProgram1);
                    dc.VO2MaxProgram1s.Context.SubmitChanges();                      //Add the new customer to the Customers Table
                    return true;
                }
                catch (Exception ex)
                {
                    return false;
                }
            }
            else                                                                    //Customer already exists
            {
                try
                {
                    dc.SubmitChanges();
                    return true;
                }
                catch (Exception ex)
                {
                    return false;
                }

            }
        }
Пример #39
0
 public HomeController()
 {
     objData = new DataClasses();
 }
 //Show Form PassCodeCheck
 private void ShowFormPassCodeCheck(string lblDialogText, DataClasses.UserProfile user)
 {
     ((frmPassCodeCheck)Application.OpenForms["frmPassCodeCheck"]).ReasonForCall = 2;
     ((frmPassCodeCheck)Application.OpenForms["frmPassCodeCheck"]).SelectedUser = user;
     ((frmPassCodeCheck)Application.OpenForms["frmPassCodeCheck"]).lblDialogText.Text = lblDialogText;
     Application.OpenForms["frmPassCodeCheck"].WindowState = FormWindowState.Normal;
     Application.OpenForms["frmPassCodeCheck"].Focus();
     tbUserEmailAddress.Text = "";
 }
Пример #41
0
        public ActionResult ImportantDocuments()
        {
            var files = DataClasses.GetFiles();

            return(PartialView(files));
        }