private void btnSave_Click(object sender, RoutedEventArgs e)
        {
            //fer validacions.....
            //@TODO
            if (EstatForm != Estat.NOU)
            {
                // estic modificant

                ActorDB aDB = (ActorDB)dtgActors.SelectedItem;
                if (aDB != null)
                {
                    aDB.First_name  = Actor.First_name;
                    aDB.Last_name   = Actor.Last_name;
                    aDB.Last_update = Actor.Last_update.DateTime;
                    aDB.Update();
                }
            }
            else
            {
                // estic en el cas de Nou actor
                ActorDB aBD = new ActorDB(-1, Actor.First_name, Actor.Last_name, Actor.Last_update.DateTime, 0);
                aBD.Insert();
                //this.llistaActors.Add(aBD);
                actualitzaPaginacioDesDelFormulari();
            }
            EstatForm = Estat.SENSE_CANVIS;
        }
示例#2
0
        /// <summary>
        /// Connect to the interserver to access the remote database objects.
        /// </summary>
        public static bool StartDatabase()
        {
            switch (lcfg.ifSQL)
            {
            case 0:
                charDB = new db4oCharacterDB(lcfg.DBHost, lcfg.DBPort, lcfg.DBUser, lcfg.DBPass);
                break;

            case 1:
                charDB = new MySQLCharacterDB(lcfg.DBHost, lcfg.DBPort, lcfg.DBName, lcfg.DBUser, lcfg.DBPass);
                break;

            case 2:
                charDB = new DatCharacterDB(lcfg.WorldName, lcfg.DBHost);
                break;

            case 3:
                charDB = new MSSQLCharacterDB(lcfg.DBHost, lcfg.DBPort, lcfg.DBName, lcfg.DBUser, lcfg.DBPass);
                break;
            }
            try
            {
                charDB.Connect();
            }
            catch (Exception)
            {
                return(false);
            }
            return(true);
        }
 public ActorViewModel(ActorDB actor)
 {
     this.Actor_id    = actor.Actor_id;
     this.Last_name   = actor.Last_name;
     this.First_name  = actor.First_name;
     this.Last_update = actor.Last_update;
 }
示例#4
0
 /// <summary>
 /// Connect to the interserver to access the remote database objects.
 /// </summary>
 public static bool StartDatabase()
 {
     switch (lcfg.ifSQL)
     {
         case 0:
             charDB = new db4oCharacterDB(lcfg.DBHost, lcfg.DBPort, lcfg.DBUser, lcfg.DBPass);
             break;
         case 1:
             charDB = new MySQLCharacterDB(lcfg.DBHost, lcfg.DBPort, lcfg.DBName, lcfg.DBUser, lcfg.DBPass);
             break;
         case 2:
             charDB = new DatCharacterDB(lcfg.WorldName, lcfg.DBHost);
             break;
         case 3:
             charDB = new MSSQLCharacterDB(lcfg.DBHost, lcfg.DBPort, lcfg.DBName, lcfg.DBUser, lcfg.DBPass);
             break;
     }
     try
     {
         charDB.Connect();
     }
     catch (Exception)
     {
         return false;
     }
     return true;
 }
示例#5
0
        public static bool StartWorldDatabase()
        {
            wcfg = new WorldConfig();

            foreach (WorldConfig.World world in wcfg.Worlds.Values)
            {
                if (!LoginServer.charServerList.ContainsKey(world.ID))
                {
                    ActorDB newCharDB = null;;
                    switch (world.ifSQL)
                    {
                    case 0:
                        newCharDB = new db4oCharacterDB(world.DBHost, world.DBPort, world.DBUser, world.DBPass);
                        break;

                    case 1:
                        newCharDB = new MySQLCharacterDB(world.DBHost, world.DBPort, world.DBName, world.DBUser, world.DBPass);
                        break;

                    case 2:
                        newCharDB = new DatCharacterDB(world.Name, world.DBHost);
                        break;

                    case 3:
                        newCharDB = new MSSQLCharacterDB(world.DBHost, world.DBPort, world.DBName, world.DBUser, world.DBPass);
                        break;
                    }

                    try
                    {
                        newCharDB.Connect();
                    }
                    catch (Exception ex)
                    {
                        switch (world.ifSQL)
                        {
                        case 0:
                            Console.WriteLine("Error: No se puede conectar a la base de datos " + world.DBHost + ":" + world.DBPort + " con el username: "******" y pass: "******"Error: No se puede conectar a la base de datos " + world.DBHost + ":" + world.DBPort + " con el username: "******" y pass: "******"ERROR, no se puede anadir el mundo: " + world.Name + " con la ID: " + world.ID + " razon: ya hay una ID igual");
                    return(false);
                }
            }

            return(true);
        }
示例#6
0
        public static bool StartWorldDatabase()
        {
            wcfg = new WorldConfig();

            foreach (WorldConfig.World world in wcfg.Worlds.Values)
            {
                if (!LoginServer.charServerList.ContainsKey(world.ID))
                {
                    ActorDB newCharDB = null;;
                    switch (world.ifSQL)
                    {
                    case 0:
                        newCharDB = new db4oCharacterDB(world.DBHost, world.DBPort, world.DBUser, world.DBPass);
                        break;

                    case 1:
                        newCharDB = new MySQLCharacterDB(world.DBHost, world.DBPort, world.DBName, world.DBUser, world.DBPass);
                        break;

                    case 2:
                        newCharDB = new DatCharacterDB(world.Name, world.DBHost);
                        break;

                    case 3:
                        newCharDB = new MSSQLCharacterDB(world.DBHost, world.DBPort, world.DBName, world.DBUser, world.DBPass);
                        break;
                    }

                    try
                    {
                        newCharDB.Connect();
                    }
                    catch (Exception ex)
                    {
                        switch (world.ifSQL)
                        {
                        case 0:
                            Console.WriteLine("Error: Cannot connect to world db server " + world.DBHost + ":" + world.DBPort + " with username: "******" and pass: "******"Error: Cannot connect to world db server " + world.DBHost + ":" + world.DBPort + " with username: "******" and pass: "******"ERROR, cannot add world: " + world.Name + " with ID: " + world.ID + " reason: worldID is already taken");
                    return(false);
                }
            }

            return(true);
        }
示例#7
0
 //int serverID;
 public CharServer(string worldName, byte mPing, byte mPlayerCount, byte worldID, ActorDB charDB)
 {
     this.worldname = worldName;
     this.ping = (Status)mPing;
     this.playerCount = mPlayerCount;
     this.worldID = worldID;
     this.charDB = charDB;
     this.mapServers = new List<MapServer>();
 }
示例#8
0
        //int serverID;

        public CharServer(string worldName, byte mPing, byte mPlayerCount, byte worldID, ActorDB charDB)
        {
            this.worldname   = worldName;
            this.ping        = (Status)mPing;
            this.playerCount = mPlayerCount;
            this.worldID     = worldID;
            this.charDB      = charDB;
            this.mapServers  = new List <MapServer>();
        }
示例#9
0
    // Use this for initialization
    void Awake()
    {
        photonView  = GetComponent <PhotonView>();
        _actionDB   = ActionDB.Instance;
        _actorDB    = ActorDB.Instance;
        _trendingDB = TrendingDB.Instance;

        Instance = this;
        Debug.Log("DB ready");
    }
示例#10
0
文件: World.cs 项目: rdavydov/d3sharp
        public void Reveal(Hero hero)
        {
            bool found = hero.RevealedWorlds.Contains(this);

            if (!found)
            {
                //reveal world to player
                hero.InGameClient.SendMessage(new RevealWorldMessage()
                {
                    Id     = 0x0037,
                    Field0 = WorldID,
                    Field1 = WorldSNO,
                });
                hero.RevealedWorlds.Add(this);
            }

            //player enters world
            hero.InGameClient.SendMessage(new EnterWorldMessage()
            {
                Id     = 0x0033,
                Field0 = hero.Position,
                Field1 = WorldID,
                Field2 = WorldSNO,
            });

            //just reveal the whole thing to the player for now
            foreach (var scene in Scenes)
            {
                scene.Reveal(hero);
            }

            if (!found)
            {
                //reveal actors
                foreach (var actor in Actors)
                {
                    if (ActorDB.isBlackListed(actor.SnoId))
                    {
                        continue;
                    }
                    if (ActorDB.isNPC(actor.SnoId))
                    {
                        continue;
                    }
                    //actor.Reveal(hero);
                }

                //reveal portals
                Logger.Info("Revealing portals for world " + WorldID);
                foreach (Portal portal in Portals)
                {
                    portal.Reveal(hero);
                }
            }
        }
 private void dtgActors_SelectionChanged(object sender, SelectionChangedEventArgs e)
 {
     crearActorViewModel((ActorDB)dtgActors.SelectedItem);
     btnDelete.IsEnabled = dtgActors.SelectedItem != null;
     if (dtgActors.SelectedItem != null)
     {
         ActorDB a = (ActorDB)dtgActors.SelectedItem;
         ObservableCollection <FilmDB> films = FilmDB.getFilms(a.Actor_id);
         dtgFilms.ItemsSource = films;
     }
 }
        private void actualitzaPaginacio(string v1, string v2, DateTime dateTime, int itemsPerPagina, int numPagina)
        {
            int numeroActors = ActorDB.getNumeroActors(v1, v2, dateTime);

            this.totalPagines = (int)(Math.Ceiling((double)numeroActors / itemsPerPagina));

            llistaActors = ActorDB.getActors(v1,
                                             v2,
                                             dateTime, itemsPerPagina, numPagina);
            dtgActors.ItemsSource = llistaActors;
        }
 private void crearActorViewModel(ActorDB lactor)
 {
     if (lactor != null)
     {
         Actor = new ActorViewModel(lactor);
     }
     else
     {
         Actor = new ActorViewModel();
     }
     // Ens registrem  a l'event property changed
     // Si l'objecte Actor és modificat (via binding de la interfície
     // gràfica ), ens avisarà.
     Actor.PropertyChanged += Actor_PropertyChanged;
 }
示例#14
0
 public static bool StartDatabase()
 {
     try
     {
         charDB = new MySQLActorDB(Configuration.Instance.DBHost, Configuration.Instance.DBPort,
                                   Configuration.Instance.DBName, Configuration.Instance.DBUser, Configuration.Instance.DBPass);
         accountDB = new MySQLAccountDB(Configuration.Instance.DBHost, Configuration.Instance.DBPort,
                                        Configuration.Instance.DBName, Configuration.Instance.DBUser, Configuration.Instance.DBPass); charDB.Connect();
         accountDB.Connect();
         return(true);
     }
     catch (Exception)
     {
         return(false);
     }
 }
        private async void btnDelete_Click(object sender, RoutedEventArgs e)
        {
            if (dtgActors.SelectedItem != null)
            {
                ActorDB a = (ActorDB)dtgActors.SelectedItem;
                int     numeroPelisActor = a.getNumeroDePelis();
                Boolean esborra          = false;
                if (numeroPelisActor > 0)
                {
                    ContentDialog deleteActorDialog = new ContentDialog
                    {
                        Title             = "Aquest actor té pel·lícules registrades al seu nom. ",
                        Content           = "Vol esborrar l'actor i totes les seves referències?",
                        PrimaryButtonText = "Esborrar",
                        CloseButtonText   = "Cancel·lar"
                    };

                    ContentDialogResult result = await deleteActorDialog.ShowAsync();

                    // Delete the file if the user clicked the primary button.
                    /// Otherwise, do nothing.
                    if (result == ContentDialogResult.Primary)
                    {
                        esborra = true;
                    }
                }
                else
                { // 0 pelis
                    esborra = true;
                }

                if (esborra)
                {
                    if (a.deleteStoredProcedure())//delete())
                    {
                        actualitzaPaginacioDesDelFormulari();
                    }
                }
            }
        }
示例#16
0
 public static bool StartDatabase()
 {
     try
     {
         charDB = new MySQLActorDB(Configuration.Instance.DBHost, Configuration.Instance.DBPort,
              Configuration.Instance.DBName, Configuration.Instance.DBUser, Configuration.Instance.DBPass);
         accountDB = new MySQLAccountDB(Configuration.Instance.DBHost, Configuration.Instance.DBPort,
             Configuration.Instance.DBName, Configuration.Instance.DBUser, Configuration.Instance.DBPass); charDB.Connect();
         accountDB.Connect();
         return true;
     }
     catch (Exception)
     {
         return false;
     }
 }