Inheritance: MonoBehaviour
Esempio n. 1
0
        public static void SessionStartActivity(string comment, string sessionId, string ipAddress, string referrer, bool isBot)
        {
            SiteActivity log = new SiteActivity();
            //bool isBot = false;
            string server = UtilityManager.GetAppKeyValue("serverName", "");

            try
            {
                if (comment == null)
                {
                    comment = "";
                }

                log.CreatedDate  = System.DateTime.Now;
                log.ActivityType = "Audit";
                log.Activity     = "Session";
                log.Event        = "Start";
                log.Comment      = comment + string.Format(" (on server: {0})", server);
                //already have agent
                //log.Comment += GetUserAgent(ref isBot);

                log.SessionId = sessionId;
                log.IPAddress = ipAddress;
                log.Referrer  = referrer;

                new ActivityManager().SiteActivityAdd(log);
            }
            catch (Exception ex)
            {
                LoggingHelper.LogError(ex, thisClassName + ".SessionStartActivity()");
                return;
            }
        }
        public bool DeleteNews(long id)
        {
            bool isDelete = true;

            using (SqlConnection connection = new SqlConnection(CommonUtility.ConnectionString))
            {
                SqlCommand command = new SqlCommand(StoreProcedure.DeleteNews, connection);
                command.CommandType = CommandType.StoredProcedure;
                command.Parameters.Add(new SqlParameter("@Id", id));

                try
                {
                    connection.Open();
                    command.ExecuteNonQuery();
                }
                catch (Exception e)
                {
                    isDelete = false;
                    UtilityManager.WriteLogError(e.ToString());
                }
                finally
                {
                    connection.Close();
                }
            }
            return(isDelete);
        }
        public BookingConfirmed GetPropertyViewByPropertyIdnBookingId(long propertyId, long bookingId)
        {
            using (SqlConnection connection = new SqlConnection(CommonUtility.ConnectionString))
            {
                SqlCommand command = new SqlCommand(StoreProcedure.GET_PROPERTY_BY_PROPERTYID_BOOKINGID, connection);
                command.CommandType = CommandType.StoredProcedure;
                command.Parameters.Add(new SqlParameter("@propertyId", propertyId));
                command.Parameters.Add(new SqlParameter("@bookingId", bookingId));
                try
                {
                    connection.Open();
                    SqlDataReader    dataReader   = command.ExecuteReader();
                    BookingConfirmed propertyList = new BookingConfirmed();
                    propertyList = UtilityManager.DataReaderMap <BookingConfirmed>(dataReader);
                    return(propertyList);
                }
                catch (Exception e)
                {
                    throw new Exception("Exception retrieving reviews. " + e.Message);
                }

                finally
                {
                    connection.Close();
                }
            }
        }
        //public List<PropertySearchResultNew> GetPropertiesBySearch(string fromDate, string toDate, string fromHour, string toHour)
        //{
        //    using (SqlConnection connection = new SqlConnection(CommonUtility.ConnectionString))
        //    {
        //        SqlCommand command = new SqlCommand(StoreProcedure.GET_PROPERTY_BY_SEARCH, connection);
        //        command.CommandType = CommandType.StoredProcedure;
        //        command.Parameters.Add(new SqlParameter("@fromDate", fromDate));
        //        command.Parameters.Add(new SqlParameter("@toDate", toDate));
        //        command.Parameters.Add(new SqlParameter("@fromHour", fromHour));
        //        command.Parameters.Add(new SqlParameter("@toHour", toHour));
        //        try
        //        {
        //            connection.Open();
        //            SqlDataReader dataReader = command.ExecuteReader();
        //            List<PropertySearchResultNew> propertyList = new List<PropertySearchResultNew>();
        //            propertyList = UtilityManager.DataReaderMapToList<PropertySearchResultNew>(dataReader);
        //            return propertyList;
        //        }
        //        catch (Exception e)
        //        {
        //            throw new Exception("Exception retrieving reviews. " + e.Message);
        //        }

        //        finally
        //        {
        //            connection.Close();
        //        }
        //    }
        //}

        public List <PropertySearchResultNew> GetPropertiesBySearch(string searchtext)
        {
            using (SqlConnection connection = new SqlConnection(CommonUtility.ConnectionString))
            {
                SqlCommand command = new SqlCommand(StoreProcedure.GET_PROPERTY_BY_SEARCH, connection);
                command.CommandType = CommandType.StoredProcedure;
                command.Parameters.Add(new SqlParameter("@searchtext", searchtext));
                try
                {
                    connection.Open();
                    SqlDataReader dataReader = command.ExecuteReader();
                    List <PropertySearchResultNew> propertyList = new List <PropertySearchResultNew>();
                    propertyList = UtilityManager.DataReaderMapToList <PropertySearchResultNew>(dataReader);
                    return(propertyList);
                }
                catch (Exception e)
                {
                    throw new Exception("Exception retrieving reviews. " + e.Message);
                }

                finally
                {
                    connection.Close();
                }
            }
        }
        public List <PropertyServiceViewModel> GetServicesByPropertyId(long propertyId)
        {
            using (SqlConnection connection = new SqlConnection(CommonUtility.ConnectionString))
            {
                SqlCommand command = new SqlCommand(StoreProcedure.Get_Services_By_PropertyId, connection);
                command.CommandType = CommandType.StoredProcedure;
                command.Parameters.Add(new SqlParameter("@PropertyId", propertyId));

                try
                {
                    connection.Open();
                    SqlDataReader reader = command.ExecuteReader();
                    List <PropertyServiceViewModel> serviceList = new List <PropertyServiceViewModel>();
                    serviceList = UtilityManager.DataReaderMapToList <PropertyServiceViewModel>(reader);
                    return(serviceList);
                }
                catch (Exception e)
                {
                    throw new Exception("Exception retrieving reviews. " + e.Message);
                }
                finally
                {
                    connection.Close();
                }
            }
        }
        public bool UpdateNews(News news)
        {
            bool isUpdate = true;

            using (SqlConnection connection = new SqlConnection(CommonUtility.ConnectionString))
            {
                SqlCommand command = new SqlCommand(StoreProcedure.UpdateNews, connection);
                command.CommandType = CommandType.StoredProcedure;

                foreach (var newsInfo in news.GetType().GetProperties())
                {
                    string name  = newsInfo.Name;
                    var    value = newsInfo.GetValue(news, null);
                    command.Parameters.Add(new SqlParameter("@" + name, value == null ? DBNull.Value : value));
                }

                try
                {
                    connection.Open();
                    command.ExecuteNonQuery();
                }
                catch (Exception e)
                {
                    isUpdate = false;
                    UtilityManager.WriteLogError(e.ToString());
                }
                finally
                {
                    connection.Close();
                }
            }
            return(isUpdate);
        }
Esempio n. 7
0
        public static int UserRegistrationConfirmation(ThisUser entity, string type)
        {
            string server = UtilityManager.GetAppKeyValue("serverName", "");
            //EFDAL.IsleContentEntities ctx = new EFDAL.IsleContentEntities();
            SiteActivity log = new SiteActivity();

            try
            {
                log.CreatedDate  = System.DateTime.Now;
                log.ActivityType = "Audit";
                log.Activity     = "Account";
                log.Event        = "Confirmation";
                log.Comment      = string.Format("{0} ({1}) Registration Confirmation, on server: {2}, tyep: {3}", entity.FullName(), entity.Id, server, type);
                //actor type - person, system
                log.ActionByUserId = entity.Id;
                log.TargetUserId   = entity.Id;

                log.SessionId = ActivityManager.GetCurrentSessionId();

                return(new ActivityManager().SiteActivityAdd(log));
            }
            catch (Exception ex)
            {
                LoggingHelper.LogError(ex, thisClassName + ".UserRegistrationConfirmation()");
                return(0);
            }
        }
        public List <News> GetNewsBySearchKey(string searchKey)
        {
            using (SqlConnection connection = new SqlConnection(CommonUtility.ConnectionString))
            {
                List <News> newsList = new List <News>();
                SqlCommand  command  = new SqlCommand(StoreProcedure.GetNewsSearchResults, connection);
                command.CommandType = CommandType.StoredProcedure;
                command.Parameters.Add(new SqlParameter("@searchKey", searchKey));
                try
                {
                    connection.Open();
                    SqlDataReader dataReader = command.ExecuteReader();
                    newsList = UtilityManager.DataReaderMapToList <News>(dataReader);
                    return(newsList);
                }
                catch (Exception e)
                {
                    UtilityManager.WriteLogError(e.ToString());
                    return(newsList);
                }

                finally
                {
                    connection.Close();
                }
            }
        }
        public News GetNewsById(long?id)
        {
            using (SqlConnection connection = new SqlConnection(CommonUtility.ConnectionString))
            {
                News       news    = new News();
                SqlCommand command = new SqlCommand(StoreProcedure.GetNewsById, connection);
                command.CommandType = CommandType.StoredProcedure;
                command.Parameters.Add(new SqlParameter("@Id", id));
                try
                {
                    connection.Open();
                    SqlDataReader reader = command.ExecuteReader();

                    news = UtilityManager.DataReaderMap <News>(reader);
                    return(news);
                }
                catch (Exception e)
                {
                    UtilityManager.WriteLogError(e.ToString());
                    return(news);
                }
                finally
                {
                    connection.Close();
                }
            }
        }
Esempio n. 10
0
        public static void OnLoad()
        {
            MenuManager.Execute.Evelynn();

            SpellManager.Q  = new Spell(SpellSlot.Q, 800f);
            SpellManager.Q2 = new Spell(SpellSlot.Q, 550f);
            SpellManager.W  = new Spell(SpellSlot.W, 1200f);
            SpellManager.E  = new Spell(SpellSlot.E, 225f + objPlayer.BoundingRadius);
            SpellManager.R  = new Spell(SpellSlot.R, 450f + objPlayer.BoundingRadius);

            SpellManager.Q.SetSkillshot(0.25f, 60f, 2400f, true, SkillshotType.Line);
            SpellManager.R.SetSkillshot(0.25f, UtilityManager.GetAngleByDegrees(180), float.MaxValue, false, SkillshotType.Cone);

            /* Main */
            Game.OnUpdate += Events.OnUpdate;

            /* OnAction */
            Orbwalker.OnAction += Events.OnAction;

            /* Drawings */
            Drawing.OnDraw     += Events.OnDraw;
            Drawing.OnEndScene += DamageIndicator.OnEndScene;

            /* Gapcloser */
            Gapcloser.OnGapcloser += Events.OnGapcloser;
        }
Esempio n. 11
0
        public static int UserRegistration(ThisUser entity, string ipAddress, string type, string extra = "")
        {
            string server = UtilityManager.GetAppKeyValue("serverName", "");

            SiteActivity log = new SiteActivity();

            log.CreatedDate  = System.DateTime.Now;
            log.ActivityType = "Audit";
            log.Activity     = "Account";
            log.Event        = type;
            log.Comment      = string.Format("{0} ({1}) {4}. From IPAddress: {2}, on server: {3}. {5}", entity.FullName(), entity.Id, ipAddress, server, type, extra);
            //actor type - person, system
            log.ActionByUserId = entity.Id;
            log.TargetUserId   = entity.Id;
            log.SessionId      = ActivityManager.GetCurrentSessionId();
            try
            {
                return(new ActivityManager().SiteActivityAdd(log));
            }
            catch (Exception ex)
            {
                LoggingHelper.LogError(ex, thisClassName + ".UserRegistrationFromPortal()");
                return(0);
            }
        }
        public static List <object> Autocomplete(string keyword = "", int maxTerms = 25, int widgetId = 0)
        {
            int userId = 0;

            string where = "";
            int     totalRows = 0;
            AppUser user      = AccountServices.GetCurrentUser();

            if (user != null && user.Id > 0)
            {
                userId = user.Id;
            }
            //SetAuthorizationFilter( user, ref where );


            if (UtilityManager.GetAppKeyValue("usingElasticOrganizationSearch", false))
            {
                return(ElasticHelper.OrganizationAutoComplete(keyword, maxTerms, ref totalRows));
            }
            else
            {
                SetKeywordFilter(keyword, true, ref where);
                //string keywords = ServiceHelper.HandleApostrophes( keyword );
                //if ( keywords.IndexOf( "%" ) == -1 )
                //	keywords = "%" + keywords.Trim() + "%";
                //where = string.Format( " (base.name like '{0}') ", keywords );

                return(EntityMgr.Autocomplete(where, 1, maxTerms, userId, ref totalRows));
            }
        }
        //TBD


        /// <summary>
        /// The actual validation will be via a call to the accounts api
        /// </summary>
        /// <param name="helper"></param>
        /// <param name="statusMessage"></param>
        /// <returns></returns>
        public static bool ValidateRequest(RequestHelper helper, ref string statusMessage, bool isDeleteRequest = false)
        {
            bool   isValid          = true;
            string clientIdentifier = "";
            bool   isTokenRequired  = UtilityManager.GetAppKeyValue("requiringHeaderToken", true);

            if (isDeleteRequest)
            {
                isTokenRequired = true;
            }

            //api key will be passed in the header
            string apiToken = "";

            if (IsAuthTokenValid(isTokenRequired, ref apiToken, ref clientIdentifier, ref statusMessage) == false)
            {
                return(false);
            }
            helper.ApiKey           = apiToken;
            helper.ClientIdentifier = clientIdentifier ?? "";

            if (isTokenRequired &&
                (string.IsNullOrWhiteSpace(helper.OwnerCtid) ||
                 !helper.OwnerCtid.ToLower().StartsWith("ce-") ||
                 helper.OwnerCtid.Length != 39)
                )
            {
                if (clientIdentifier.ToLower().StartsWith("cerpublisher") == false)
                {
                    statusMessage = "Error - a valid CTID for the related organization must be provided.";
                    return(false);
                }
            }
            return(isValid);
        }
Esempio n. 14
0
        public static string UserName(this string Email)
        {
            IUtility             _utility = new UtilityManager();
            ApplicationDbContext Data     = new ApplicationDbContext();



            try
            {
                if (!_utility.CheckEmailAddressFormat(Email))
                {
                    var user  = Data.Users.FirstOrDefault(x => x.Id == Email);
                    var user2 = Data.UserInfo.FirstOrDefault(x => x.Email == user.Email);
                    return(user2.Name);
                }
                else
                {
                    var user = Data.UserInfo.FirstOrDefault(x => x.Email == Email);
                    return(user.Name);
                }
            }

            catch
            {
                return(Email);
            }
        }
Esempio n. 15
0
        public static void OnLoad()
        {
            Q = new Spell(SpellSlot.Q, 800f);
            Q.SetSkillshot(0.25f, 60f, 2400f, false, SkillshotType.Line);

            Q2 = new Spell(SpellSlot.Q, 550f);
            W  = new Spell(SpellSlot.W, 1200f);
            E  = new Spell(SpellSlot.E, 225f + objPlayer.BoundingRadius);

            R = new Spell(SpellSlot.R, 450f + objPlayer.BoundingRadius);
            R.SetSkillshot(0.25f, UtilityManager.ConvertToDegrees(100), float.MaxValue, false, SkillshotType.Cone);

            /* Main */
            Tick.OnTick += Events.OnTick;

            /* Drawings */
            Drawing.OnDraw     += Drawings.OnDraw;
            Drawing.OnEndScene += DamageIndicatorManager.OnEndScene;

            /* Orbwalker */
            Orbwalker.OnAction += Events.OnAction;

            /* Gapcloser */
            Gapcloser.OnGapcloser += Events.OnGapcloser;
        }
Esempio n. 16
0
    private void SetupWorld(int width, int height)
    {
        // Set the current world to be this world.
        // TODO: Do we need to do any cleanup of the old world?
        Current = this;


        RoomManager           = new RoomManager();
        RoomManager.Adding   += (room) => roomGraph = null;
        RoomManager.Removing += (room) => roomGraph = null;

        FillTilesArray();

        FurnitureManager          = new FurnitureManager();
        FurnitureManager.Created += OnFurnitureCreated;

        UtilityManager   = new UtilityManager();
        CharacterManager = new CharacterManager();
        InventoryManager = new InventoryManager();
        jobQueue         = new JobQueue();
        GameEventManager = new GameEventManager();
        PowerNetwork     = new PowerNetwork();
        FluidNetwork     = new FluidNetwork();
        temperature      = new TemperatureDiffusion(this);
        Wallet           = new Wallet();
        CameraData       = new CameraData();

        LoadSkybox();
        AddEventListeners();

        holder.Start();
        biomes.RandomBiome();
        mapData.SetupWorld(width, height, biome.maxHeight);
    }
        public ImageGallery GetImageGalleryById(long id)
        {
            ImageGallery list = new ImageGallery();

            using (SqlConnection connection = new SqlConnection(CommonUtility.ConnectionString))
            {
                SqlCommand command = new SqlCommand(StoreProcedure.GetImageGalleryById, connection);
                command.CommandType = CommandType.StoredProcedure;
                command.Parameters.Add(new SqlParameter("@Id", id));

                try
                {
                    connection.Open();
                    SqlDataReader reader = command.ExecuteReader();
                    list = UtilityManager.DataReaderMap <ImageGallery>(reader);
                    return(list);
                }
                catch (Exception e)
                {
                    UtilityManager.WriteLogError(e.ToString());
                    return(list);
                }
                finally
                {
                    connection.Close();
                }
            }
        }
        public Models.User GetUserByUserNameNPassword(string username, string password)
        {
            using (SqlConnection connection = new SqlConnection(CommonUtility.ConnectionString))
            {
                SqlCommand command = new SqlCommand(StoreProcedure.GetUserByUsernamePassword, connection);
                command.CommandType = CommandType.StoredProcedure;
                command.Parameters.Add(new SqlParameter("@Username", username));
                command.Parameters.Add(new SqlParameter("@Password", password));

                try
                {
                    connection.Open();
                    SqlDataReader reader = command.ExecuteReader();
                    Models.User   user   = new Models.User();
                    user = UtilityManager.DataReaderMap <Models.User>(reader);
                    return(user);
                }
                catch (Exception e)
                {
                    throw new Exception("Exception retrieving reviews. " + e.Message);
                }
                finally
                {
                    connection.Close();
                }
            }
        }
Esempio n. 19
0
    private void SetupWorld(int width, int height, int depth)
    {
        // Set the current world to be this world.
        // TODO: Do we need to do any cleanup of the old world?
        Current = this;

        Width  = width;
        Height = height;
        Depth  = depth;

        tiles = new Tile[Width, Height, Depth];

        RoomManager           = new RoomManager();
        RoomManager.Adding   += (room) => roomGraph = null;
        RoomManager.Removing += (room) => roomGraph = null;

        FillTilesArray();

        FurnitureManager          = new FurnitureManager();
        FurnitureManager.Created += OnFurnitureCreated;

        UtilityManager   = new UtilityManager();
        CharacterManager = new CharacterManager();
        InventoryManager = new InventoryManager();
        jobQueue         = new JobQueue();
        GameEventManager = new GameEventManager();
        PowerNetwork     = new PowerNetwork();
        temperature      = new Temperature();
        ShipManager      = new ShipManager();
        Wallet           = new Wallet();
        CameraData       = new CameraData();

        LoadSkybox();
        AddEventListeners();
    }
        public List <News> GetAllNews()
        {
            using (SqlConnection connection = new SqlConnection(CommonUtility.ConnectionString))
            {
                List <News> newsList = new List <News>();
                SqlCommand  command  = new SqlCommand(StoreProcedure.GetAllNews, connection);
                command.CommandType = CommandType.StoredProcedure;

                try
                {
                    connection.Open();
                    SqlDataReader dataReader = command.ExecuteReader();
                    newsList = UtilityManager.DataReaderMapToList <News>(dataReader);
                    return(newsList);
                }
                catch (Exception e)
                {
                    UtilityManager.WriteLogError(e.ToString());
                    return(newsList);
                }

                finally
                {
                    connection.Close();
                }
            }
        }
        public List <ClientsBookingHistory> GetClientBookingHistory(long clientId)
        {
            using (SqlConnection connection = new SqlConnection(CommonUtility.ConnectionString))
            {
                SqlCommand command = new SqlCommand(StoreProcedure.GETCLIENTSBOOKINGHISTORY, connection);
                command.CommandType = CommandType.StoredProcedure;
                command.Parameters.Add(new SqlParameter("@ClientId", +clientId));

                try
                {
                    connection.Open();
                    SqlDataReader reader = command.ExecuteReader();
                    List <ClientsBookingHistory> bookingList = new List <ClientsBookingHistory>();
                    bookingList = UtilityManager.DataReaderMapToList <ClientsBookingHistory>(reader);
                    return(bookingList);
                }
                catch (Exception e)
                {
                    throw new Exception("Exception retrieving reviews." + e.Message);
                }
                finally
                {
                    connection.Close();
                }
            }
        }
Esempio n. 22
0
 public static List <CommonSearchSummary> Search(MainSearchInput data, ref int pTotalRows)
 {
     if (UtilityManager.GetAppKeyValue("usingElasticTransferValueSearch", false))
     {
         //var results = ElasticHelper.GeneralSearch( CodesManager.ENTITY_TYPE_TRANSFER_VALUE_PROFILE, data, ref pTotalRows );
         return(ElasticHelper.GeneralSearch(CodesManager.ENTITY_TYPE_TRANSFER_VALUE_PROFILE, "TransferValue", data, ref pTotalRows));
     }
     else
     {
         List <CommonSearchSummary> results = new List <CommonSearchSummary>();
         var list = DoSearch(data, ref pTotalRows);
         foreach (var item in list)
         {
             results.Add(new CommonSearchSummary()
             {
                 Id                      = item.Id,
                 Name                    = item.Name,
                 Description             = item.Description,
                 SubjectWebpage          = item.SubjectWebpage,
                 PrimaryOrganizationName = item.PrimaryOrganizationName,
                 CTID                    = item.CTID,
                 EntityTypeId            = CodesManager.ENTITY_TYPE_TRANSFER_VALUE_PROFILE,
                 EntityType              = "TransferValueProfile"
             });
         }
         return(results);
     }
 }        //
        public List <AdminBookingList> GetAdminBookingList()
        {
            using (SqlConnection connection = new SqlConnection(CommonUtility.ConnectionString))
            {
                SqlCommand command = new SqlCommand(StoreProcedure.Get_Admin_BookingList, connection);
                command.CommandType = CommandType.StoredProcedure;

                try
                {
                    connection.Open();
                    SqlDataReader           dataReader  = command.ExecuteReader();
                    List <AdminBookingList> bookingList = new List <AdminBookingList>();
                    bookingList = UtilityManager.DataReaderMapToList <AdminBookingList>(dataReader);
                    return(bookingList);
                }
                catch (Exception e)
                {
                    throw new Exception("Exception retrieving reviews. " + e.Message);
                }

                finally
                {
                    connection.Close();
                }
            }
        }
        public Models.Booking.Booking GetBookingById(long bookingId)
        {
            using (SqlConnection connection = new SqlConnection(CommonUtility.ConnectionString))
            {
                SqlCommand command = new SqlCommand(StoreProcedure.GETBOOKINGSBYID, connection);
                command.CommandType = CommandType.StoredProcedure;
                command.Parameters.Add(new SqlParameter("@BookingId", bookingId));

                try
                {
                    connection.Open();
                    SqlDataReader          reader  = command.ExecuteReader();
                    Models.Booking.Booking booking = new Models.Booking.Booking();
                    booking = UtilityManager.DataReaderMap <Models.Booking.Booking>(reader);
                    return(booking);
                }
                catch (Exception e)
                {
                    throw new Exception("Exception retrieving reviews. " + e.Message);
                }
                finally
                {
                    connection.Close();
                }
            }
        }
        public Product GetGalleryItemById(long Id)
        {
            using (SqlConnection connection = new SqlConnection(CommonUtility.ConnectionString))
            {
                SqlCommand command = new SqlCommand(StoreProcedure.GetProductGalleryById, connection);
                command.CommandType = CommandType.StoredProcedure;
                command.Parameters.Add(new SqlParameter("@Id", Id));

                try
                {
                    connection.Open();
                    SqlDataReader reader  = command.ExecuteReader();
                    Product       Product = new Product();
                    Product = UtilityManager.DataReaderMap <Product>(reader);
                    return(Product);
                }
                catch (Exception e)
                {
                    throw new Exception("Exception retrieving reviews. " + e.Message);
                }
                finally
                {
                    connection.Close();
                }
            }
        }
        public List <Product> GetAllProductsBySubCategoryId(long categoryId)
        {
            using (SqlConnection connection = new SqlConnection(CommonUtility.ConnectionString))
            {
                SqlCommand command = new SqlCommand(StoreProcedure.GetAllProductsBySubCategoryId, connection);
                command.CommandType = CommandType.StoredProcedure;
                command.Parameters.Add(new SqlParameter("@SubCategoryId", categoryId));
                try
                {
                    connection.Open();
                    SqlDataReader  dataReader  = command.ExecuteReader();
                    List <Product> ProductList = new List <Product>();
                    ProductList = UtilityManager.DataReaderMapToList <Product>(dataReader);
                    return(ProductList);
                }
                catch (Exception e)
                {
                    throw new Exception("Exception retrieving reviews. " + e.Message);
                }

                finally
                {
                    connection.Close();
                }
            }
        }
Esempio n. 27
0
        /// <summary>
        /// Initialize any components required by this state.
        /// </summary>
        public override void Initialize()
        {
            ServiceManager.Game.FormManager.ClearWindow();
            Options options = ServiceManager.Game.Options;

            RendererAssetPool.DrawShadows = GraphicOptions.ShadowMaps;
            mouseCursor = new MouseCursor(options.KeySettings.Pointer);
            mouseCursor.EnableCustomCursor();
            renderer    = ServiceManager.Game.Renderer;
            fps         = new FrameCounter();
            Chat        = new ChatArea();
            Projectiles = new ProjectileManager();
            Tiles       = new TexturedTileGroupManager();
            Utilities   = new UtilityManager();
            cd          = new Countdown();
            Lazers      = new LazerBeamManager(this);
            Scene.Add(Lazers, 0);
            Players            = new PlayerManager();
            currentGameMode    = ServiceManager.Theater.GetCurrentGameMode();
            Flags              = new FlagManager();
            Bases              = new BaseManager();
            EnvironmentEffects = new EnvironmentEffectManager();
            buffbar            = new BuffBar();
            Scores             = new ScoreBoard(currentGameMode, Players);
            input              = new ChatInput(new Vector2(5, ServiceManager.Game.GraphicsDevice.Viewport.Height), 300);//300 is a magic number...Create a chat width variable.
            input.Visible      = false;
            hud              = HUD.GetHudForPlayer(Players.GetLocalPlayer());
            localPlayer      = Players.GetLocalPlayer();
            Scene.MainEntity = localPlayer;
            sky              = ServiceManager.Resources.GetTexture2D("textures\\misc\\background\\sky");
            tips             = new GameTips(new GameContext(CurrentGameMode, localPlayer));
            helpOverlay      = new HelpOverlay();
        }
Esempio n. 28
0
        public Feedback GetFeedbackById(long Id)
        {
            using (SqlConnection connection = new SqlConnection(CommonUtility.ConnectionString))
            {
                SqlCommand command = new SqlCommand(StoreProcedure.GetFeedbackById, connection);
                command.CommandType = CommandType.StoredProcedure;
                command.Parameters.Add(new SqlParameter("@Id", Id));

                try
                {
                    connection.Open();
                    SqlDataReader reader   = command.ExecuteReader();
                    Feedback      feedback = new Feedback();
                    feedback = UtilityManager.DataReaderMap <Feedback>(reader);
                    return(feedback);
                }
                catch (Exception e)
                {
                    throw new Exception("Exception retrieving reviews. " + e.Message);
                }
                finally
                {
                    connection.Close();
                }
            }
        }
Esempio n. 29
0
    public void ReadJson(JObject worldJson)
    {
        if (worldJson["Seed"] != null)
        {
            Seed = (int)worldJson["Seed"];
        }

        RandomStateFromJson(worldJson["RandomState"]);

        SetupWorld((int)worldJson["Width"], (int)worldJson["Height"], (int)worldJson["Depth"]);

        RoomManager.FromJson(worldJson["Rooms"]);
        TilesFromJson(worldJson["Tiles"]);
        InventoryManager.FromJson(worldJson["Inventories"]);
        FurnitureManager.FromJson(worldJson["Furnitures"]);
        UtilityManager.FromJson(worldJson["Utilities"]);
        RoomManager.BehaviorsFromJson(worldJson["RoomBehaviors"]);
        CharacterManager.FromJson(worldJson["Characters"]);
        CameraData.FromJson(worldJson["CameraData"]);
        LoadSkybox((string)worldJson["Skybox"]);
        Wallet.FromJson(worldJson["Wallet"]);
        TimeManager.Instance.FromJson(worldJson["Time"]);
        Scheduler.Scheduler.Current.FromJson(worldJson["Scheduler"]);

        tileGraph = new Path_TileGraph(this);
    }
Esempio n. 30
0
        public object GetTaskHistory(int taskId)
        {
            var result = (from a in _taskRepository.GetAll()
                          join b in _taskHistoryRepository.GetAll() on a.Id equals b.TaskId
                          join c in _lookupListRepository.GetAll() on b.TaskStatusId equals c.Id
                          join d in _personRepository.GetAll() on b.Assigned equals d.Id into ds
                          from d in ds.DefaultIfEmpty()
                          join e in _personRepository.GetAll() on b.CreatedBy equals e.Id
                          where a.Id == taskId
                          orderby b.CreatedDate descending
                          select new
            {
                Assigned = d == null ? "Atanacak Biri" : d.Name + " " + d.Surname,
                CreatedBy = e.Name + " " + e.Surname,
                CreatedDate = b.CreatedDate,
                TaskStatusName = c.Name
            }).ToList().Select(p => new
            {
                p.Assigned,
                p.CreatedBy,
                CreatedDate = UtilityManager.GetNameableDate(p.CreatedDate),
                p.TaskStatusName
            }).ToList();

            return(result);
        }
		public async override void ViewDidLoad ()
		{
			base.ViewDidLoad ();
			this.Title = "Select Beacon";
			beaconManager = new BeaconManager ();
			utilityManager = new UtilityManager ();

		}
		public override void ViewDidLoad ()
		{
			base.ViewDidLoad ();

			//set up sqlite db
			var documents = Environment.GetFolderPath (Environment.SpecialFolder.Personal);
			_pathToDatabase = Path.Combine (documents, "db_sqlite-net.db");

			TryToConnectToBridge ();

			utilityManager = new UtilityManager ();
			beaconManager = new BeaconManager ();

			locationManager = new CLLocationManager ();
			locationManager.RequestWhenInUseAuthorization ();

			beaconManager.AuthorizationStatusChanged += (sender, e) => {
				beaconManager.StartMonitoringForRegion (region);
			};

			beaconManager.ExitedRegion += (sender, e) => {
				proximityValueLabel.Text = "You have EXITED the PooBerry region";
			};

			locationManager.DidDetermineState += (object sender, CLRegionStateDeterminedEventArgs e) => {
				switch (e.State) {
				case CLRegionState.Inside:
					OnAdd ();
					Console.WriteLine ("region state inside");
					break;
				case CLRegionState.Outside:
					Console.WriteLine ("region state outside");
					StartMonitoringBeacons ();
					break;
				case CLRegionState.Unknown:
				default:
					Console.WriteLine ("region state unknown");
					StartMonitoringBeacons ();
					break;
				}
			};

			locationManager.RegionEntered += (object sender, CLRegionEventArgs e) => {
				Console.WriteLine ("beacon region entered");
			};

			#region Hue UI
			connectBridge.TouchUpInside += ConnectBridgeClicked;
			onButton.TouchUpInside += OnButton_TouchUpInside;
			offButton.TouchUpInside += OffButton_TouchUpInside;
			#endregion Hue UI
		}
		public override void ViewDidLoad ()
		{
			base.ViewDidLoad ();
			this.Title = "Select Beacon";
			
            utilityManager = new UtilityManager ();
            beaconManager = new BeaconManager ();
			beaconManager.ReturnAllRangedBeaconsAtOnce = true;
            region = new CLBeaconRegion (AppDelegate.BeaconUUID, "BeaconSample");

            beaconManager.AuthorizationStatusChanged += (sender, e) => 
                StartRangingBeacons ();
            beaconManager.RangedBeacons += (sender, e) => 
            {
                beacons = e.Beacons;
                TableView.ReloadData();
            };
		}
Esempio n. 34
0
        protected override void Initialize()
        {
            theFileManager = FileManager.Get(this);
            theInputManager = InputManager.Get(this);
            theUtilityManager = UtilityManager.Get(this);
            theTileManager = TileManager.Get(this);
            theButtonManager = ButtonManager.Get(this);
            thePlayerManager = PlayerManager.Get(this);
            theScreenManager = ScreenManager.Get(this);
            theCameraManager = CameraManager.Get(this);
            theEnemyManager = EnemyManager.Get(this);
            theProjectileManager = ProjectileManager.Get(this);
            theCollisionManager = CollisionManager.Get(this);

            theScreenManager.WorldScreen = new MainMenu();

            Player.CreatePlayer("test", new Vector2(mScreenDimensions.X / 2.0f, mScreenDimensions.Y / 2.0f), Vector2.Zero);

            TileButton.Create(new FloorCopper(), Keys.E);
            TileButton.Create(new FloorMetal(), Keys.R);
            TileButton.Create(new HardWallCopper(), Keys.T);
            TileButton.Create(new HardWallMetal(), Keys.Y);
            TileButton.Create(new WallMetal(), Keys.Q);
            TileButton.Create(new CopperWall(), Keys.W);

            EnemyButton.Create(new EnemyTurret(), Keys.F);
             //   EnemyButton.Create("Turret_Gun", Keys.F);

            theTileManager.Load("Level_1.xml");

            base.Initialize();
        }
Esempio n. 35
0
        /// <summary>
        /// Ensures all references are released.
        /// </summary>
        public void Dispose()
        {
            players = null;
            flags = null;
            bases = null;
            utilities = null;
            localPlayer = null;
            renderTarget = null;
            texture = null;
            mapObjectTexture = null;

            IsDisposed = true;
        }
Esempio n. 36
0
        public void SetMap(Map map, GamePlayState _state)
        {
            currentGameMode = _state.CurrentGameMode;
            flags = _state.Flags;
            utilities = _state.Utilities;
            bases = _state.Bases;
            try
            {
                GraphicsDevice device = Renderer.GraphicOptions.graphics.GraphicsDevice;
                PresentationParameters pp = device.PresentationParameters;
                renderTarget = new RenderTarget2D(device, (int)map.Width * miniMapScaleFactor + 2 * miniMapBorderBuffer,
                             (int)map.Height * miniMapScaleFactor + 2 * miniMapBorderBuffer, 1, SurfaceFormat.Color,
                             pp.MultiSampleType,
                             pp.MultiSampleQuality, RenderTargetUsage.PreserveContents);

                DepthStencilBuffer previousDepth = device.DepthStencilBuffer;
                device.DepthStencilBuffer = null;
                device.SetRenderTarget(0, renderTarget);
                device.Clear(Color.Black);
                ServiceManager.Game.Batch.Begin(SpriteBlendMode.AlphaBlend, SpriteSortMode.Immediate, SaveStateMode.None);
                Texture2D miniMapDrawer = ServiceManager.Resources.GetTexture2D("textures\\misc\\MiniMap\\wallandbackground");

                for (uint x = 0; x < map.Width; x++)
                {
                    for (uint y = 0; y < map.Height; y++)
                    {
                        Tile tmpTile = map.GetTile(x, y);

                        if (!tmpTile.IsPassable)
                            ServiceManager.Game.Batch.Draw(miniMapDrawer,
                                new Vector2(x * miniMapScaleFactor + miniMapBorderBuffer, y * miniMapScaleFactor + miniMapBorderBuffer),
                                new Rectangle(0, 0, miniMapScaleFactor, miniMapScaleFactor), Color.White);
                    }
                }

                ServiceManager.Game.Batch.End();
                device.DepthStencilBuffer = previousDepth;
                device.SetRenderTarget(0, null);
                texture = renderTarget.GetTexture();

                renderTarget = new RenderTarget2D(device, 235, 235,
                     1, SurfaceFormat.Color,
                     pp.MultiSampleType,
                     pp.MultiSampleQuality, RenderTargetUsage.PreserveContents);
            }
            catch (Exception ex)
            {
                Console.Error.WriteLine(ex);
            }
        }