Example #1
0
        private string MappingMethod(Mapper mapper)
        {
            var builder = new StringBuilder();

            builder.AppendLineWithTabs($"public {EntityHandler.Entity.Name} MapToObject({EntityHandler.GetEntityLocationOnId(mapper.FromTo.To).FileLocation.GetProjectLocation}.{EntityHandler.Entity.Name} objectToMapFrom)", 0);
            builder.AppendLineWithTabs("{", 1);
            builder.AppendLineWithTabs($"var objectToMapTo = new {EntityHandler.Entity.Name}", 2);
            builder.AppendLineWithTabs("{", 2);
            foreach (var property in EntityHandler.GetClassBuilder(mapper.FromTo.To).GetNonChildCollectionProperties)
            {
                builder.AppendLineWithTabs($"{GetMappingProperty(property)},", 3);
            }
            builder.AppendLineWithTabs("};", 2);
            builder.Append(Environment.NewLine);
            foreach (var childcollectionProp in EntityHandler.GetClassBuilder(mapper.FromTo.To).GetChildCollectionProperties)
            {
                builder.AppendLineWithTabs($"foreach(var property in objectToMapFrom.{childcollectionProp.Property.Name})", 2);
                builder.AppendLineWithTabs("{", 2);
                builder.AppendLineWithTabs($"objectToMapTo.{GetMappingProperty(childcollectionProp)}", 3);
                builder.AppendLineWithTabs("}", 2);
                builder.Append(Environment.NewLine);
            }
            builder.AppendLineWithTabs("return objectToMapTo;", 2);
            builder.AppendLineWithTabs("}", 1);
            return(builder.ToString());
        }
Example #2
0
        /// <summary>
        /// Returns the list of tables in the database
        /// </summary>
        /// <returns>The list of tables</returns>
        public virtual IList <Entity> GetTables()
        {
            LoggerHelper.Info("Start");
            IList <Entity> list = null;

            try
            {
                StringBuilder query = new StringBuilder();
                query.Append("SELECT CASE WHEN SCHEMA_NAME(schema_id) = 'dbo' THEN name ELSE  SCHEMA_NAME(schema_id) + '.' + name END AS [Name] ");
                query.Append("FROM sys.tables WHERE name <> 'sysdiagrams' ");
                query.Append("UNION ");
                query.Append("SELECT CASE WHEN SCHEMA_NAME(schema_id) = 'dbo' THEN name ELSE  SCHEMA_NAME(schema_id) + '.' + name END AS [Name] ");
                query.Append("FROM sys.views ");
                query.Append("ORDER BY 1");
                LoggerHelper.Debug(query.ToString());

                Entity entity = new Entity("Tables");
                entity.SetField(new Field("Name"));

                ResultSetHandler <IList <Entity> > h = new EntityHandler <Entity>(entity);
                list = GetQueryRunner().Query(GetConnection(), query, h);
            }
            catch (Exception e)
            {
                LoggerHelper.Error(e);
                throw new Exception("Unable to get tables/views.", e);
            }
            finally
            {
                LoggerHelper.Info("End");
            }

            return(list);
        }
        public void Test()
        {
            World         world   = new World();
            EntityHandler entityA = world.CreateEntity();

            entityA.AddComponent(new TestComponent());

            EntityHandler entityB = world.CreateEntity();

            entityB.AddComponent(new TestComponent());

            GameSystem system = new TestSystem(world);

            Assert.IsTrue(entityA.GetComponent <TestComponent>().foo == 0, "component default value is wrong");

            system.Update();
            Assert.IsTrue(entityA.GetComponent <TestComponent>().foo == 1, "component A did not update correctly after system update");
            Assert.IsTrue(entityB.GetComponent <TestComponent>().foo == 1, "component B did not update correctly after system update");

            system.Update();
            Assert.IsTrue(entityA.GetComponent <TestComponent>().foo == 2, "component A did not update correctly after system update");
            Assert.IsTrue(entityB.GetComponent <TestComponent>().foo == 2, "component B did not update correctly after system update");

            world.RemoveEntity(entityA.entity);
            Assert.IsTrue(
                !world.GetComponentManager <TestComponent>().EntityHasComponent(entityA.entity),
                "entity A was not removed");

            system.Update();
            Assert.IsTrue(entityB.GetComponent <TestComponent>().foo == 3, "component B did not update correctly after system update");
        }
Example #4
0
        /// <summary>
        /// Find all entities that meet the specified entity type and properties
        /// and applying the specified filter and search type from an SQL database.
        /// </summary>
        /// <param name="entity">The entity type</param>
        /// <param name="filter">The filter</param>
        /// <param name="searchType">The search type</param>
        /// <returns>The filtered list of entities</returns>
        public virtual IList <Entity> FindEntities(Entity entity, FilterInfo filter, FilterInfo.SearchType searchType)
        {
            LoggerHelper.Info("Start");
            IList <Entity> list = new List <Entity>();

            try
            {
                StatementWrapper stmtWrapper = GetQueryBuilder().BuildFindEntitiesStatement(entity, filter, searchType);
                LoggerHelper.Debug(stmtWrapper.Query.ToString());

                ResultSetHandler <IList <Entity> > h = new EntityHandler <Entity>(entity);
                list = GetQueryRunner().Query(GetConnection(), stmtWrapper, h);
            }
            catch (Exception e)
            {
                LoggerHelper.Error(e);
                throw new Exception("Unable to fetch " + entity.GetTableName() + " list.", e);
            }
            finally
            {
                LoggerHelper.Info("End");
            }

            return(list);
        }
Example #5
0
        public string Save(EntityHandler.Acknoladgement _SaveData){

            MySql.Data.MySqlClient.MySqlTransaction Mytrans;
            MySqlConnection CurCon = new MySqlConnection();
            CurCon = Mycommon.AccountConnection;
            string respond = "";

            if (CurCon.State == ConnectionState.Closed)
            {
                CurCon.Open();
            }

            Mytrans = Mycommon.AccountConnection.BeginTransaction();
            MySqlCommand oSqlCommand = new MySqlCommand();

            respond = SaveAcknoledgement(_SaveData, CurCon);
            if (respond != "True")
            {
                Mytrans.Rollback();
                return respond;
            }
            else
            {
                Mytrans.Commit();
                CurCon.Close();
                return "True";
            }

            return respond;

            }
Example #6
0
 private void Start()
 {
     pCam = this.GetComponentInChildren <Camera>();
     pCam.transform.rotation = new Quaternion(0, 0, 0, 0);
     verticalRotation        = transform.localEulerAngles.x;
     horizontalRotation      = EntityHandler.GetEntity <Character>(EntityGroup.PLAYER, Client.instance.myId).transform.eulerAngles.y;
 }
Example #7
0
        public IList <Entity> GetLatestOrderByClient(Entity entity)
        {
            LoggerHelper.Info("Start");

            IList <Entity> list = new List <Entity>();

            try
            {
                StringBuilder   query       = new StringBuilder();
                IList <DBParam> queryParams = new List <DBParam>();

                query.Append("SELECT TOP 1 ITE_Nombre,Interna,Entrega,OrdenCompra,Requisicion,Terminal ");
                query.Append("FROM tblOrdenes WHERE ClientId = @p0 ORDER BY ITE_Nombre DESC");
                LoggerHelper.Debug(query.ToString());
                queryParams.Add(new DBParam(queryParams, entity.GetProperty("ClientId"), DbType.String, false));

                ResultSetHandler <IList <Entity> > h = new EntityHandler <Entity>(entity);
                list = GetQueryRunner().Query(GetConnection(), new StatementWrapper(query, queryParams), h);
            }
            catch (Exception e)
            {
                LoggerHelper.Error(e);
                throw new Exception("Unable to Get Latest Order By Client.", e);
            }
            finally
            {
                LoggerHelper.Info("End");
            }

            return(list);
        }
Example #8
0
        /// <summary>
        /// Boots up the server
        /// </summary>
        public static void Start()
        {
            Config.Load();

            Listener = new TcpIPListener(Config.Port);
            Listener.OnSocketConnect += ProcessConnection;
            Listener.Start();

            GenerateSalt();

            Scheduler = new Scheduler("Main.Scheduler");
            Scheduler.Start();

            Players = new List <Player>();
            Levels  = new List <Level>();

            Group.Initialise();
            Command.Initialise();
            Seed.Initialise();
            EntityHandler.Initialise();

            PlayerDB = new SqlDatabase("PlayerDB");

            MainLevel = NbtLoader.Load(Config.MainLevel) ?? new Level("main", 64, 64, 64);
            Levels.Add(MainLevel);

            Heartbeat.Beat();
        }
    public void Awake()
    {
        this.treeviewHandlerScript = this.GetComponent <TreeviewHandler>() as TreeviewHandler;
        this.entityHandlerScript   = this.GetComponent <EntityHandler>() as EntityHandler;

        ReadFilesFromIniFile();
    }
    public static Action <Entity> EntityAction(int actionID)
    {
        switch (actionID)
        {
        case 0:
            return(new Action <Entity>((target) =>
            {
                if (Vector3.Distance(EntityHandler.GetEntity <NPC>(0).transform.position, target.transform.position) <= 3f)
                {
                    ActionPacket packet = (ActionPacket)actionHandler.GetComponent(typeof(OpenChat));

                    if ((target as Player).questStateLib[0] <= 0)
                    {
                        GetPacket(typeof(OpenChat)).Invoke(target.id, 0);
                    }
                    else if ((target as Player).questStateLib[0] == 1)
                    {
                        GetPacket(typeof(OpenChat)).Invoke(target.id, 1);
                    }
                }
                else
                {
                    EntityHandler.DestroyEntity <Player>(target);
                }
            }));

        default:
            return(null);
        }
    }
    private IEnumerator UpdateMinimap()
    {
        Character player = EntityHandler.GetEntity <Character>(EntityGroup.PLAYER, Client.instance.myId);

        if (player != null)
        {
            Vector3 ppos = player.transform.position;

            if (minimapCamera != null)
            {
                if (imageOut != null)
                {
                    minimapCamera.transform.position = new Vector3(ppos.x, minimapCamera.transform.position.y, ppos.z);
                }
                else
                {
                    Debug.Log("[Interface::Overlay]: Unable to find rendering image for minimap");
                }
            }
            else
            {
                Debug.Log("[Interface::Overlay]: Unable to find minimap camera out");
            }
        }


        yield return(new WaitForFixedUpdate());
    }
Example #12
0
        /// <summary>
        /// Returns the list of tables in the database
        /// </summary>
        /// <returns>The list of tables</returns>
        public virtual IList <Entity> GetTables()
        {
            LoggerHelper.Info("Start");
            IList <Entity> list = null;

            try
            {
                StringBuilder query = new StringBuilder();
                query.Append("SELECT OWNER || '.' || TABLE_NAME AS \"Name\" FROM ALL_TABLES  WHERE TABLESPACE_NAME NOT IN ('SYSTEM','SYSAUX','TOOLS') \n");
                query.Append("UNION \n");
                query.Append("SELECT OWNER || '.' || VIEW_NAME AS  \"Name\" FROM ALL_VIEWS \n");
                query.Append("WHERE OWNER NOT IN (SELECT DISTINCT(OWNER) FROM ALL_TABLES WHERE TABLESPACE_NAME IN ('SYSTEM','SYSAUX','TOOLS')) \n");
                query.Append("ORDER BY 1");
                LoggerHelper.Debug(query.ToString());

                Entity entity = new Entity("Tables");
                entity.SetField(new Field("Name"));

                ResultSetHandler <IList <Entity> > h = new EntityHandler <Entity>(entity);
                list = GetQueryRunner().Query(GetConnection(), query, h);
            }
            catch (Exception e)
            {
                LoggerHelper.Error(e);
                throw new Exception("Unable to get tables/views.", e);
            }
            finally
            {
                LoggerHelper.Info("End");
            }

            return(list);
        }
        public SoftwareModelService(
            FsUnitOfWork db,
            FSSecurityContext securityContext,
            ReferenceProvider referenceService,
            BusinessUnitProvider businessUnitService,
            CapabilityProvider capabilityProvider,
            ProjectService projectService,
            StakeholderService stakeholderService,
            SoftwareModelInterfaceService softwareModelInterfaceService,
            ProviderLinq <SoftwareModelDependency, Guid> softwareModelDependencyProvider,
            IEntityIdProvider <SoftwareModel, Guid> idProvider,
            IMessagePipe messagePipe = null,
            IProvideSpecifications <SoftwareModel> specProvider = null,
            EntityHandler <SoftwareModel, Guid> entityHandler   = null)
            : base(securityContext, referenceService, db, idProvider, messagePipe, specProvider, entityHandler)
        {
            Guard.ArgumentNotNull(securityContext, nameof(securityContext));
            Guard.ArgumentNotNull(capabilityProvider, nameof(capabilityProvider));
            Guard.ArgumentNotNull(referenceService, nameof(referenceService));
            Guard.ArgumentNotNull(softwareModelInterfaceService, nameof(softwareModelInterfaceService));

            _sfDb = db;

            _capabilitiesProvider           = capabilityProvider;
            _businessUnitService            = businessUnitService;
            _stakeholderService             = stakeholderService;
            _softwareModelInterfaceService  = softwareModelInterfaceService;
            _softwareModelDependencyService = softwareModelDependencyProvider;
            _projectService = projectService;
        }
Example #14
0
        /// <summary>
        /// Return all entities related to the specified entity type.
        /// </summary>
        /// <param name="entity">The entity type</param>
        /// <returns>The list of entities</returns>
        public virtual IList <Entity> GetEntities(Entity entity)
        {
            LoggerHelper.Info("Start");

            IList <Entity> list = new List <Entity>();

            try
            {
                StringBuilder query = GetQueryBuilder().BuildQuery(entity);
                LoggerHelper.Debug(query.ToString());

                ResultSetHandler <IList <Entity> > h = new EntityHandler <Entity>(entity);
                list = GetQueryRunner().Query(GetConnection(), query, h);
            }
            catch (Exception e)
            {
                LoggerHelper.Error(e);
                throw new Exception("Unable to fetch " + entity.GetTableName() + " list.", e);
            }
            finally
            {
                LoggerHelper.Info("End");
            }

            return(list);
        }
Example #15
0
        public MenuModule Create(Bank bank, Dictionary <string, Shape> shipList,
                                 Dictionary <string, Level> levelList, IReceiveMenuData receiver, ExitGame exit)
        {
            //spawn asteroids
            Level           menuScene     = levelList["MenuScene"];
            EntityHandler   entityHandler = new EntityHandler(null, menuScene.PlayArea);
            AsteroidFactory asteroidFac   = new AsteroidFactory(entityHandler);
            string          asteroidPath  = SwinGame.AppPath() + "\\resources\\data\\asteroids\\asteroid.json";

            for (int i = 0; i < menuScene.AsteroidsToSpawn; i++)
            {
                Asteroid toSpawn = asteroidFac.Create(asteroidPath, menuScene.PlayArea);
                entityHandler.Track(toSpawn);
            }

            MenuModule result = new MenuModule(new MenuSendData(receiver), bank, shipList, levelList, menuScene, entityHandler, exit);

            MenuFactory menuFac = new MenuFactory(dirPath, result);

            result.AddMenu(menuFac.CreateNormalMenu("\\help.json"));
            result.AddMenu(menuFac.CreateHighscoreMenu("\\highscores.json"));
            result.AddMenu(menuFac.CreateNormalMenu("\\main.json"));
            result.AddMenu(menuFac.CreateNormalMenu("\\options.json"));
            result.AddMenu(menuFac.CreateNormalMenu("\\scorescreen.json"));
            result.AddMenu(menuFac.CreateSelectMenu("\\select.json", shipList, levelList));

            result.ChangeMenu("Main");

            return(result);
        }
Example #16
0
        /// <summary>
        /// Returns the list of columns of the specified table.
        /// </summary>
        /// <param name="tableName">The table name</param>
        /// <returns>The list of columns</returns>
        public virtual IList <Entity> GetTableColumns(string tableName)
        {
            LoggerHelper.Info("Start");
            IList <Entity> list = null;

            try
            {
                string[] tableInfo = tableName.Split('.');
                LoggerHelper.Debug("tableInfo,length = " + tableInfo.Length.ToString());

                StringBuilder   query       = new StringBuilder();
                IList <DBParam> queryParams = new List <DBParam>();
                query.Append("SELECT COLUMN_NAME AS [Name], IS_NULLABLE AS [Required], DATA_TYPE AS [Type], ");
                query.Append("CHARACTER_MAXIMUM_LENGTH AS [MaxLength], ORDINAL_POSITION AS [Order] ");
                query.Append("FROM INFORMATION_SCHEMA.COLUMNS ");
                query.Append("WHERE TABLE_NAME = @p0 ");
                if (tableInfo.Length == 1)
                {
                    queryParams.Add(new DBParam(queryParams, tableInfo[0], DbType.String));
                }
                else if (tableInfo.Length == 2)
                {
                    query.Append("AND TABLE_SCHEMA = @p1 ");
                    queryParams.Add(new DBParam(queryParams, tableInfo[1], DbType.String));
                    queryParams.Add(new DBParam(queryParams, tableInfo[0], DbType.String));
                }
                else
                {
                    queryParams.Add(new DBParam(queryParams, tableName, DbType.String));
                }


                query.Append("ORDER BY TABLE_NAME,ORDINAL_POSITION ");

                LoggerHelper.Debug(query.ToString());

                //TODO : Create an entity object
                Entity entity = new Entity("Columns");
                entity.SetField(new Field("Name"));
                entity.SetField(new Field("Required"));
                entity.SetField(new Field("Type"));
                entity.SetField(new Field("MaxLength"));
                entity.SetField(new Field("Order"));

                StatementWrapper wrapper             = new StatementWrapper(query, queryParams);
                ResultSetHandler <IList <Entity> > h = new EntityHandler <Entity>(entity);
                list = GetQueryRunner().Query(GetConnection(), wrapper, h);
            }
            catch (Exception e)
            {
                LoggerHelper.Error(e);
                throw new Exception("Unable to get table columns.", e);
            }
            finally
            {
                LoggerHelper.Info("End");
            }

            return(list);
        }
Example #17
0
        EntityHandler CreateEntity(World _world)
        {
            EntityHandler entity = _world.CreateEntity();

            AddComponents(entity);
            return(entity);
        }
Example #18
0
 private void AddFieldsWithParameterToConstructor(ClassFile classFile, Mapper mapper)
 {
     foreach (var property in EntityHandler.GetClassBuilder(mapper.FromTo.From).GetChildChildCollectionProperties)
     {
         classFile.Constructor.AddFieldWithParameter(new Field("private", $"_{EntityHandler.GetMapperInterfaceParameter(property.Property.DataType.Type)}", EntityHandler.GetMapperInterface(property.Property.DataType.Type)),
                                                     new TypeWithName($"{EntityHandler.GetMapperInterfaceParameter(property.Property.DataType.Type)}", EntityHandler.GetMapperInterface(property.Property.DataType.Type)));
     }
 }
    public void Awake()
    {
        // TODO uncomment after adding initial screen
        // this.resourceScript = GameObject.Find("ResourceManager").GetComponent<ResourceManager>() as ResourceManager;

        this.cameraMovementScript = GameObject.Find("Main Camera").GetComponent <CameraMovement>() as CameraMovement;
        this.entityHandlerScript  = this.GetComponent <EntityHandler>() as EntityHandler;
    }
Example #20
0
        internal Room(IRoomData roomData, IRoomModel model)
        {
            RoomData  = roomData;
            RoomModel = model;

            _cancellationToken = new CancellationTokenSource();
            RoomGrid           = new RoomGrid(RoomModel);
            _entityHandler     = new EntityHandler(this);
        }
 /// <summary>
 ///     Creates a new instance.
 /// </summary>
 public CapabilityProvider(
     IUnitOfWorkLinq <Capability, Guid> db,
     IEntityIdProvider <Capability, Guid> keyBinder,
     IMessagePipe messagePipe = null,
     IProvideSpecifications <Capability> specProvider = null,
     EntityHandler <Capability, Guid> entityHandler   = null)
     : base(db, keyBinder, messagePipe, specProvider, entityHandler)
 {
 }
Example #22
0
 public ProtocolTypeProvider(
     IUnitOfWorkLinq <ProtocolType, string> db,
     IEntityIdProvider <ProtocolType, string> idProvider,
     IMessagePipe messagePipe = null,
     IProvideSpecifications <ProtocolType> specProvider = null,
     EntityHandler <ProtocolType, string> entityHandler = null) :
     base(db, idProvider, messagePipe, specProvider, entityHandler)
 {
 }
Example #23
0
 public StakeholderLoginProvider(
     IUnitOfWorkLinq <StakeholderLogin, Guid> db,
     IEntityIdProvider <StakeholderLogin, Guid> keyBinder,
     IMessagePipe messagePipe = null,
     IProvideSpecifications <StakeholderLogin> specProvider = null,
     EntityHandler <StakeholderLogin, Guid> entityHandler   = null)
     : base(db, keyBinder, messagePipe, specProvider, entityHandler)
 {
 }
 /// <summary>
 ///     Creates a new instance.
 /// </summary>
 public ScenarioProvider(
     IUnitOfWorkLinq <Scenario, Guid> db,
     IEntityIdProvider <Scenario, Guid> keyBinder,
     IMessagePipe messagePipe = null,
     IProvideSpecifications <Scenario> specProvider = null,
     EntityHandler <Scenario, Guid> entityHandler   = null)
     : base(db, keyBinder, messagePipe, specProvider, entityHandler)
 {
 }
 public LifeCycleProvider(
     IUnitOfWorkLinq <LifeCycle, string> db,
     IEntityIdProvider <LifeCycle, string> keyBinder,
     IMessagePipe messagePipe = null,
     IProvideSpecifications <LifeCycle> specProvider  = null,
     EntityHandler <LifeCycle, string> onBeforeInsert = null)
     : base(db, keyBinder, messagePipe, specProvider, onBeforeInsert)
 {
 }
Example #26
0
 public BusinessUnitProvider(
     IUnitOfWorkLinq <BusinessUnit, Guid> db,
     IEntityIdProvider <BusinessUnit, Guid> keyBinder,
     IMessagePipe messagePipe = null,
     IProvideSpecifications <BusinessUnit> specProvider = null,
     EntityHandler <BusinessUnit, Guid> entityHandler   = null)
     : base(db, keyBinder, messagePipe, specProvider, entityHandler)
 {
 }
Example #27
0
        private void PrintEntityTree(object sender, EventArgs e)
        {
            Console.WriteLine($"Sprite Tree: \n {EntityHandler.GetEntityTree()}");

            Console.WriteLine("Sprite List:");
            foreach (IEntity s in EntityHandler.EntityList)
            {
                Console.WriteLine($"    ({s})");
            }
        }
Example #28
0
        public static void Init(GraphicsDeviceManager graphics, GraphicsDevice graphicsDevice)
        {
            Camera.SetDimensions(graphics, 1024, 576);
            //Camera.SetDimensions(graphics, graphicsDevice);
            EntityHandler.Init();

            startScreen   = new StartScreen();
            helpScreen    = new HelpScreen();
            cursorHandler = new CursorHandler();
        }
Example #29
0
        public static void Init(GraphicsDeviceManager graphics, GraphicsDevice graphicsDevice)
        {
            //Start Camera Dimensions
            Camera.SetDimensions(graphics, 120 * 8, 100 * 8);//TODO: Make everything scalable and make screen size smaller
            //Camera.SetDimensions(graphics, graphicsDevice);
            EntityHandler.Init();

            startScreen   = new StartScreen();
            helpScreen    = new HelpScreen();
            cursorHandler = new CursorHandler();
        }
    void Awake()
    {
        //this.terrainGeneratorScript = this.GetComponent<TerrainGenerator>() as TerrainGenerator;
        this.treeviewHandlerScript = GameObject.Find("Script Handler").GetComponent <TreeviewHandler>() as TreeviewHandler;
        this.entityHandlerScript   = GameObject.Find("Script Handler").GetComponent <EntityHandler>() as EntityHandler;

        // set inital position of camera in its view
        transform.position = new Vector3(4096, 8192, 4096);
        transform.rotation = Quaternion.identity;
        transform.Rotate(90, 0, 0);
    }
Example #31
0
        public async void testGetAllEntities()
        {
            var handler = new EntityHandler();

            APIGatewayProxyRequest request = new APIGatewayProxyRequest();

            object result = await handler.getEntities(request);

            // TODO: Better assertion
            Assert.NotEmpty(result.ToString());
        }
Example #32
0
 public bool Update(EntityHandler.Roles obj)
 {
     bool Status = false;
     try
     {
         Status = new DataAccessHandler.Roles().Update(obj);
     }
     catch (Exception ex)
     { }
     return Status;
 }
Example #33
0
 public bool Insert(EntityHandler.SubObjects obj)
 {
     bool Status = false;
     try
     {
         Status = new DataAccessHandler.SubObjects().Insert(obj);
     }
     catch (Exception ex)
     { }
     return Status;
 }
Example #34
0
 public bool Insert(EntityHandler.RolePermissions obj)
 {
     bool Status = false;
     try
     {
         Status = new DataAccessHandler.RolePermissions().Insert(obj);
     }
     catch (Exception ex)
     { }
     return Status;
 }
Example #35
0
 public bool Delete(EntityHandler.User obj)
 {
     bool Status = false;
     try
     {
         Status = new DataAccessHandler.User().Delete(obj);
     }
     catch (Exception ex)
     { }
     return Status;
 }
Example #36
0
        public GameState(string name)
            : base(name)
        {
            this.SetStyle(ControlStyles.UserPaint | ControlStyles.AllPaintingInWmPaint | ControlStyles.DoubleBuffer, true);

            this._entityHandler = null;
            this._tileHandler = null;
            this.playerObj = null;

            this.Paint += this.PaintEvent;
        }
Example #37
0
        public DataTable SelectAll(EntityHandler.VoucherType obj)
        {
            DataTable dt = new DataTable();
            try
            {
                string SqlCommand = "";

                dt = new DALBase().Select(SqlCommand);
            }
            catch (Exception ex)
            { }
            return dt;
        }
Example #38
0
        public bool Delete(EntityHandler.VoucherType obj)
        {
            bool Status = false;
            try
            {
                string SqlCommand = "";

                Status = new DALBase().Update(SqlCommand);
            }
            catch (Exception ex)
            { }
            return Status;
        }
Example #39
0
        public bool Insert(EntityHandler.Objects obj)
        {
            bool Status = false;
            try
            {
                string SqlCommand = "";

                Status = new DALBase().Insert(SqlCommand);
            }
            catch (Exception ex)
            { }
            return Status;
        }
Example #40
0
        public bool Update(EntityHandler.ChoseBank obj)
        {
            bool Status = false;
            try
            {
                string SqlCommand = "";

                Status = new DALBase().Update(SqlCommand);
            }
            catch (Exception ex)
            { }
            return Status;
        }
Example #41
0
 public List<EntityHandler.UserRoles> SelectAll(EntityHandler.UserRoles obj)
 {
     List<EntityHandler.UserRoles> listobj = new List<EntityHandler.UserRoles>();
     try
     {
         DataTable dt = new DataAccessHandler.UserRoles().SelectAll(obj);
         for (int i = 0; i < dt.Rows.Count; i++)
         {
             listobj.Add(ConvertToObject(dt.Rows[i]));
         }
     }
     catch (Exception ex)
     { }
     return listobj;
 }
Example #42
0
        public DataTable BALGetBankAccAll(EntityHandler.Bank objBank)
        {
            DataTable dt = new DataTable();
            try
            {
                DataAccessHandler.BankAccount objDALBankAcc = new DataAccessHandler.BankAccount();
                dt = objDALBankAcc.SelectAll(objBank);

            }
            catch (Exception ex)
            {
            }

            return dt;
        }
Example #43
0
        public DataTable SelectAll(EntityHandler.Bank objBank)
        {
            DataTable dt = new DataTable();
            try
            {
                SqlCommand oSqlCommand = new SqlCommand();
                string SqlQuery = "WCF_SelectBankAccALL";

                oSqlCommand.CommandText = SqlQuery;
                oSqlCommand.Parameters.AddWithValue("@code",objBank.Code);

                dt = new DALBase().SelectSPFinance(oSqlCommand);
                dt.TableName = "tblBankAccount";
            }
            catch (Exception ex)
            { }
            return dt;
        }
Example #44
0
        public string SaveAcknoledgement(EntityHandler.Acknoladgement _SaveData, MySqlConnection _CurCon)
        {
            MySqlCommand oSqlCommand = new MySqlCommand();
            string sqlQuery = "Insert Into Acknoladgement ("
          + "Name,"
          + "NIC,"
          + "TP,"
          + "VoucherNo,"
          + "ChequeNo,"
          + "SaveDate)"
           + " Values ("
           + "@Name,"
           + "@NIC,"
           + "@TP,"
           + "@VoucherNo,"
           + "@ChequeNo,"
           + "@SaveDate)";
            try
            {
                oSqlCommand.Parameters.AddWithValue("@Name", _SaveData.name);
                oSqlCommand.Parameters.AddWithValue("@NIC", _SaveData.nic);
                oSqlCommand.Parameters.AddWithValue("@TP", _SaveData.tp);
                oSqlCommand.Parameters.AddWithValue("@VoucherNo", _SaveData.voucherno);
                oSqlCommand.Parameters.AddWithValue("@ChequeNo", _SaveData.chequeno);
                oSqlCommand.Parameters.AddWithValue("@SaveDate", _SaveData.savedate);
                
                string respond = Mycommon.ExicuteAnyCommandAccountWithTrans(sqlQuery, oSqlCommand, _CurCon, "Save Ack");
                return respond;
            }
            catch (Exception ex)
            {
                return ex.Message;
            }


        }
Example #45
0
	    protected override void OnStop()
		{
			if (_viewerHandler != null)
			{
				_viewerHandler.Dispose();
				_viewerHandler = null;
			}

			//TODO (CR May 2010): WebDesktopWindow shouldn't hang around, but we can check.
			if (_viewer != null)
			{
				_viewer.Stop();
				_viewer.Dispose();
				_viewer = null;
			}
		}
Example #46
0
        public override void Destruct()
        {
            base.Destruct();

            //Destruction of the game state.
            //All resources that were allocated in the construct phase should be disposed of here.
            lock(this.lockObj) {
                if(this._buffer != null) this._buffer.Dispose();
            }

            aTimer.Dispose();

            ((Form1)this.Form).iHandler.ClearKeys();

            this._entityHandler.ClearList();
            this._tileHandler.ClearMap();

            this._entityHandler = null;
            this._tileHandler = null;
            this.playerObj = null;
        }
Example #47
0
        public override void Construct()
        {
            this.aTimer = new Timer();
            aTimer.Tick += new EventHandler(TimerTick);
            aTimer.Interval = 1000;
            aTimer.Start();
            timer = 0;

            //Construction of the game state, anything that the game needs to create initially should be put here (Player, platform, etc).
            lock (this.lockObj) {
                if (this._buffer != null)
                    this._buffer.Dispose();

                this._buffer = new Bitmap(this.Size.Width, this.Size.Height);
            }

            //Finally we make the handlers that are required to do things in the gamestate.
            this._entityHandler = new EntityHandler(this);
            this._tileHandler = new TileHandler(this);

            //Tile loading
            try
            {
                this._tileHandler.LoadFromFile("map_" + level);
            }
            catch (Exception noMoreMaps)
            {
                finishedGame();
                return;
            }

            //Making a new player.
            this.playerObj = new Player(whichStartPoint(level), 0);

            this._entityHandler.AddEntity(playerObj);

            //Sorting the list so we can draw them behind each other.
            this._entityHandler.SortList();

            ((Form1)this.Form).iHandler.addKeyDown(delegate (object sender, KeyEventArgs e) {
                // Switch case to see what handling to do when a button is pressed.
                switch (e.KeyCode) {
                    case Keys.Escape:
                        ((Form1)this.Form).sHandler.activateState("MainState");
                        level = 1;
                        break;
                    case Keys.A:
                        this.playerObj.GoLeft();
                        break;
                    case Keys.D:
                        this.playerObj.GoRight();
                        break;
                    case Keys.W:
                        this.playerObj.GoUp();
                        break;
                    case Keys.Space:
                        this.playerObj.GoUp();
                        break;
                    default:
                        break;
                }
            });
            ((Form1)this.Form).iHandler.addKeyUp(delegate (object sender, KeyEventArgs e) {
                // Switch case to see what handling to do when a button is released.
                switch (e.KeyCode) {
                    case Keys.A:
                        this.playerObj.Stop();
                        break;
                    case Keys.D:
                        this.playerObj.Stop();
                        break;
                }
            });

            this.playerObj.Alive = true;

            base.Construct();
        }
Example #48
0
	    protected override void OnStart(StartApplicationRequest request)
		{
			lock (_syncLock)
			{
                Platform.Log(LogLevel.Info, "Viewer Application is starting...");
                if (Application.Instance == null)
					Platform.StartApp("ClearCanvas.Desktop.Application",new string[] {"-r"});
			}

            


            if (Platform.IsLogLevelEnabled(LogLevel.Debug))
                Platform.Log(LogLevel.Debug, "Finding studies...");
			var startRequest = (StartViewerApplicationRequest)request;
			IList<StudyRootStudyIdentifier> studies = FindStudies(startRequest);

			List<LoadStudyArgs> loadArgs = CollectionUtils.Map(studies, (StudyRootStudyIdentifier identifier) => CreateLoadStudyArgs(identifier));

		    DesktopWindowCreationArgs args = new DesktopWindowCreationArgs("", Identifier.ToString());
            WebDesktopWindow window = new WebDesktopWindow(args, Application.Instance);
            window.Open();

            _viewer = CreateViewerComponent(startRequest);

			try
			{
                if (Platform.IsLogLevelEnabled(LogLevel.Debug))
                    Platform.Log(LogLevel.Debug, "Loading study...");
                _viewer.LoadStudies(loadArgs);
			}
			catch (Exception e)
			{
				if (!AnySopsLoaded(_viewer)) //end the app.
                    throw;

				//Show an error and continue.
				ExceptionHandler.Report(e, window);
			}

            if (Platform.IsLogLevelEnabled(LogLevel.Debug))
                Platform.Log(LogLevel.Info, "Launching viewer...");
			
			ImageViewerComponent.Launch(_viewer, window, "");

			_viewerHandler = EntityHandler.Create<ViewerEntityHandler>();
			_viewerHandler.SetModelObject(_viewer);
		    _app = new Common.ViewerApplication
		               {
		                   Identifier = Identifier,
		                   Viewer = (Viewer) _viewerHandler.GetEntity(),

                           VersionString = GetProductVersionString()
                                
			           };
            

            // Push the ViewerApplication object to the client
            Event @event = new PropertyChangedEvent
            {
                PropertyName = "Application",
                Value = _app,
                Identifier = Guid.NewGuid(),
                SenderId = request.Identifier
            };

            ApplicationContext.Current.FireEvent(@event);
		}