Exemplo n.º 1
0
        }//Constructor de la clase

        public void AddRegulation(Reglamento NewRegulation)
        {
            int LastPosition = Reglamentos.Length;

            Array.Resize(ref Reglamentos, (Reglamentos.Length + 1));
            Reglamentos[LastPosition] = NewRegulation;
        }//Añade un nuevo reglamento
Exemplo n.º 2
0
        }//Renta un reglamento

        private void RentRegulation_ReturnRegulation_button_Click(object sender, EventArgs e)
        {
            Reglamento A = new Reglamento("", "");

            Goathemala.returnRegulation(RentRegulation_ReturnRegularion_comboBox.Text, ref A);
            if (Act_Work == "Parlamentario")
            {
                TempPar.DevolverReglamento(A);
                RentRegulation_ReturnRegularion_comboBox.Items.Clear();
                for (int i = 0; i < TempPar.ReglamentosEnAlquiler.Length; i++)
                {
                    RentRegulation_ReturnRegularion_comboBox.Items.Add(TempPar.ReglamentosEnAlquiler[i].returnName());
                }
            }
            else
            {
                TempAse.DevolverReglamento(A);
                RentRegulation_ReturnRegularion_comboBox.Items.Clear();
                for (int i = 0; i < TempAse.ReglamentosEnAlquiler.Length; i++)
                {
                    RentRegulation_ReturnRegularion_comboBox.Items.Add(TempAse.LeyesEnAlquiler[i].returnName());
                }
            }
            RentRegulation_ReturnRegularion_comboBox.SelectedIndex = -1;
        }
Exemplo n.º 3
0
        }//Agranda el arreglo 1 tamaño y guarda la nueva

        public void DevolverReglamento(Reglamento A)
        {
            for (int i = 0; i < ReglamentosEnAlquiler.Length; i++)
            {
                if (A.returnName() == ReglamentosEnAlquiler[i].returnName())
                {
                    ReglamentosEnAlquiler[i] = null;
                }
            }
            this.ArreglarReglamentos();
        }//Elimina la ley alquilada
Exemplo n.º 4
0
        //---------------------------DeleteRegulations---------------------------------------


        //---------------------------Rent/Return_Regulations---------------------------------------
        private void RentRegulation_RentRegulation_button_Click(object sender, EventArgs e)
        {
            Reglamento A = new Reglamento("", "");

            Goathemala.rentRegulation(RentRegulation_ChooseRegulation_comboBox.Text, ref A);
            if (A.returnName() != "")
            {
                if (Act_Work == "Parlamentario")
                {
                    if (TempPar.YalatieneReg(RentRegulation_ChooseRegulation_comboBox.Text) == false)
                    {
                        TempPar.AlquilarReglamento(A);
                    }
                    else
                    {
                        MessageBox.Show("Usted ya tiene esta ley alquilada");
                    }
                }
                else
                {
                    if (TempAse.YalatieneReg(RentLaws_ChooseLaw_Combobox.Text) == false)
                    {
                        TempAse.AlquilarReglamento(A);
                    }
                    else
                    {
                        MessageBox.Show("Usted ya tiene esta ley alquilada");
                    }
                }
            }
            else
            {
                MessageBox.Show("Debe de seleccionar un reglamento");
            }
            RentRegulation_ChooseRegulation_comboBox.SelectedIndex = -1;
            RentRegulation_ReturnRegularion_comboBox.Items.Clear();
            //Se vuelven a llenar los combo box.
            if (Act_Work == "Parlamentario")
            {
                for (int i = 0; i < TempPar.ReglamentosEnAlquiler.Length; i++)
                {
                    RentRegulation_ReturnRegularion_comboBox.Items.Add(TempPar.ReglamentosEnAlquiler[i].returnName());
                }
            }
            else
            {
                for (int i = 0; i < TempAse.ReglamentosEnAlquiler.Length; i++)
                {
                    RentRegulation_ReturnRegularion_comboBox.Items.Add(TempAse.ReglamentosEnAlquiler[i].returnName());
                }
            }
        }//Renta un reglamento
Exemplo n.º 5
0
 public void returnRegulation(string _name, ref Reglamento A)
 {
     for (int i = 0; i < this.GoathemalaLaws.Length; i++)
     {
         for (int j = 0; j < this.GoathemalaLaws[i].Reglamentos.Length; j++)
         {
             if ((_name == this.GoathemalaLaws[i].Reglamentos[j].returnName()) && (this.GoathemalaLaws[i].Reglamentos[j].Copies > 0))
             {
                 this.GoathemalaLaws[i].Reglamentos[j].Copies++;
                 A = GoathemalaLaws[i].Reglamentos[j];
             }
         }
     }//Busca la ley para retornarla
 }
Exemplo n.º 6
0
        public void DeleteReg(string Regname)
        {
            Reglamento tempReg = new Reglamento("", "");

            this.rentRegulation(Regname, ref tempReg);//Para poder convertir el nombre al objeto ley
            //ciclo para que todos los parlamentarios que tienen la ley la regresen antes de eliminarla
            for (int i = 0; i < Congress.Length; i++)
            {
                //Ciclo para que en un parlamentario se busque si tiene la ley
                for (int j = 0; j < Congress[i].ReglamentosEnAlquiler.Length; j++)
                {
                    //si alguna de sus leyes coincide con el nombre, se devuelve
                    if (Regname == Congress[i].ReglamentosEnAlquiler[j].returnName())
                    {
                        Congress[i].DevolverReglamento(tempReg);
                    }
                }
                //este ciclo es para buscar en los asesores a ver si alguno la tiene
                for (int k = 0; k < 8; k++)
                {
                    //entra al parlamentario donde estan los asesores, entra a los asesores donde estan
                    //sus leyes prestadas, entra a las leyes para comparar...
                    for (int j = 0; j < Congress[i].Asesores[k].ReglamentosEnAlquiler.Length; j++)
                    {
                        if (Regname == Congress[i].Asesores[k].ReglamentosEnAlquiler[j].returnName())
                        {
                            Congress[i].Asesores[k].DevolverReglamento(tempReg);
                        }
                    }
                }
                tempReg = null;

                for (int k = 0; k < this.GoathemalaLaws.Length; k++)
                {
                    for (int j = 0; j < this.GoathemalaLaws[i].Reglamentos.Length; j++)
                    {
                        if (GoathemalaLaws[i].Reglamentos[j].returnName() == Regname)
                        {
                            GoathemalaLaws[i].Reglamentos[j] = null;
                        }
                    }
                }
            }
            this.ArreglarReg();
        }
Exemplo n.º 7
0
        }//Busca el nombre de la ley asociada cuando solo se tiene el reglamento

        public void rentRegulation(string _name, ref Reglamento A)
        {
            for (int i = 0; i < this.GoathemalaLaws.Length; i++)
            {
                for (int j = 0; j < this.GoathemalaLaws[i].Reglamentos.Length; j++)
                {
                    if ((_name == GoathemalaLaws[i].Reglamentos[j].returnName()))
                    {
                        if ((GoathemalaLaws[i].Reglamentos[j].Copies > 0))
                        {
                            GoathemalaLaws[i].Reglamentos[j].Copies--;
                            A = GoathemalaLaws[i].Reglamentos[j];
                        }
                        else
                        {
                            System.Windows.Forms.MessageBox.Show("Lo sentimos, actualmente no hay copias disponibles");
                        }
                    }
                }
            }
        }
Exemplo n.º 8
0
        }//Regresa al menu de reglamentos

        //---------------------------SeeRegulations---------------------------------------


        //---------------------------CreateRegulations---------------------------------------
        private void CreateRegulation_Create_Button_Click(object sender, EventArgs e)
        {
            if (Goathemala.ReturnNumberOfLaw(CreateRegulation_Associate_txt.Text) != -1 && CreateRegulation_Associate_txt.Text != "")
            {
                if (CreateRegulation_Name_txt.Text != "" && CreateRegulation_Description_txt.Text != "")
                {
                    Reglamento newReglamento = new Reglamento(CreateRegulation_Name_txt.Text, CreateRegulation_Description_txt.Text);
                    Goathemala.GoathemalaLaws[Goathemala.ReturnNumberOfLaw(CreateRegulation_Associate_txt.Text)].AddRegulation(newReglamento);
                    newReglamento = null;//despues de asignarlo se borra el reglamento
                    CreateRegulation_Name_txt.Text        = "";
                    CreateRegulation_Associate_txt.Text   = "";
                    CreateRegulation_Description_txt.Text = "";
                }
                else
                {
                    MessageBox.Show("Ingrese un nombre, una descripcion");
                }
            }
            else
            {
                MessageBox.Show("Ingrese una ley valida");
            }
        }//Ya sirve :v
Exemplo n.º 9
0
        }//Verifica si ya tiene la ley

        //reglamento
        public void AlquilarReglamento(Reglamento A)
        {
            Array.Resize(ref ReglamentosEnAlquiler, (ReglamentosEnAlquiler.Length + 1));
            ReglamentosEnAlquiler[ReglamentosEnAlquiler.Length - 1] = A;
        }//Agranda el arreglo 1 tamaño y guarda la nueva