Exemple #1
0
        public override void OnResponse(NetState sender, RelayInfo info)
        {
            Mobile       from      = sender.Mobile;
            ClassOrb     c_orb     = null;
            ClassControl c_control = null;

            foreach (Item h in World.Items.Values)
            {
                if (h is ClassControl)
                {
                    c_control = h as ClassControl;
                }
            }

            foreach (Item i in World.Items.Values)
            {
                if (i is ClassOrb)
                {
                    c_orb = i as ClassOrb;
                    if (info.ButtonID == c_orb.ClassNumber)
                    {
                        c_control.C_Current = c_orb.ClassNumber;
                        from.SendGump(new ResSBGump2(from, c_orb));
                    }
                }
            }


            if (info.ButtonID == 0)
            {
            }
        }
Exemple #2
0
 private void completaSQL()
 {
     ClassControl.conectar();
     try
     {
         string        sql = "SELECT c.nome_cliente,c.email_cliente,c.username_cliente, c.estado_cliente FROM cliente AS c";
         NpgsqlCommand cmd = new NpgsqlCommand();
         cmd.CommandText = sql;
         cmd.Connection  = ClassControl.cn;
         NpgsqlDataReader dr_myAccount = cmd.ExecuteReader();
         if (dr_myAccount.Read())
         {
             txtContaNome.Text     = dr_myAccount[0].ToString();
             txtContaEmail.Text    = dr_myAccount[1].ToString();
             txtContaUsername.Text = dr_myAccount[2].ToString();
             txtContaEstado.Text   = dr_myAccount[3].ToString();
         }
     }
     catch (NpgsqlException Ex)
     {
         throw new ApplicationException(Ex.Message);
     }
     finally
     {
         ClassControl.desconectar();
     }
 }
Exemple #3
0
        private void txtSelecAno_Validating(object sender, CancelEventArgs e)
        {
            if (!String.IsNullOrWhiteSpace(txtSelecAno.Text) && txtSelecAno.Text != "____")
            {
                try
                {
                    string sql;
                    double ano = Convert.ToDouble(txtSelecAno.Text);
                    sql = "SELECT f.titulo_filme, f.descricao_filme, f.ano_filme, g.nome_gen FROM filmes AS f, genero AS g WHERE f.id_genero = g.id_genero AND f.ano_filme = " + ano;


                    DataTable dt = new DataTable();

                    dt = ClassControl.selecionarDataTable(sql);

                    dtgFilmesAno.DataSource = dt;
                }
                catch (Exception ex)
                {
                    /*MessageBox.Show("Ocorreu um erro ao processar o comando!" +
                     *              "\n\nMais informações:" + ex.Message,
                     *         "FlexNit",
                     *          MessageBoxButtons.OK,
                     *          MessageBoxIcon.Error);*/
                    throw new ApplicationException(ex.Message);
                }
            }
        }
        public void Persist(int agentId)
        {
            this.AgentId = agentId;
            String SqlInsert = ClassControl.SqlInsertFromObject(this, typeof(Office));

            DatabaseControl.SendInsert(SqlInsert);
        }
Exemple #5
0
        private static void OnLoadSpellbook(CommandEventArgs e)
        {
            Mobile       from      = e.Mobile;
            bool         r_active  = false;
            ClassControl c_control = null;

            foreach (Item i in World.Items.Values)
            {
                if (i is RCChest)
                {
                    r_active = true;
                }
            }


            if (r_active)
            {
                foreach (Item i in World.Items.Values)
                {
                    if (i is ClassControl)
                    {
                        c_control = i as ClassControl;
                    }
                }

                if (c_control.Loaded_Books == 20)
                {
                    from.SendMessage(0x35, "Cannot load anymore Spellbooks");
                }
                else
                {
                    from.Target = new SpellbookTarget();
                }
            }
        }
Exemple #6
0
        private static void OnAddClass(CommandEventArgs e)
        {
            Mobile       from      = e.Mobile;
            ClassControl c_control = null;
            bool         r_active  = false;

            foreach (Item i in World.Items.Values)
            {
                if (i is RCChest)
                {
                    r_active = true;
                }
            }

            if (r_active)
            {
                ClassOrb c_orb = new ClassOrb();

                foreach (Item i in World.Items.Values)
                {
                    if (i is ClassControl)
                    {
                        c_control = i as ClassControl;
                    }
                }

                if (c_control != null)
                {
                    c_orb.ClassNumber   = c_control.A_Classes + 1;
                    c_control.C_Current = c_orb.ClassNumber;
                }

                from.SendGump(new AddClassGump(from, c_orb));
            }
        }
Exemple #7
0
        public void Persist(int propertyId)
        {
            this.PropertyId = propertyId;
            String SqlInsert = ClassControl.SqlInsertFromObject(this, typeof(Address));

            DatabaseControl.SendInsert(SqlInsert);
        }
Exemple #8
0
        private void cmbGeneros_Validating(object sender, CancelEventArgs e)
        {
            if (!String.IsNullOrWhiteSpace(cmbGeneros.SelectedItem.ToString()))
            {
                try
                {
                    string sql;
                    int    gen = cmbGeneros.SelectedIndex;
                    sql = "SELECT f.titulo_filme, f.descricao_filme, f.ano_filme, g.nome_gen FROM filmes AS f, genero AS g WHERE f.id_genero = g.id_genero AND g.id_genero = " + gen;


                    DataTable dt = new DataTable();

                    dt = ClassControl.selecionarDataTable(sql);

                    dtgFilmesGen.DataSource = dt;
                }
                catch (Exception ex)
                {
                    /*MessageBox.Show("Ocorreu um erro ao processar o comando!" +
                     *              "\n\nMais informações:" + ex.Message,
                     *         "FlexNit",
                     *          MessageBoxButtons.OK,
                     *          MessageBoxIcon.Error);*/
                    throw new ApplicationException(ex.Message);
                }
            }
        }
Exemple #9
0
        private void btnCadCadastrar_Click(object sender, EventArgs e)
        {
            ClassControl.conectar();
            if (txtCadPwd.Text == txtCadConfirmPwd.Text)
            {
                NpgsqlCommand cmd = new NpgsqlCommand();
                cmd.Parameters.AddWithValue("@NameUser", txtCadNome.Text);
                cmd.Parameters.AddWithValue("@Username", txtCadUsername.Text);
                cmd.Parameters.AddWithValue("@email", txtCadEmail.Text);
                cmd.Parameters.AddWithValue("@UserLivingState", cmbCadEstado.SelectedItem);
                cmd.Parameters.AddWithValue("@userpwd", txtCadConfirmPwd.Text);
                try
                {
                    string sql = "SELECT * FROM cliente WHERE email_cliente = @email OR username_cliente = @Username";
                    cmd.CommandText = sql;
                    cmd.Connection  = ClassControl.cn;
                    NpgsqlDataReader dr       = cmd.ExecuteReader();
                    bool             Selected = dr.HasRows;

                    if (Selected)
                    {
                        MessageBox.Show("Username ou Email já em uso", "", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    }
                    else
                    {
                        try
                        {
                            dr.Close();
                            sql = "INSERT INTO CLIENTE(nome_cliente, email_cliente, username_cliente, estado_cliente, senha_cliente)" +
                                  " VALUES(@NameUser, @email, @Username, @UserLivingState, @userpwd)";

                            cmd.CommandText = sql;
                            cmd.Connection  = ClassControl.cn;
                            int rows = cmd.ExecuteNonQuery();
                            if (rows > 0)
                            {
                                MessageBox.Show("Cadastro realizado com sucesso", "", MessageBoxButtons.OK, MessageBoxIcon.Information);
                            }
                        }
                        catch (NpgsqlException ex)
                        {
                            throw new ApplicationException(ex.Message);
                        }
                    }
                }
                catch (NpgsqlException sqlError)
                {
                    throw new ApplicationException(sqlError.Message);
                }
                finally
                {
                    ClassControl.desconectar();
                }
            }
            else
            {
                MessageBox.Show("As senhas não conferem", "Senhas não conferem", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }
        }
Exemple #10
0
        private void carregaClientes()
        {
            string    sql = "SELECT c.nome_cliente,c.email_cliente,c.username_cliente, c.estado_cliente FROM cliente AS c";
            DataTable dt  = new DataTable();

            dt = ClassControl.selecionarDataTable(sql);

            dtgClientes.DataSource = dt;
        }
        public void Persist(int propertyId)
        {
            this.PhotoLocation = String.Concat(propertyId, "_", (Int32.Parse(SequenceId) - 1), ".png");
            this.PropertyId    = propertyId.ToString();

            String SqlInsert = ClassControl.SqlInsertFromObject(this, typeof(PropertyPhoto));

            DatabaseControl.SendInsert(SqlInsert);
        }
Exemple #12
0
        public void Persist(int propertyId)
        {
            this.PropertyId = propertyId;
            String SqlInsert = ClassControl.SqlInsertFromObject(this, typeof(AgentDetails));

            DatabaseControl.SendInsert(SqlInsert);

            this.Office.Persist(Int32.Parse(this.ID));
        }
Exemple #13
0
        private void btnLogin_Click(object sender, EventArgs e)
        {
            NpgsqlCommand cmd = new NpgsqlCommand();

            cmd.Parameters.AddWithValue("@EmailOrUser", txtLoginUsername.Text);
            cmd.Parameters.AddWithValue("@LoginPwd", txtLoginSenha.Text);

            try
            {
                ClassControl.conectar();
                string sqlLogin = "******" +
                                  "WHERE (email_admin =  @EmailOrUser OR user_admin = @EmailOrUser) AND senha_admin = @LoginPwd";
                cmd.CommandText = sqlLogin;
                cmd.Connection  = ClassControl.cn;
                NpgsqlDataReader dr      = cmd.ExecuteReader();
                bool             IsAdmin = dr.HasRows;
                if (IsAdmin)
                {
                    ClassControl.desconectar();
                    this.Hide();
                    frmMenuAdmin formAdmin = new frmMenuAdmin();
                    formAdmin.Show();
                }
                else
                {
                    dr.Close();
                    sqlLogin = "******" +
                               "WHERE (email_cliente = @EmailOrUser OR username_cliente = @EmailOrUser) AND senha_cliente = @LoginPwd";
                    cmd.CommandText = sqlLogin;
                    cmd.Connection  = ClassControl.cn;
                    dr = cmd.ExecuteReader();
                    bool logged = dr.HasRows;
                    if (logged)
                    {
                        ClassControl.desconectar();
                        MessageBox.Show("Login efetuado com sucesso!", "", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        this.Hide();
                        frmMenuUser formMenuUsuario = new frmMenuUser(txtLoginUsername.Text);
                        formMenuUsuario.ShowDialog();
                        this.Activate();
                        this.Show();
                    }
                    else
                    {
                        if (txtLoginUsername.Text != "admin" && txtLoginSenha.Text != "admin")
                        {
                            MessageBox.Show("Credencias erradas ou usuário inesistente", "Login Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        }
                        ClassControl.desconectar();
                    }
                }
            }
            catch (NpgsqlException ex)
            {
                throw new ApplicationException(ex.Message);
            }
        }
Exemple #14
0
        public override void OnResponse(NetState sender, RelayInfo info)
        {
            Mobile       from      = sender.Mobile;
            ClassOrb     c_orb     = null;
            ClassControl c_control = null;

            foreach (Item h in World.Items.Values)
            {
                if (h is ClassControl)
                {
                    c_control = h as ClassControl;
                }
            }

            foreach (Item i in World.Items.Values)
            {
                if (i is ClassOrb)
                {
                    c_orb = i as ClassOrb;
                    if (c_orb.ClassNumber == c_control.C_Current)
                    {
                        break;
                    }
                }
            }

            for (int i = 0; i < 20; i++)
            {
                if (info.ButtonID == i + 1)
                {
                    c_orb.Res_Books[i] = SpellbookType.Invalid;
                    from.SendGump(new ResSBGump(from));
                }
            }

            for (int i = 0; i < 20; i++)
            {
                if (info.ButtonID == i + 22)
                {
                    for (int j = 0; j < 20; j++)
                    {
                        if (c_orb.Res_Books[j] == SpellbookType.Invalid)
                        {
                            c_orb.Res_Books[j] = c_control.LoadBook[i];
                            break;
                        }
                    }
                    from.SendGump(new ResSBGump(from));
                }
            }

            if (info.ButtonID == 0)
            {
                from.SendGump(new ResSBGump(from));
            }
        }
        void classComponent_ClassChoiceChanged(object sender, EventArgs e)
        {
            ClassControl incoming = sender as ClassControl;

            if (incoming != null)
            {
                refreshButtons();
                refreshStatusText();
            }
        }
Exemple #16
0
        public Boolean Persist(int PropertyId)
        {
            this.PropertyId = PropertyId;
            this.Dimension  = this.Dimension.Replace("'", String.Empty);
            this.Level      = this.Level.Replace("'", String.Empty);

            String SqlInsert = ClassControl.SqlInsertFromObject(this, typeof(Room));

            return(DatabaseControl.SendInsert(SqlInsert));
        }
Exemple #17
0
        public override void OnResponse(NetState sender, RelayInfo info)
        {
            Mobile       from      = sender.Mobile;
            ClassOrb     c_orb     = null;
            RCCONTROL    rc        = null;
            ClassControl c_control = null;
            Bag          d_bag     = new Bag();

            foreach (Item h in World.Items.Values)
            {
                if (h is ClassControl)
                {
                    c_control = h as ClassControl;
                }
            }

            foreach (Item i in World.Items.Values)
            {
                if (i is ClassOrb)
                {
                    c_orb = i as ClassOrb;
                    if (info.ButtonID == c_orb.ClassNumber)
                    {
                        foreach (Item j in World.Items.Values)
                        {
                            if (j is RCCONTROL)
                            {
                                rc = j as RCCONTROL;
                                if (rc.P_Class == c_orb.ClassName)
                                {
                                    d_bag.AddItem(rc);
                                }
                            }
                        }
                        d_bag.Delete();
                        foreach (Item k in World.Items.Values)
                        {
                            if (k is Bag && k.Name == c_orb.ClassName + " Class")
                            {
                                k.Delete();
                                break;
                            }
                        }
                        c_control.A_Classes -= 1;
                        resetCOrbNums();
                        break;
                    }
                }
            }


            if (info.ButtonID == 0)
            {
            }
        }
Exemple #18
0
 private void btnCadCadastrarAdmin_Click(object sender, EventArgs e)
 {
     ClassControl.conectar();
     if (txtCadPwdAdmin.Text == txtCadConfirmPwdAdmin.Text)
     {
         NpgsqlCommand cmd = new NpgsqlCommand();
         cmd.Parameters.AddWithValue("@NomeAdmin", txtCadNomeAdmin.Text);
         cmd.Parameters.AddWithValue("@UserAdmin", txtCadUsernameAdmin.Text);
         cmd.Parameters.AddWithValue("@EmailAdmin", txtCadEmailAdmin.Text);
         cmd.Parameters.AddWithValue("@PwdAdmin", txtCadPwdAdmin.Text);
         try
         {
             string sql = "SELECT * FROM admin WHERE user_admin=@UserAdmin OR email_admin=@EmailAdmin";
             cmd.CommandText = sql;
             cmd.Connection  = ClassControl.cn;
             NpgsqlDataReader dr = cmd.ExecuteReader();
             bool             AdminAlreadyExists = dr.HasRows;
             if (AdminAlreadyExists)
             {
                 MessageBox.Show("Username ou Email Já cadastrados no sistema!!!", "", MessageBoxButtons.OK, MessageBoxIcon.Information);
             }
             else
             {
                 dr.Close();
                 sql = "INSERT INTO admin(nome_admin, user_admin, email_admin, senha_admin) " +
                       "VALUES (@NomeAdmin,@UserAdmin,@EmailAdmin,@PwdAdmin)";
                 try
                 {
                     cmd.CommandText = sql;
                     cmd.Connection  = ClassControl.cn;
                     int rows = cmd.ExecuteNonQuery();
                     if (rows > 0)
                     {
                         MessageBox.Show("Administrador Cadastrado com sucesso!!!", "", MessageBoxButtons.OK, MessageBoxIcon.Information);
                     }
                 }
                 catch (NpgsqlException ex)
                 {
                     throw new ApplicationException(ex.Message);
                 }
             }
         }catch (NpgsqlException ex)
         {
             throw new ApplicationException(ex.Message);
         }
         finally
         {
             ClassControl.desconectar();
         }
     }
     else
     {
         MessageBox.Show("Senhas não conferem", "", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
Exemple #19
0
        protected override void OnTarget(Mobile from, object targeted)
        {
            ClassControl c_control = null;
            bool         isLoaded  = false;

            foreach (Item i in World.Items.Values)
            {
                if (i is ClassControl)
                {
                    c_control = i as ClassControl;
                }
            }

            if (from.Name == null)
            {
                from.SendMessage("Your name is not valid fix it now");
                return;
            }

            if (targeted is Spellbook)
            {
                Spellbook m_book = (Spellbook)targeted;

                for (int i = 0; i < 20; i++)
                {
                    if (m_book.SpellbookType == c_control.LoadBook[i])
                    {
                        isLoaded = true;
                        break;
                    }
                }


                if (isLoaded)
                {
                    from.SendMessage(0x35, "That Type of Spellbook has already been loaded");
                }

                else
                {
                    c_control.LoadBook[c_control.Loaded_Books] = m_book.SpellbookType;
                    c_control.Loaded_Books += 1;
                    from.SendMessage(6, m_book.SpellbookType + " Spellbook Loaded");
                    m_book.Delete();
                }
            }
            else
            {
                from.SendMessage(0x35, "That is not a Spellbook");
            }
        }
Exemple #20
0
        private void btnCadCadastrarFilme_Click(object sender, EventArgs e)
        {
            ClassControl.conectar();
            NpgsqlCommand cmd = new NpgsqlCommand();

            cmd.Parameters.AddWithValue("@NomeFilme", txtNomeFilme.Text);
            cmd.Parameters.AddWithValue("@DescricaoFilme", txtDescricaoFilme.Text);
            cmd.Parameters.AddWithValue("@AnoFilme", Convert.ToInt32(mskAnoFilme.Text));
            cmd.Parameters.AddWithValue("@GenFilme", cmbGeneroFilme.SelectedItem);
            cmd.Connection = ClassControl.cn;
            try
            {
                string sql = "SELECT * FROM filmes WHERE titulo_filme = @NomeFilme";
                cmd.CommandText = sql;
                NpgsqlDataReader dr = cmd.ExecuteReader();
                if (dr.HasRows)
                {
                    MessageBox.Show("Filme já cadastrado", "", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
                else
                {
                    dr.Close();
                    NpgsqlDataReader dr2;
                    string           sql2 = "SELECT id_genero FROM genero WHERE nome_gen = @GenFilme";
                    cmd.CommandText = sql2;
                    dr2             = cmd.ExecuteReader();
                    if (dr2.Read())
                    {
                        int id_gen = Convert.ToInt32(dr2["id_genero"]);
                        cmd.Parameters.AddWithValue("@idGenFilme", id_gen);
                    }
                    dr2.Close();
                    sql = "INSERT INTO filmes(titulo_filme,descricao_filme, ano_filme, id_genero)" +
                          " VALUES(@NomeFilme, @DescricaoFilme, @AnoFilme, @idGenFilme)";
                    cmd.CommandText = sql;
                    int rows = cmd.ExecuteNonQuery();
                    if (rows > 0)
                    {
                        MessageBox.Show("Filme adicionado com sucesso", "", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    }
                }
            }
            catch (NpgsqlException ex)
            {
                throw new ApplicationException(ex.Message);
            }
            finally
            {
                ClassControl.desconectar();
            }
        }
        public Int32 Persist()
        {
            this.AnalyticsClick = String.Empty;
            this.AnalyticsView  = String.Empty;
            this.PublicRemarks  = this.PublicRemarks.Replace("'", String.Empty);

            String SqlInsert = ClassControl.SqlInsertFromObject(this, typeof(PropertyDetails));

            //Console.WriteLine(String.Empty);
            //Console.WriteLine(SqlInsert);
            //Console.WriteLine(String.Empty);

            DatabaseControl.SendInsert(SqlInsert);

            return(Int32.Parse(this.ID.ToString()));
        }
Exemple #22
0
        private void btnCadastrarGen_Click(object sender, EventArgs e)
        {
            ClassControl.conectar();
            NpgsqlCommand cmd = new NpgsqlCommand();

            cmd.Parameters.AddWithValue("@GenFilme", txtGenFilme.Text);
            cmd.Connection = ClassControl.cn;
            try
            {
                string sql = "SELECT * FROM genero WHERE nome_gen = @GenFilme";
                cmd.CommandText = sql;
                NpgsqlDataReader dr           = cmd.ExecuteReader();
                bool             GenRegistred = dr.HasRows;
                if (GenRegistred)
                {
                    MessageBox.Show("Genero já cadastrado", "", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
                else
                {
                    try
                    {
                        dr.Close();
                        sql             = "INSERT INTO genero(nome_gen) VALUES(@GenFilme)";
                        cmd.CommandText = sql;
                        int Registrou = cmd.ExecuteNonQuery();
                        if (Registrou > 0)
                        {
                            MessageBox.Show("Genero cadastrado com sucesso!", "", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        }
                    }catch (NpgsqlException ex)
                    {
                        throw new ApplicationException(ex.Message);
                    }
                }
            }catch (NpgsqlException ex)
            {
                throw new ApplicationException(ex.Message);
            }
            finally
            {
                ClassControl.desconectar();
            }
        }
Exemple #23
0
        public ResSBGump(Mobile from)
            : base(20, 30)
        {
            m_From = from;
            ClassOrb     c_orb     = null;
            ClassControl c_control = null;
            int          h         = 60;

            foreach (Item i in World.Items.Values)
            {
                if (i is ClassControl)
                {
                    c_control = i as ClassControl;
                }
            }

            AddPage(0);
            AddBackground(0, 0, 340, (c_control.A_Classes * 25) + 80, 5054);

            AddImageTiled(10, 10, 320, 23, 0x52);
            AddImageTiled(11, 11, 318, 23, 0xBBC);

            AddLabel(100, 11, 0, "Race/Class System");

            AddLabel(30, 34, 0, "Restrict Spellbook from which Class?");

            foreach (Item i in World.Items.Values)
            {
                if (i is ClassOrb)
                {
                    c_orb = i as ClassOrb;
                    if (c_orb.Activated)
                    {
                        AddButton(11, h, 0x15E3, 0x15E7, c_orb.ClassNumber, GumpButtonType.Reply, 1);
                        AddLabel(30, h - 1, 0, c_orb.ClassName);
                        h += 25;
                    }
                }
            }
        }
Exemple #24
0
        private void CarregaComboBoxGen()
        {
            ClassControl.conectar();
            string        sql = "SELECT COUNT(*) FROM genero";
            NpgsqlCommand cmd = new NpgsqlCommand(sql, ClassControl.cn);

            sql             = "SELECT nome_gen FROM genero";
            cmd.CommandText = sql;
            NpgsqlDataReader dr = cmd.ExecuteReader();

            if (dr.HasRows)
            {
                cmbGeneros.Items.Add("---");
                while (dr.Read())
                {
                    for (int i = 0; i < dr.FieldCount; i++)
                    {
                        cmbGeneros.Items.Add(dr.GetString(i));
                    }
                }
            }
            dr.Close();
        }
 private void initializeUserControls()
 {
     introComponent                = new IntroControl(WM);
     raceComponent                 = new RaceControl(WM);
     alignmentComponent            = new AlignmentControl(WM);
     raceComponent.SubraceChanged += new EventHandler(raceComponent_SubraceChanged);
     ageComponent        = new AgeControl(WM);
     bodyComponent       = new BodyControl(WM);
     appearanceComponent = new AppearanceControl(WM);
     appearanceComponent.AppearanceChanged += new EventHandler(appearanceComponent_AppearanceChanged);
     classComponent = new ClassControl(WM);
     classComponent.ClassChanged       += new EventHandler(classComponent_ClassChanged);
     classComponent.ClassChoiceChanged += new EventHandler(classComponent_ClassChoiceChanged);
     backgroundComponent = new BackgroundControl(WM);
     abilityComponent    = new AbilityControl(WM);
     abilityComponent.AbilityAssigned      += new EventHandler(abilityComponent_AbilityAssigned);
     abilityComponent.AbilityBonusAssigned += new EventHandler(abilityComponent_AbilityBonusAssigned);
     languageComponent = new LanguageControl(WM);
     languageComponent.LanguageSelectionChanged += new EventHandler(languageComponent_LanguageSelectionChanged);
     skillComponent              = new SkillControl(WM);
     skillComponent.SkillChosen += new EventHandler(skillComponent_SkillChosen);
     equipmentComponent          = new EquipmentControl(WM);
     equipmentComponent.EquipmentSelectionChanged += new EventHandler(equipmentComponent_EquipmentSelectionChanged);
     spellComponent              = new SpellControl(WM);
     spellComponent.SpellChosen += new EventHandler(spellComponent_SpellChosen);
     extraRaceChoiceComponent    = new ExtraRaceChoiceControl(WM);
     extraRaceChoiceComponent.ExtraRaceChoiceChanged += new EventHandler(extraRaceChoiceComponent_ExtraRaceChoiceChanged);
     extraClassChoiceComponent = new ExtraClassChoiceControl(WM);
     extraClassChoiceComponent.SubcontrolOptionChosen += new EventHandler(extraClassChoiceComponent_SubcontrolOptionChosen);
     extraSubclassChoiceComponent = new ExtraSubclassChoiceControl(WM);
     extraSubclassChoiceComponent.SubcontrolOptionChosen += new EventHandler(extraSubclassChoiceComponent_SubcontrolOptionChosen);
     nameComponent                          = new NameControl(WM);
     nameComponent.NameChanged             += new EventHandler(nameComponent_NameChanged);
     storyComponent                         = new StoryControl(WM);
     storyComponent.SubcontrolOptionChosen += new EventHandler(storyComponent_SubcontrolOptionChosen);
     exportComponent                        = new ExportControl(WM);
 }
Exemple #26
0
        private void frmCadFilmes_Load(object sender, EventArgs e)
        {
            ClassControl.conectar();
            string        sql = "SELECT COUNT(*) FROM genero";
            NpgsqlCommand cmd = new NpgsqlCommand(sql, ClassControl.cn);

            sql             = "SELECT nome_gen FROM genero";
            cmd.CommandText = sql;
            NpgsqlDataReader dr = cmd.ExecuteReader();

            if (dr.HasRows)
            {
                cmbGeneroFilme.Items.Add("---");
                while (dr.Read())
                {
                    for (int i = 0; i < dr.FieldCount; i++)
                    {
                        cmbGeneroFilme.Items.Add(dr.GetString(i));
                    }
                }
            }
            dr.Close();
            //MessageBox.Show(count.ToString(), "", MessageBoxButtons.OK, MessageBoxIcon.Error);
        }
Exemple #27
0
        private void carregaFilmes()
        {
            try
            {
                string sql;

                sql = "SELECT f.titulo_filme, f.descricao_filme, f.ano_filme, g.nome_gen FROM" +
                      " filmes AS f, genero AS g WHERE f.id_genero = g.id_genero";

                DataTable dt = new DataTable();

                dt = ClassControl.selecionarDataTable(sql);

                dtgFilmes.DataSource = dt;
            }
            catch (Exception ex)
            {
                MessageBox.Show("Ocorreu um erro ao processar o comando!" +
                                "\n\nMais informações:" + ex.Message,
                                "FlexNit",
                                MessageBoxButtons.OK,
                                MessageBoxIcon.Error);
            }
        }
Exemple #28
0
        static void Main(string[] args)
        {
            ClassControl control = new ClassControl();

            control.RunCommandLine(18, "");
        }
Exemple #29
0
        public override void OnResponse(NetState sender, RelayInfo info)
        {
            Mobile       from      = sender.Mobile;
            ClassControl c_control = null;
            ClassOrb     c_orb     = null;
            bool         isInt     = true;

            foreach (Item i in World.Items.Values)
            {
                if (i is ClassControl)
                {
                    c_control = i as ClassControl;
                }
            }

            foreach (Item i in World.Items.Values)
            {
                if (i is ClassOrb)
                {
                    c_orb = i as ClassOrb;
                    if (c_orb.ClassNumber == c_control.C_Current)
                    {
                        break;
                    }
                }
            }

            if (info.ButtonID == 0)
            {
                m_From.SendGump(new NumberTertiaryGump(from, c_orb));
            }

            if (info.ButtonID == 1)
            {
                TextRelay m_num    = info.GetTextEntry(1);
                string    text_num = (m_num == null ? "" : m_num.Text.Trim());

                if (text_num.Length == 0)
                {
                    m_From.SendMessage(0x35, "You must enter a Value");
                    m_From.SendGump(new NumberTertiaryGump(from, c_orb));
                }
                else
                {
                    isInt = true;
                    try
                    {
                        int i = Convert.ToInt32(text_num);
                    }
                    catch
                    {
                        from.SendMessage(0x35, "Value must be a number!");
                        m_From.SendGump(new NumberTertiaryGump(from, c_orb));
                        isInt = false;
                    }
                    if (isInt)
                    {
                        int r_num = Convert.ToInt32(text_num);
                        if (r_num > 10)
                        {
                            m_From.SendMessage(0x35, "Value is above 10");
                            m_From.SendGump(new NumberTertiaryGump(from, c_orb));
                        }
                        else
                        if (r_num < 0)
                        {
                            m_From.SendMessage(0x35, "Value is below 0");
                            m_From.SendGump(new NumberTertiaryGump(from, c_orb));
                        }
                        else
                        {
                            c_orb.Amount_Tertiary = r_num;
                            m_From.SendGump(new RestrictedSkillsGump(from, c_orb));
                            m_From.SendMessage(6, "Number of Tertiaries set to " + c_orb.Amount_Tertiary);
                        }
                    }
                }
            }
        }
Exemple #30
0
        public override void OnResponse(NetState sender, RelayInfo info)
        {
            Mobile       from      = sender.Mobile;
            ClassControl c_control = null;
            ClassOrb     c_orb     = null;
            ClassOrb     t_orb     = null;
            bool         name_used = false;
            bool         is_void   = false;
            bool         isInt     = true;
            string       c_name    = null;
            string       n_name    = null;

            foreach (Item i in World.Items.Values)
            {
                if (i is ClassControl)
                {
                    c_control = i as ClassControl;
                }
            }

            foreach (Item i in World.Items.Values)
            {
                if (i is ClassOrb)
                {
                    c_orb = i as ClassOrb;
                    if (c_orb.ClassNumber == c_control.C_Current)
                    {
                        break;
                    }
                }
            }

            if (info.ButtonID == 0)
            {
                c_orb.Delete();
            }

            if (info.ButtonID == 1)
            {
                if (c_orb != null)
                {
                    TextRelay m_name    = info.GetTextEntry(1);
                    string    text_name = (m_name == null ? "" : m_name.Text.Trim());

                    if (text_name.Length == 0)
                    {
                        m_From.SendMessage(0x35, "You must enter a Class Name.");
                        m_From.SendGump(new AddClassGump(from, c_orb));
                        is_void = true;
                    }
                    else
                    {
                        foreach (Item x in World.Items.Values)
                        {
                            if (x is ClassOrb)
                            {
                                t_orb = x as ClassOrb;
                                if (text_name != null)
                                {
                                    n_name = text_name.ToLower();
                                }
                                if (t_orb.ClassName != null)
                                {
                                    c_name = t_orb.ClassName.ToLower();
                                }
                                if (c_name == n_name)
                                {
                                    name_used = true;
                                }
                            }
                        }
                        if (name_used)
                        {
                            m_From.SendMessage(0x35, "That Class Name is already used.");
                            if (!is_void)
                            {
                                m_From.SendGump(new AddClassGump(from, c_orb));
                                is_void = true;
                            }
                        }
                        else
                        {
                            c_orb.ClassName  = text_name;
                            c_orb.BackUpName = text_name;
                        }
                    }

                    TextRelay m_desc    = info.GetTextEntry(2);
                    string    text_desc = (m_desc == null ? "" : m_desc.Text.Trim());

                    if (text_desc.Length == 0)
                    {
                        m_From.SendMessage(0x35, "You must enter a Class Description.");
                        if (!is_void)
                        {
                            m_From.SendGump(new AddClassGump(from, c_orb));
                            is_void = true;
                        }
                    }
                    else
                    {
                        c_orb.Description = text_desc;
                    }

                    TextRelay m_str    = info.GetTextEntry(3);
                    string    text_str = (m_str == null ? "" : m_str.Text.Trim());

                    if (text_str.Length == 0)
                    {
                        m_From.SendMessage(0x35, "You must enter a Strength Value");
                        if (!is_void)
                        {
                            m_From.SendGump(new AddClassGump(from, c_orb));
                            is_void = true;
                        }
                    }
                    else
                    {
                        isInt = true;
                        try
                        {
                            int istr = Convert.ToInt32(text_str);
                        }
                        catch
                        {
                            from.SendMessage(0x35, "Strength Value must be a number!");
                            if (!is_void)
                            {
                                m_From.SendGump(new AddClassGump(from, c_orb));
                                is_void = true;
                            }
                            isInt = false;
                        }
                        if (isInt)
                        {
                            int r_str = Convert.ToInt32(text_str);
                            if (r_str > 100)
                            {
                                m_From.SendMessage(0x35, "Strength is above 100");
                                if (!is_void)
                                {
                                    m_From.SendGump(new AddClassGump(from, c_orb));
                                    is_void = true;
                                }
                            }
                            else
                            if (r_str < 1)
                            {
                                m_From.SendMessage(0x35, "Strength is below 1");
                                if (!is_void)
                                {
                                    m_From.SendGump(new AddClassGump(from, c_orb));
                                    is_void = true;
                                }
                            }
                            else
                            {
                                c_orb.Set_Str = r_str;
                                m_From.SendMessage(6, "Strength set to " + c_orb.Set_Str);
                            }
                        }
                    }

                    TextRelay m_dex    = info.GetTextEntry(4);
                    string    text_dex = (m_dex == null ? "" : m_dex.Text.Trim());

                    if (text_dex.Length == 0)
                    {
                        m_From.SendMessage(0x35, "You must enter a Dexterity Value");
                        if (!is_void)
                        {
                            m_From.SendGump(new AddClassGump(from, c_orb));
                            is_void = true;
                        }
                    }
                    else
                    {
                        isInt = true;
                        try
                        {
                            int idex = Convert.ToInt32(text_dex);
                        }
                        catch
                        {
                            from.SendMessage(0x35, "Dexterity Value must be a number!");
                            if (!is_void)
                            {
                                m_From.SendGump(new AddClassGump(from, c_orb));
                                is_void = true;
                            }
                            isInt = false;
                        }
                        if (isInt)
                        {
                            int r_dex = Convert.ToInt32(text_dex);
                            if (r_dex > 100)
                            {
                                m_From.SendMessage(0x35, "Dexterity is above 100");
                                if (!is_void)
                                {
                                    m_From.SendGump(new AddClassGump(from, c_orb));
                                    is_void = true;
                                }
                            }
                            else
                            if (r_dex < 1)
                            {
                                m_From.SendMessage(0x35, "Dexterity is below 1");
                                if (!is_void)
                                {
                                    m_From.SendGump(new AddClassGump(from, c_orb));
                                    is_void = true;
                                }
                            }
                            else
                            {
                                c_orb.Set_Dex = r_dex;
                                m_From.SendMessage(6, "Dexterity set to " + c_orb.Set_Dex);
                            }
                        }
                    }

                    TextRelay m_int    = info.GetTextEntry(5);
                    string    text_int = (m_int == null ? "" : m_int.Text.Trim());

                    if (text_int.Length == 0)
                    {
                        m_From.SendMessage(0x35, "You must enter an Intelligence Value");
                        if (!is_void)
                        {
                            m_From.SendGump(new AddClassGump(from, c_orb));
                            is_void = true;
                        }
                    }
                    else
                    {
                        isInt = true;
                        try
                        {
                            int iint = Convert.ToInt32(text_int);
                        }
                        catch
                        {
                            from.SendMessage(0x35, "Intelligence Value must be a number!");
                            if (!is_void)
                            {
                                m_From.SendGump(new AddClassGump(from, c_orb));
                                is_void = true;
                            }
                            isInt = false;
                        }
                        if (isInt)
                        {
                            int r_int = Convert.ToInt32(text_int);
                            if (r_int > 100)
                            {
                                m_From.SendMessage(0x35, "Intelligence is above 100");
                                if (!is_void)
                                {
                                    m_From.SendGump(new AddClassGump(from, c_orb));
                                    is_void = true;
                                }
                            }
                            else
                            if (r_int < 1)
                            {
                                m_From.SendMessage(0x35, "Intelligence is below 1");
                                if (!is_void)
                                {
                                    m_From.SendGump(new AddClassGump(from, c_orb));
                                    is_void = true;
                                }
                            }
                            else
                            {
                                c_orb.Set_Int = r_int;
                                m_From.SendMessage(6, "Intelligence set to " + c_orb.Set_Int);
                            }
                        }
                    }

                    TextRelay m_cstr    = info.GetTextEntry(6);
                    string    text_cstr = (m_cstr == null ? "" : m_cstr.Text.Trim());

                    if (text_cstr.Length == 0)
                    {
                        m_From.SendMessage(0x35, "You must enter a Strength Cap");
                        if (!is_void)
                        {
                            m_From.SendGump(new AddClassGump(from, c_orb));
                            is_void = true;
                        }
                    }
                    else
                    {
                        isInt = true;
                        try
                        {
                            int icstr = Convert.ToInt32(text_cstr);
                        }
                        catch
                        {
                            from.SendMessage(0x35, "Strength Cap must be a number!");
                            if (!is_void)
                            {
                                m_From.SendGump(new AddClassGump(from, c_orb));
                                is_void = true;
                            }
                            isInt = false;
                        }
                        if (isInt)
                        {
                            int r_cstr = Convert.ToInt32(text_cstr);
                            if (r_cstr > 200)
                            {
                                m_From.SendMessage(0x35, "Strength Cap is above 200");
                                if (!is_void)
                                {
                                    m_From.SendGump(new AddClassGump(from, c_orb));
                                    is_void = true;
                                }
                            }
                            else
                            if (r_cstr < 1)
                            {
                                m_From.SendMessage(0x35, "Strength Cap is below 1");
                                if (!is_void)
                                {
                                    m_From.SendGump(new AddClassGump(from, c_orb));
                                    is_void = true;
                                }
                            }
                            else
                            {
                                c_orb.Str_Cap = r_cstr;
                                m_From.SendMessage(6, "Strength Cap set to " + c_orb.Str_Cap);
                            }
                        }
                    }

                    TextRelay m_cdex    = info.GetTextEntry(7);
                    string    text_cdex = (m_cdex == null ? "" : m_cdex.Text.Trim());

                    if (text_cdex.Length == 0)
                    {
                        m_From.SendMessage(0x35, "You must enter a Dexterity Cap");
                        if (!is_void)
                        {
                            m_From.SendGump(new AddClassGump(from, c_orb));
                            is_void = true;
                        }
                    }
                    else
                    {
                        isInt = true;
                        try
                        {
                            int icdex = Convert.ToInt32(text_cdex);
                        }
                        catch
                        {
                            from.SendMessage(0x35, "Dexterity Cap must be a number!");
                            if (!is_void)
                            {
                                m_From.SendGump(new AddClassGump(from, c_orb));
                                is_void = true;
                            }
                            isInt = false;
                        }
                        if (isInt)
                        {
                            int r_cdex = Convert.ToInt32(text_cdex);
                            if (r_cdex > 200)
                            {
                                m_From.SendMessage(0x35, "Dexterity Cap is above 200");
                                if (!is_void)
                                {
                                    m_From.SendGump(new AddClassGump(from, c_orb));
                                    is_void = true;
                                }
                            }
                            else
                            if (r_cdex < 1)
                            {
                                m_From.SendMessage(0x35, "Dexterity Cap is below 1");
                                if (!is_void)
                                {
                                    m_From.SendGump(new AddClassGump(from, c_orb));
                                    is_void = true;
                                }
                            }
                            else
                            {
                                c_orb.Dex_Cap = r_cdex;
                                m_From.SendMessage(6, "Dexterity Cap set to " + c_orb.Dex_Cap);
                            }
                        }
                    }


                    TextRelay m_cint    = info.GetTextEntry(8);
                    string    text_cint = (m_cint == null ? "" : m_cint.Text.Trim());

                    if (text_cint.Length == 0)
                    {
                        m_From.SendMessage(0x35, "You must enter an Intelligence Cap");
                        if (!is_void)
                        {
                            m_From.SendGump(new AddClassGump(from, c_orb));
                            is_void = true;
                        }
                    }
                    else
                    {
                        isInt = true;
                        try
                        {
                            int icint = Convert.ToInt32(text_cint);
                        }
                        catch
                        {
                            from.SendMessage(0x35, "Intelligence Cap must be a number!");
                            if (!is_void)
                            {
                                m_From.SendGump(new AddClassGump(from, c_orb));
                                is_void = true;
                            }
                            isInt = false;
                        }
                        if (isInt)
                        {
                            int r_cint = Convert.ToInt32(text_cint);
                            if (r_cint > 200)
                            {
                                m_From.SendMessage(0x35, "Intelligence Cap is above 200");
                                if (!is_void)
                                {
                                    m_From.SendGump(new AddClassGump(from, c_orb));
                                    is_void = true;
                                }
                            }
                            else
                            if (r_cint < 1)
                            {
                                m_From.SendMessage(0x35, "Intelligence Cap is below 1");
                                if (!is_void)
                                {
                                    m_From.SendGump(new AddClassGump(from, c_orb));
                                    is_void = true;
                                }
                            }
                            else
                            {
                                c_orb.Int_Cap = r_cint;
                                m_From.SendMessage(6, "Intelligence Cap set to " + c_orb.Int_Cap);
                            }
                        }
                    }


                    if (!is_void)
                    {
                        c_orb.Amount_Primary = 0;
                        m_From.SendGump(new ClassGumpPrimary(from, c_orb));
                    }
                }
            }
        }