Ejemplo n.º 1
0
        public ModuleController(IMessageService messageService, IPresentationService presentationService, 
            IEntityController entityController, BookController bookController, PersonController personController, 
            ShellService shellService, Lazy<ShellViewModel> shellViewModel)
        {
            presentationService.InitializeCultures();

            this.messageService = messageService;
            this.entityController = entityController;
            this.bookController = bookController;
            this.personController = personController;
            this.shellService = shellService;
            this.shellViewModel = shellViewModel;
            this.exitCommand = new DelegateCommand(Close);
        }
Ejemplo n.º 2
0
 public void Init(IEntityController entityController, IMapController mapController, BattleTraitData data, IBattleEntity owner, BaseGameEvents gameEvents)
 {
     _targets          = new List <IBattleEntity>();
     _data             = data;
     _entityController = entityController;
     _owner            = owner;
     _attacks          = new List <BaseAttack>();
     _currentAttackIdx = 0;
     _gameEvents       = gameEvents;
     _battleEvents     = gameEvents.Battle;
     foreach (var attackData in data.Attacks)
     {
         var attack = attackData.SpawnRuntime();
         attack.Init(entityController, mapController);
         _attacks.Add(attack);
     }
 }
Ejemplo n.º 3
0
        /// <summary>
        /// The page_ init.
        /// </summary>
        /// <param name="sender">
        /// The sender.
        /// </param>
        /// <param name="e">
        /// The e.
        /// </param>
        protected void Page_Init(object sender, EventArgs e)
        {
            this.billingEntityController = new BillingEntityController();
            this.bookingEntityController = new BookingController();
            var hotel = this.Session["Hotel"] as Hotel;

            this.bookingComboBox.DataSource = hotel != null?this.bookingEntityController.RefreshEntities().Where(x => x.Room.HotelId == hotel.Id) : this.bookingEntityController.RefreshEntities();

            this.bookingComboBox.SelectedIndex = 0;
            this.bookingComboBox.Value         = "Customer.Name";
            this.bookingComboBox.DataBind();


            this.BillingListGridView.DataSource = hotel != null?this.billingEntityController.RefreshEntities().Where(x => x.Booking.Room.HotelId == hotel.Id) : this.billingEntityController.RefreshEntities();

            this.BillingListGridView.DataBind();
        }
Ejemplo n.º 4
0
        /// <summary>
        /// The billing list grid view_ on custom button callback.
        /// </summary>
        /// <param name="sender">
        /// The sender.
        /// </param>
        /// <param name="e">
        /// The e.
        /// </param>
        protected void BillingListGridView_OnCustomButtonCallback(object sender, ASPxGridViewCustomButtonCallbackEventArgs e)
        {
            this.billingEntityController = new BillingEntityController();
            var gridviewIndex = e.VisibleIndex;
            var row           = this.BillingListGridView.GetRow(gridviewIndex) as Billing;

            if (row != null)
            {
                var myBilling = this.billingEntityController.GetEntity(row.Id);
                this.BillingListGridView.JSProperties["cp_text"]  = myBilling.Paid;
                this.BillingListGridView.JSProperties["cp_text1"] = myBilling.PriceForServices;
                this.BillingListGridView.JSProperties["cp_text2"] = myBilling.PriceForRoom;
                this.BillingListGridView.JSProperties["cp_text3"] = myBilling.TotalPrice;
                this.BillingListGridView.JSProperties["cp_text4"] = row.Id;
                this.BillingListGridView.JSProperties["cp_text5"] = myBilling.Booking.Customer.Name;
                this.BillingListGridView.JSProperties["cp_text6"] = myBilling.Booking.Customer.Surname;
            }
        }
Ejemplo n.º 5
0
        /// <summary>
        /// The hotel grid view_ on custom button callback.
        /// </summary>
        /// <param name="sender">
        /// The sender.
        /// </param>
        /// <param name="e">
        /// The e.
        /// </param>
        protected void HotelGridView_OnCustomButtonCallback(object sender, ASPxGridViewCustomButtonCallbackEventArgs e)
        {
            this.hotelController = new HotelController();
            var gridviewIndex = e.VisibleIndex;
            var row           = this.HotelGridView.GetRow(gridviewIndex) as Hotel;

            if (row != null)
            {
                var myHotel = this.hotelController.GetEntity(row.Id);
                this.HotelGridView.JSProperties["cp_text1"] = myHotel.Id;
                this.HotelGridView.JSProperties["cp_text2"] = myHotel.Name;
                this.HotelGridView.JSProperties["cp_text3"] = myHotel.Address;
                this.HotelGridView.JSProperties["cp_text4"] = myHotel.Manager;
                this.HotelGridView.JSProperties["cp_text5"] = myHotel.Email;
                this.HotelGridView.JSProperties["cp_text6"] = myHotel.Phone;
                this.HotelGridView.JSProperties["cp_text7"] = myHotel.TaxId;
            }
        }
Ejemplo n.º 6
0
 public void RemoveControllers(Type type)
 {
     if (controllers.Count > 0)
     {
         for (int i = 0; i < controllers.Count;)
         {
             IEntityController controller = controllers[i];
             if (type.IsAssignableFrom(controller.GetType()))
             {
                 controllers.RemoveAt(i);
                 controller.RemovedFromEntity();
             }
             else
             {
                 ++i;
             }
         }
     }
 }
Ejemplo n.º 7
0
        /// <summary>
        /// The page_ load.
        /// </summary>
        /// <param name="sender">
        /// The sender.
        /// </param>
        /// <param name="e">
        /// The e.
        /// </param>
        protected void Page_Load(object sender, EventArgs e)
        {
            var hotel      = this.Session["Hotel"] as Hotel;
            var errorlabel = this.Master?.FindControl("form1").FindControl("divErrorMessage") as Label;

            if (!this.IsPostBack)
            {
                this.billingEntityController = new BillingEntityController();
                try
                {
                    var report = hotel != null ? new BillingsReport {
                        DataSource = this.billingEntityController.RefreshEntities().Where(x => x.Booking.Room.HotelId == hotel.Id)
                    } : new BillingsReport()
                    {
                        DataSource = this.billingEntityController.RefreshEntities()
                    };
                    this.ASPxBillingWebDocumentViewer.OpenReport(report);
                }
                catch (SqlException ex)
                {
                    if (errorlabel != null)
                    {
                        errorlabel.Text = "Something went wrong with the database.Please check the connection string.";
                    }
                }
                catch (ArgumentNullException ex)
                {
                    if (errorlabel != null)
                    {
                        errorlabel.Text = "Couldn't create the current Billing";
                    }
                }
                catch (Exception ex)
                {
                    if (errorlabel != null)
                    {
                        errorlabel.Text = ex.Message;
                    }
                }
            }
        }
        protected void PricingListGridView_OnCustomButtonCallback(object sender, ASPxGridViewCustomButtonCallbackEventArgs e)
        {
            this.pricingListController = new PricingListController();
            this.roomTypeController    = new RoomTypeController();
            this.serviceController     = new ServiceController();



            var gridviewIndex = e.VisibleIndex;
            var row           = this.PricingListGridView.GetRow(gridviewIndex) as PricingList;
            var myPricingList = this.pricingListController.GetEntity(row.Id);

            if (myPricingList.TypeOfBillableEntity == TypeOfBillableEntity.RoomType)
            {
                var roomTypeTemp =
                    this.roomTypeController.RefreshEntities()
                    .SingleOrDefault(x => x.Id == myPricingList.BillableEntityId) as RoomType;
                myPricingList.BillableEntityCode = roomTypeTemp.Code;
            }
            else
            {
                var serviceTemp =
                    this.serviceController.RefreshEntities()
                    .SingleOrDefault(x => x.Id == myPricingList.BillableEntityId) as Service;
                myPricingList.BillableEntityCode = serviceTemp.Code;
            }

            this.PricingListGridView.JSProperties["cp_text1"] = myPricingList.Id;
            this.PricingListGridView.JSProperties["cp_text2"] = (int)myPricingList.TypeOfBillableEntity;
            this.PricingListGridView.JSProperties["cp_text3"] = myPricingList.BillableEntityCode;
            this.PricingListGridView.JSProperties["cp_text4"] = myPricingList.BillableEntityCode;
            this.PricingListGridView.JSProperties["cp_text5"] = myPricingList.ValidFrom.ToString(CultureInfo.CurrentCulture);
            this.PricingListGridView.JSProperties["cp_text6"] = myPricingList.ValidTo.ToString(CultureInfo.CurrentCulture);
            this.PricingListGridView.JSProperties["cp_text7"] = myPricingList.Price;
            this.PricingListGridView.JSProperties["cp_text8"] = myPricingList.VatPrc;

            if (e.ButtonID == "editButton")
            {
                this.DisplayBillableServiceControl(myPricingList.TypeOfBillableEntity.ToString());
            }
        }
Ejemplo n.º 9
0
    protected override bool HandleAdditionalMoveInteractions(PlayerActionStateContext contextData, Vector2Int newPlayerCoords, ref int nextPlayState, ref bool canMove)
    {
        // TODO: Automatic absorption attempt
        IEntityController entities = contextData.EntityController;
        KrbPlayer         player   = (KrbPlayer)entities.Player;

        if (!player.AbsorberTrait.Data.AutoAbsorb)
        {
            return(false);
        }

        var targetCandidates = entities.GetEntitiesAt(newPlayerCoords);

        foreach (var c in targetCandidates)
        {
            if (c is IAbsorbableEntity test && player.AbsorberTrait.TryAbsorb(test))
            {
                canMove = true;
                return(true);
            }
        }
        return(false);
    }
Ejemplo n.º 10
0
        /// <summary>
        /// The bt o k_ on click.
        /// </summary>
        /// <param name="sender">
        /// The sender.
        /// </param>
        /// <param name="e">
        /// The e.
        /// </param>
        protected void saveButton_OnClick(object sender, EventArgs e)
        {
            var errorlabel = this.Master?.FindControl("form1").FindControl("divErrorMessage") as Label;

            this.hotelController = new HotelController();
            try
            {
                this.hotel = new Hotel()
                {
                    Id      = Convert.ToInt32(this.idTextBox.Text),
                    Name    = this.nameTextBox.Text,
                    Address = this.addressTextBox.Text,
                    Manager = this.managerTextBox.Text,
                    Email   = this.emailTextBox.Text,
                    Phone   = this.phoneTextBox.Text,
                    TaxId   = this.taxIdSpinEdit.Text
                };

                this.hotelController.CreateOrUpdateEntity(this.hotel);
                this.HotelGridView.DataSource = this.hotelController.RefreshEntities();
                this.HotelGridView.DataBind();
            }
            catch (SqlException exp)
            {
                if (errorlabel != null)
                {
                    errorlabel.Text = "Something went wrong with the database.Please check the connection string.";
                }
            }
            catch (ArgumentNullException exp)
            {
                if (errorlabel != null)
                {
                    errorlabel.Text = "Couldn't create the current Hotel";
                }
            }
        }
Ejemplo n.º 11
0
        /// <summary>
        /// Allows the game to perform any initialization it needs to before starting to run.
        /// This is where it can query for any required services and load any non-graphic
        /// related content.  Calling base.Initialize will enumerate through any components
        /// and initialize them as well.
        /// </summary>
        protected override void Initialize()
        {
            // Initialize the logger system
            DefaultLogger.Initialize(this, "../../../DefaultLog.txt");
            EntityIoLogger.Initialize("../../../IoLogfile.txt");

            // Give the IOC container a refence to the game.
            IocContainer.SetGameReference(this);

            // Create a new SpriteBatch, which can be used to draw textures.
            _spriteBatch = new SpriteBatch(GraphicsDevice);

            // Resolve controllers
            _entityController = IocContainer.Resolve<IEntityController>();
            _renderableController = IocContainer.Resolve<IRenderableController>();
            _aiController = IocContainer.Resolve<IAiController>();
            _collidableController = IocContainer.Resolve<ICollidableController>();
            _playerController = IocContainer.Resolve<IInteractiveController>();

            // Resolve messaging system
            _entityMessagingSystem = IocContainer.Resolve<IPriorityMessageQueue>();

            base.Initialize();
        }
Ejemplo n.º 12
0
        public DataBrowserControl(IEntityController controller)
        {
            if (controller == null)
            {
                throw new ArgumentNullException("IEntityController<T> cannot be null");
            }
            this.Controller = controller;

            //Fill the properties with "fresh" data
            Items = controller.GetDataSource();

            //Listen when the data changes so that we can update the properties holding the data
            controller.Changed += Controller_Changed;

            InitializeComponent();

            //Setting the background is required => when using DataBrowserControl as a popup
            //and it flows out of the window its background shouldn't be transparent
            dockPanel.Background = App.Current.MainWindow.Background;

            #region Mapping with column names
            foreach (KeyValuePair <string, string> item in controller.Mapping)
            {
                GridViewColumn column = new GridViewColumn
                {
                    Header = item.Key,
                    DisplayMemberBinding = new Binding(item.Value)
                    {
                        StringFormat     = item.Value.Contains("PRICE") ? "C" : "",
                        ConverterCulture = Thread.CurrentThread.CurrentCulture
                    }
                };
                gridView.Columns.Add(column);
            }
            #endregion

            //Create binding to the current controller
            Binding controllerBinding = new Binding()
            {
                Source = this,
                Path   = new PropertyPath("Controller"),
                Mode   = BindingMode.OneWay
            };

            //Create binding to the selected item (reversed binding used for the sake of simplicity)
            Binding selecteditemBinding = new Binding()
            {
                Source = this.Controller,
                Path   = new PropertyPath("SelectedItem"),
                Mode   = BindingMode.OneWayToSource
            };
            EntitiesListView.SetBinding(ListView.SelectedItemProperty, selecteditemBinding);

            #region Context menu
            Style style = new Style(typeof(ListViewItem));

            ContextMenu contextMenu = new ContextMenu();

            MenuItem newMenuItem = new MenuItem()
            {
                Command = InvoiceManagerCommands.New,
                Icon    = new Image()
                {
                    Source = new BitmapImage(new Uri("/Resources/new.png", UriKind.Relative)),
                    Width  = 20,
                    Height = 20
                }
            };
            newMenuItem.SetBinding(MenuItem.CommandParameterProperty, controllerBinding);
            contextMenu.Items.Add(newMenuItem);

            MenuItem editMenuItem = new MenuItem()
            {
                Command = InvoiceManagerCommands.Edit,
                Icon    = new Image()
                {
                    Source = new BitmapImage(new Uri("/Resources/Edit.png", UriKind.Relative)),
                    Width  = 20,
                    Height = 20
                }
            };
            editMenuItem.SetBinding(MenuItem.CommandParameterProperty, controllerBinding);
            contextMenu.Items.Add(editMenuItem);

            MenuItem deleteMenuItem = new MenuItem()
            {
                Command = InvoiceManagerCommands.Delete,
                Icon    = new Image()
                {
                    Source = new BitmapImage(new Uri("/Resources/Delete.png", UriKind.Relative)),
                    Width  = 20,
                    Height = 20
                }
            };
            deleteMenuItem.SetBinding(MenuItem.CommandParameterProperty, controllerBinding);
            contextMenu.Items.Add(deleteMenuItem);

            style.Setters.Add(new Setter(ListViewItem.ContextMenuProperty, contextMenu));
            Resources.Add(typeof(ListViewItem), style);
            #endregion
        }
Ejemplo n.º 13
0
 public virtual void Init(IEntityController entityController, IMapController mapController)
 {
     _entityController = entityController;
     _mapController    = mapController;
 }
Ejemplo n.º 14
0
 public GiveControlSystem(GameContext context, IEntityController entityController) : base(context)
 {
     _context          = context;
     _entityController = entityController;
 }
Ejemplo n.º 15
0
 public Mover(IEntityController controller, float moveSpeed)
 {
     _controller = controller;
     _moveSpeed  = moveSpeed;
 }
        /// <summary>
        /// The delete pricing list button_ on click.
        /// </summary>
        /// <param name="sender">
        /// The sender.
        /// </param>
        /// <param name="e">
        /// The e.
        /// </param>
        protected void DeletePricingListButton_OnClick(object sender, EventArgs e)
        {
            this.pricingListController = new PricingListController();
            this.roomTypeController    = new RoomTypeController();
            this.serviceController     = new ServiceController();

            var errorlabel = this.Master?.FindControl("form1").FindControl("divErrorMessage") as Label;

            if (errorlabel != null)
            {
                errorlabel.Text = string.Empty;
                if (this.PricingListGridView.VisibleRowCount == 0)
                {
                    errorlabel.Text = $"There are no Pricing Lists to delete";
                }

                var firstRun = true;
                this.Session["errorMessage"] = string.Empty;

                var selectedRowKeys =
                    this.PricingListGridView.GetSelectedFieldValues(this.PricingListGridView.KeyFieldName, "Id");
                if ((selectedRowKeys == null) || (selectedRowKeys.Count == 0))
                {
                    errorlabel.Text = @"Please select a Pricing List first to delete";
                    return;
                }

                foreach (object[] row in selectedRowKeys)
                {
                    var id = Convert.ToInt32(row[0]);
                    var pricingListTemp = new PricingList()
                    {
                        Id = id
                    };
                    try
                    {
                        this.pricingListController.DeleteEntity(pricingListTemp);
                    }
                    catch (ArgumentNullException)
                    {
                        if (firstRun)
                        {
                            errorlabel.Text = $"You can't delete ";
                            firstRun        = false;
                        }

                        errorlabel.Text += $"'{pricingListTemp.Id}',";
                        this.PricingListGridView.Selection.UnselectRowByKey(id);
                    }
                    catch (SqlException exp)
                    {
                        errorlabel.Text = $"Sql error: " + exp.Message;
                    }

                    errorlabel.Text = errorlabel.Text.TrimEnd(' ', ',');
                    this.Session["errorMessage"] = errorlabel.Text;

                    this.RefreshPricingListEntityWithCodeInside();
                }
            }
        }
Ejemplo n.º 17
0
 public DefaultPipeline(IEntityController controller, IContext context) {
     _context = (PipelineContext)context;
     _controller = controller;
     Transformers = new List<ITransform>();
 }
Ejemplo n.º 18
0
 public Entity(IEntityController controller)
     : base()
 {
     _controller = controller;
 }
Ejemplo n.º 19
0
 public LocatieViewModel(IEntityController <Locatie> locatieController, IEntityController <Registratie> registratieController)
 {
     this.locatieController     = locatieController;
     this.registratieController = registratieController;
 }
Ejemplo n.º 20
0
 public Dead(IEntityController controller, IMyAnimations animation, System.Action deadCallBack)
 {
     _animation    = animation;
     _controller   = controller;
     _deadCallBack = deadCallBack;
 }
Ejemplo n.º 21
0
 public MoverWithTranslate(IEntityController controller, float moveSpeed)
 {
     _controller = controller;
     _moveSpeed  = moveSpeed;
 }
Ejemplo n.º 22
0
    public int Update(PlayStateContext contextData, out bool timeWillPass)
    {
        if (Input.GetKeyDown(KeyCode.F4))
        {
            SceneManager.LoadScene(0);
        }
        PlayerActionStateContext actionData       = contextData as PlayerActionStateContext;
        BaseInputController      input            = actionData.Input;
        IMapController           map              = actionData.Map;
        IEntityController        entityController = actionData.EntityController;
        Player player = entityController.Player;

        int nextPlayState = GameController.PlayStates.Action;

        timeWillPass = false;

        if (input.IdleTurn)
        {
            timeWillPass = true;
            actionData.Events.Player.SendIdleTurn();
            return(GameController.PlayStates.Action);
        }

        if (input.RangeStart && player.BattleTrait.RangedAttack)
        {
            timeWillPass = false;
            return(GameController.PlayStates.RangePrepare);
        }

        Vector2Int playerCoords = map.CoordsFromWorld(player.transform.position);


        // GAME SPECIFIC
        if (HandleExtendedActions(actionData, out timeWillPass, out nextPlayState))
        {
            return(nextPlayState);
        }

        Vector2Int offset = map.CalculateMoveOffset(input.MoveDir, playerCoords);

        if (offset != Vector2Int.zero)
        {
            var newPlayerCoords = playerCoords + offset;

            if (!player.ValidMapCoords(newPlayerCoords))
            {
                timeWillPass = actionData.BumpingWallsWillSpendTurn;
            }
            else
            {
                timeWillPass = true;

                // Check interactions
                bool canMove = true;

                // Blockers:
                var blocker = FindBlockingEntityAt(entityController, newPlayerCoords);
                if (blocker != null)
                {
                    if (blocker.BlockingTrait.TryUnlock(player))
                    {
                        player.Coords = newPlayerCoords;
                    }
                    return(nextPlayState);
                }

                bool exit = HandleAdditionalMoveInteractions(actionData, newPlayerCoords, ref nextPlayState, ref canMove);
                if (exit)
                {
                    if (canMove)
                    {
                        player.Coords = newPlayerCoords;
                    }
                    return(nextPlayState);
                }

                if (player.SeesHostilesAtCoords(newPlayerCoords))
                {
                    bool allDefeated = player.AttackCoords(newPlayerCoords);
                    canMove = allDefeated;
                }

                if (canMove)
                {
                    player.Coords = newPlayerCoords;
                }
            }
        }

        // Quick Inventory actions:
        int inventoryIdx = System.Array.FindIndex(input.NumbersPressed, x => x);

        if (inventoryIdx != -1)
        {
            bool dropModifier = input.ShiftPressed;
        }

        return(GameController.PlayStates.Action);
    }
Ejemplo n.º 23
0
		public DataBrowserControl(IEntityController controller)
		{
			if (controller == null)
				throw new ArgumentNullException("IEntityController<T> cannot be null");
			this.Controller = controller;
			
			//Fill the properties with "fresh" data
			Items = controller.GetDataSource();
			
			//Listen when the data changes so that we can update the properties holding the data
			controller.Changed += Controller_Changed;
			
			InitializeComponent();
			
			//Setting the background is required => when using DataBrowserControl as a popup
			//and it flows out of the window its background shouldn't be transparent
			dockPanel.Background = App.Current.MainWindow.Background;
			
			#region Mapping with column names
			foreach(KeyValuePair<string, string> item in controller.Mapping)
			{
				GridViewColumn column = new GridViewColumn
					{
						Header = item.Key,
						DisplayMemberBinding = new Binding(item.Value)
							{
								StringFormat = item.Value.Contains("PRICE") ? "C" : "",
								ConverterCulture = Thread.CurrentThread.CurrentCulture
							}
					};
				gridView.Columns.Add(column);
			}
			#endregion
			
			//Create binding to the current controller
			Binding controllerBinding = new Binding()
				{
					Source = this,
					Path = new PropertyPath("Controller"),
					Mode = BindingMode.OneWay
				};
			
			//Create binding to the selected item (reversed binding used for the sake of simplicity)
			Binding selecteditemBinding = new Binding()
				{
					Source = this.Controller,
					Path = new PropertyPath("SelectedItem"),
					Mode = BindingMode.OneWayToSource
				};
			EntitiesListView.SetBinding(ListView.SelectedItemProperty, selecteditemBinding);
			
			#region Context menu
			Style style = new Style(typeof (ListViewItem));
				
				ContextMenu contextMenu = new ContextMenu();
				
					MenuItem newMenuItem = new MenuItem()
						{
							Command = InvoiceManagerCommands.New,
							Icon = new Image()
								{
									Source = new BitmapImage(new Uri("/Resources/new.png", UriKind.Relative)),
									Width = 20,
									Height = 20
								}
						};
					newMenuItem.SetBinding(MenuItem.CommandParameterProperty, controllerBinding);
				contextMenu.Items.Add(newMenuItem);
				
					MenuItem editMenuItem = new MenuItem()
						{
							Command = InvoiceManagerCommands.Edit,
							Icon = new Image()
								{
									Source = new BitmapImage(new Uri("/Resources/Edit.png", UriKind.Relative)),
									Width = 20,
									Height = 20
								}
						};
					editMenuItem.SetBinding(MenuItem.CommandParameterProperty, controllerBinding);
				contextMenu.Items.Add(editMenuItem);
				
					MenuItem deleteMenuItem = new MenuItem()
						{
							Command = InvoiceManagerCommands.Delete,
							Icon = new Image()
								{
									Source = new BitmapImage(new Uri("/Resources/Delete.png", UriKind.Relative)),
									Width = 20,
									Height = 20
								}
						};
					deleteMenuItem.SetBinding(MenuItem.CommandParameterProperty, controllerBinding);
				contextMenu.Items.Add(deleteMenuItem);
				
			style.Setters.Add(new Setter(ListViewItem.ContextMenuProperty, contextMenu));
			Resources.Add(typeof (ListViewItem), style);
			#endregion
			
		}
Ejemplo n.º 24
0
        public ShellController(IMessageService messageService, IPresentationService presentationService, IEntityController entityController, CountryController countryController, ProvinceController provinceController, CityController cityController,
                               IViewService viewService, Lazy <ShellViewModel> shellViewModel)
        {
            presentationService.InitializeCultures();

            _messageService     = messageService;
            _entityController   = entityController;
            _countryController  = countryController;
            _provinceController = provinceController;
            _cityController     = cityController;
            _viewService        = viewService;
            _shellViewModel     = shellViewModel;
            _exitCommand        = new DelegateCommand(Close);
        }
Ejemplo n.º 25
0
 public Mover(IEntityController entityController)
 {
     _navMeshAgent = entityController.transform.GetComponent <NavMeshAgent>();
     _targeter     = entityController.transform.GetComponent <Targeter>();
 }
        public void Setup()
        {
            this.hotelController       = new HotelController();
            this.bookingController     = new BookingController();
            this.customerController    = new CustomerController();
            this.serviceController     = new ServiceController();
            this.roomTypeController    = new RoomTypeController();
            this.roomController        = new RoomController();
            this.billingController     = new BillingEntityController();
            this.pricingListController = new PricingListController();

            this.hotel = new Hotel()
            {
                Name    = "Alex Hotel",
                Address = "Syntagma",
                TaxId   = "AH123456",
                Manager = "Alex",
                Phone   = "2101234567",
                Email   = "*****@*****.**"
            };
            this.hotel = this.hotelController.CreateOrUpdateEntity(this.hotel);

            this.roomType = new RoomType()
            {
                Code    = "TreeBed",
                View    = View.MountainView,
                BedType = BedType.ModernCot,
                Tv      = true,
                WiFi    = true,
                Sauna   = true
            };
            this.roomType = this.roomTypeController.CreateOrUpdateEntity(this.roomType);

            this.room = new Room()
            {
                HotelId    = this.hotel.Id,
                Code       = "Alex Hotel 123",
                RoomTypeId = this.roomType.Id
            };
            this.room = this.roomController.CreateOrUpdateEntity(this.room);

            this.service = new Service()
            {
                HotelId     = this.hotel.Id,
                Code        = "AHBF",
                Description = "Breakfast Alex Hotel"
            };
            this.service = this.serviceController.CreateOrUpdateEntity(this.service);

            this.servicePricingList = new PricingList()
            {
                BillableEntityId     = this.service.Id,
                TypeOfBillableEntity = TypeOfBillableEntity.Service,
                ValidFrom            = DateTime.Now,
                ValidTo = Convert.ToDateTime("31/01/2017"),
                VatPrc  = 13
            };
            this.servicePricingList = this.pricingListController.CreateOrUpdateEntity(this.servicePricingList);

            this.roomTypePricingList = new PricingList()
            {
                BillableEntityId     = this.roomType.Id,
                TypeOfBillableEntity = TypeOfBillableEntity.RoomType,
                ValidFrom            = DateTime.Now,
                ValidTo = Convert.ToDateTime("31/01/2017").Date,
                VatPrc  = 13
            };
            this.roomTypePricingList = this.pricingListController.CreateOrUpdateEntity(this.roomTypePricingList);

            this.customer = new Customer()
            {
                Name     = "Thodoris",
                Surname  = "Kapiris",
                TaxId    = "TK1234567",
                IdNumber = "AB1234567",
                Address  = "Monasthraki",
                Email    = "*****@*****.**",
                Phone    = "2107654321"
            };
            this.customer = this.customerController.CreateOrUpdateEntity(this.customer);

            this.booking = new Booking()
            {
                CustomerId  = this.customer.Id,
                RoomId      = this.room.Id,
                From        = DateTime.Now,
                To          = Convert.ToDateTime("31/01/2017"),
                SystemPrice = 12,
                AgreedPrice = 12,
                Status      = Status.New,
                Comments    = "Very good!!"
            };
            this.booking = this.bookingController.CreateOrUpdateEntity(this.booking);

            this.billing = new Billing()
            {
                BookingId        = this.booking.Id,
                PriceForRoom     = this.booking.AgreedPrice,
                PriceForServices = 150,
                TotalPrice       = 12150,
                Paid             = true
            };
            this.billing = this.billingController.CreateOrUpdateEntity(this.billing);
        }
Ejemplo n.º 27
0
 public TerminalAction(IEntityController parent, string name)
 {
     _parent = parent;
     _name   = name;
 }
Ejemplo n.º 28
0
 public CharacterAnimation(IEntityController entity)
 {
     _animator = entity.transform.GetComponent <Animator>();
 }
Ejemplo n.º 29
0
 public DefaultPipeline(IEntityController controller, IContext context)
 {
     _context     = (PipelineContext)context;
     _controller  = controller;
     Transformers = new List <ITransform>();
 }
Ejemplo n.º 30
0
 public void Init(ITriggerEntity owner, IEntityController entityController)
 {
     _owner             = owner;
     _entitiesAtTrigger = new HashSet <BaseEntity>();
     _entityController  = entityController;
 }
Ejemplo n.º 31
0
 public AddLocationViewModel(IEntityController <Locatie> locatieController)
 {
     this.locatieController = locatieController;
 }
Ejemplo n.º 32
0
        /// <summary>
        /// The delete service button_ on click.
        /// </summary>
        /// <param name="sender">
        /// The sender.
        /// </param>
        /// <param name="e">
        /// The e.
        /// </param>
        protected void DeleteServiceButton_OnClick(object sender, EventArgs e)
        {
            this.serviceController = new ServiceController();

            var errorlabel = this.Master?.FindControl("form1").FindControl("divErrorMessage") as Label;

            if (errorlabel != null)
            {
                errorlabel.Text = string.Empty;
                if (this.ServiceGridView.VisibleRowCount == 0)
                {
                    errorlabel.Text = $"There are no Services to delete";
                }

                var firstRun = true;
                this.Session["errorMessage"] = string.Empty;

                var selectedRowKeys = this.ServiceGridView.GetSelectedFieldValues(
                    this.ServiceGridView.KeyFieldName,
                    "Code");
                if ((selectedRowKeys == null) || (selectedRowKeys.Count == 0))
                {
                    errorlabel.Text = @"Please select a Service first to delete";
                    return;
                }

                foreach (object[] row in selectedRowKeys)
                {
                    var id          = Convert.ToInt32(row[0]);
                    var serviceCode = row[1].ToString();
                    var serviceTemp = new Service()
                    {
                        Id = id, Code = serviceCode
                    };
                    try
                    {
                        this.serviceController.DeleteEntity(serviceTemp);
                    }
                    catch (ArgumentNullException)
                    {
                        if (firstRun)
                        {
                            errorlabel.Text = $"You can't delete ";
                            firstRun        = false;
                        }

                        errorlabel.Text += $"'{serviceTemp.Code}',";
                        this.ServiceGridView.Selection.UnselectRowByKey(id);
                    }
                    catch (SqlException exp)
                    {
                        errorlabel.Text = $"Sql error: " + exp.Message;
                    }

                    errorlabel.Text = errorlabel.Text.TrimEnd(' ', ',');
                    this.Session["errorMessage"] = errorlabel.Text;
                    var hotel = this.Session["Hotel"] as Hotel;
                    this.ServiceGridView.DataSource = hotel != null
                                               ? this.serviceController.RefreshEntities().Where(x => x.HotelId == hotel.Id)
                                               : this.serviceController.RefreshEntities();

                    this.ServiceGridView.DataBind();
                }
            }
        }
        /// <summary>
        /// The bt ok click.
        /// </summary>
        /// <param name="sender">
        /// The sender.
        /// </param>
        /// <param name="e">
        /// The e.
        /// </param>
        protected void BtOkClick(object sender, EventArgs e)
        {
            var errorlabel      = this.Master?.FindControl("form1").FindControl("divErrorMessage") as Label;
            var selectedRowKeys = this.BookingListGridview.GetSelectedFieldValues(
                this.BookingListGridview.KeyFieldName,
                "Id");

            if ((selectedRowKeys == null) || (selectedRowKeys.Count == 0))
            {
                return;
            }
            else
            {
                try
                {
                    foreach (object[] row in selectedRowKeys)
                    {
                        var id = Convert.ToInt32(row[0]);

                        this.pricingListEntityController = new PricingListController();
                        this.customerEntityController    = new CustomerController();

                        var booking = this.bookingEntityController.GetEntity(id);
                        this.bookingIdTextBox.Text       = id.ToString();
                        this.customerSurnameTextBox.Text =
                            this.customerEntityController.GetEntity(booking.CustomerId).Surname;
                        this.priceValueTextBox.Text   = booking.AgreedPrice.ToString(CultureInfo.InvariantCulture);
                        this.customerNameTextBox.Text = this.customerEntityController.GetEntity(booking.CustomerId).Name;
                        this.fromTextBox.Text         = booking.From.ToShortDateString().ToString(CultureInfo.InvariantCulture);
                        this.toTextBox.Text           = booking.To.ToShortDateString().ToString(CultureInfo.InvariantCulture);
                        this.roomTextBox.Text         = booking.Room.Code;
                        this.billing = new Billing {
                            PriceForRoom = booking.AgreedPrice
                        };
                        var servicesList    = this.serviceController.RefreshEntities();
                        var billingServices = new List <BillingService>();

                        foreach (var item in servicesList)
                        {
                            if (item.HotelId == booking.Room.HotelId)
                            {
                                try
                                {
                                    this.price = this.pricingListEntityController.ServicePricing(booking.From, item.Id);
                                }
                                catch (ArgumentNullException ex)
                                {
                                    this.price = 0;
                                }
                                catch (NullReferenceException ex)
                                {
                                    this.price = 0;
                                }

                                {
                                    var myBillingService = new BillingService
                                    {
                                        Service  = item,
                                        Price    = this.price,
                                        Quantity = 0
                                    };
                                    billingServices.Add(myBillingService);
                                }
                            }
                        }

                        this.myBillingServices =
                            billingServices.Select(
                                item =>
                                new BillingServiceWithServiceDescription
                        {
                            Id           = item.Service.Id,
                            Description  = item.Service.Description,
                            Quantity     = item.Quantity,
                            PricePerUnit = item.Price,
                            TotalPrice   = 0
                        }).ToList();

                        this.Session["billingServiceWithServiceDescription"] = this.myBillingServices;
                        this.BillingListGridView.DataSource = this.myBillingServices;
                        this.BillingListGridView.DataBind();
                        this.BillingListGridView.Visible   = true;
                        this.saveButton.Enabled            = true;
                        this.totalSumTextBox.Visible       = true;
                        this.totalSumTextBox.ReadOnly      = true;
                        this.totalSumTextBox.Text          = this.priceValueTextBox.Text;
                        this.paidCheckBox.Visible          = true;
                        this.sumOfServicesTextBox.Visible  = true;
                        this.sumOfServicesTextBox.ReadOnly = true;
                        this.paidLabel.Visible             = true;
                        this.totalSumLabel.Visible         = true;
                        this.sumOfServicesLabel.Visible    = true;
                    }
                }
                catch (SqlException ex)
                {
                    if (errorlabel != null)
                    {
                        errorlabel.Text = "Something went wrong with the database.Please check the connection string.";
                    }
                }
                catch (ArgumentNullException ex)
                {
                    if (errorlabel != null)
                    {
                        errorlabel.Text = "Couldn't create the current Billing";
                    }
                }
                catch (Exception ex)
                {
                    errorlabel.Text = ex.Message;
                }
            }
        }
		public ChangePasswordControl(IEntityController controller)
		{
			this.Controller = controller;
			InitializeComponent();
		}
        /// <summary>
        /// The page_ init.
        /// </summary>
        /// <param name="sender">
        /// The sender.
        /// </param>
        /// <param name="e">
        /// The e.
        /// </param>
        protected void Page_Init(object sender, EventArgs e)
        {
            var hotel      = this.Session["Hotel"] as Hotel;
            var errorlabel = this.Master?.FindControl("form1").FindControl("divErrorMessage") as Label;

            if (!this.IsPostBack)
            {
                this.myBillingServices = new List <BillingServiceWithServiceDescription>();
                this.Session["billingServiceWithServiceDescription"] = this.myBillingServices;
                this.BillingListGridView.Visible = false;
            }
            else
            {
                this.myBillingServices =
                    this.Session["billingServiceWithServiceDescription"] as List <BillingServiceWithServiceDescription>;
            }

            this.BillingListGridView.JSProperties["cp_text"]  = 0;
            this.BillingListGridView.JSProperties["cp_text2"] = 0;
            this.serviceController       = new ServiceController();
            this.bookingEntityController = new BookingController();
            try
            {
                this.BookingListGridview.DataSource = hotel != null?this.bookingEntityController.RefreshEntities().Where(x => x.Status == Status.Active && x.Room.HotelId == hotel.Id) : this.bookingEntityController.RefreshEntities();

                this.BookingListGridview.DataBind();
                this.BillingListGridView.DataSource = this.myBillingServices;
                this.BillingListGridView.DataBind();
            }
            catch (SqlException ex)
            {
                if (errorlabel != null)
                {
                    errorlabel.Text = "Something went wrong with the database.Please check the connection string.";
                }
            }
            catch (ArgumentNullException ex)
            {
                if (errorlabel != null)
                {
                    errorlabel.Text = "Couldn't create the current Billing";
                }
            }
            catch (Exception ex)
            {
                if (errorlabel != null)
                {
                    errorlabel.Text = ex.Message;
                }
            }

            this.saveButton.Enabled              = false;
            this.totalSumTextBox.Visible         = false;
            this.paidCheckBox.Visible            = false;
            this.sumOfServicesTextBox.Visible    = false;
            this.paidLabel.Visible               = false;
            this.totalSumLabel.Visible           = false;
            this.sumOfServicesLabel.Visible      = false;
            this.customerNameTextBox.ReadOnly    = true;
            this.customerSurnameTextBox.ReadOnly = true;
            this.roomTextBox.ReadOnly            = true;
            this.fromTextBox.ReadOnly            = true;
            this.fromTextBox.ReadOnly            = true;
            this.toTextBox.ReadOnly              = true;
            this.priceValueTextBox.ReadOnly      = true;
        }
 public void Setup()
 {
     _controller = new EntityController<EntityMock>();
     _entityNew = new EntityMock() { Name = "I'm new", Age = 1 };
     _entityClean = new EntityMock(_cleanId, true) { Name = "I'm clean", Age = 2 };
 }
        /// <summary>
        /// The save button_ click.
        /// </summary>
        /// <param name="sender">
        /// The sender.
        /// </param>
        /// <param name="e">
        /// The e.
        /// </param>
        protected void SaveButtonClick(object sender, EventArgs e)
        {
            var errorlabel = this.Master?.FindControl("form1").FindControl("divErrorMessage") as Label;

            this.billingEntityController        = new BillingEntityController();
            this.billingServiceEntityController = new BillingServiceEntityController();
            if (this.sumOfServicesTextBox.Text == string.Empty)
            {
                this.sumOfServicesTextBox.Text = 0.ToString();
                this.totalSumTextBox.Text      = this.priceValueTextBox.Text;
            }

            this.billing = new Billing
            {
                BookingId        = Convert.ToInt32(this.bookingIdTextBox.Text),
                PriceForRoom     = Convert.ToDouble(this.priceValueTextBox.Text),
                PriceForServices = Convert.ToDouble(this.sumOfServicesTextBox.Text),
                TotalPrice       = Convert.ToDouble(this.totalSumTextBox.Text),
                Paid             = this.paidCheckBox.Checked
            };

            try
            {
                this.billing = this.billingEntityController.CreateOrUpdateEntity(this.billing);
                var localBooking = this.bookingEntityController.GetEntity(this.billing.BookingId);
                localBooking.Status = Status.Billed;
                this.bookingEntityController.CreateOrUpdateEntity(localBooking);
            }
            catch (SqlException ex)
            {
                if (errorlabel != null)
                {
                    errorlabel.Text = "Couldn't create the current booking";
                }
            }
            catch (ArgumentNullException ex)
            {
                if (errorlabel != null)
                {
                    errorlabel.Text = "Couldn't create the current booking";
                }
            }
            catch (Exception ex)
            {
                if (errorlabel != null)
                {
                    errorlabel.Text = ex.Message;
                }
            }

            this.myBillingServices =
                this.Session["billingServiceWithServiceDescription"] as List <BillingServiceWithServiceDescription>;
            if (this.myBillingServices != null && this.myBillingServices.Count > 0)
            {
                foreach (var item in this.myBillingServices)
                {
                    if (item.Quantity > 0)
                    {
                        this.billingService = new BillingService
                        {
                            BillingId = this.billing.Id,
                            ServiceId = item.Id,
                            Quantity  = item.Quantity,
                            Price     = item.PricePerUnit
                        };
                        try
                        {
                            this.billingServiceEntityController.CreateOrUpdateEntity(this.billingService);
                        }
                        catch (SqlException ex)
                        {
                            if (errorlabel != null)
                            {
                                errorlabel.Text = "Couldn't create the current billing service";
                            }
                        }
                        catch (ArgumentNullException ex)
                        {
                            if (errorlabel != null)
                            {
                                errorlabel.Text = "Couldn't create the current billing service";
                            }
                        }
                        catch (Exception ex)
                        {
                            if (errorlabel != null)
                            {
                                errorlabel.Text = ex.Message;
                            }
                        }
                    }
                }
            }

            this.Response.Redirect("BillingListWebForm.aspx", true);
        }