예제 #1
0
        public void addNew()
        {
            CDInformation cd = new CDInformation(
                txtID.Text,
                txtAlbum.Text,
                txtSinger.Text,
                cbxGenre.Text,
                int.Parse(txtDuration.Text)
                );

            for (int i = 0; i < listSongs.Items.Count; i++)
            {
                cd.Song.Add(listSongs.Items[i].ToString());
            }
            FormManage owner = (FormManage)this.Owner;

            foreach (CDInformation CD in owner.ListCD)
            {
                if (owner.ListCD.Count == 0)
                {
                    break;
                }
                if (CD.ID1.Equals(txtID.Text))
                {
                    ErrorID.SetError(txtID, "This ID is already existed!!");
                    return;
                }
            }
            ErrorID.Clear();
            owner.ListCD.Add(cd);
            owner.loadListData();
            btnReset_Click(this, null);
        }
예제 #2
0
        public bool validarEB()
        {
            bool noError = true;
            int  count   = 0;



            count = count + 1;

            if (count != 0)
            {
                ErrorID.Clear();
            }

            if (textBox2.Text == "")
            {
                ErrorID.SetError(textBox2, "Elija Chofer");

                noError = false;
            }


            if (textBoxDescripcioE.Text == "")
            {
                ErrorID.SetError(textBoxDescripcioE, "Ingrese la descripcion de la Ruta");

                noError = false;
            }

            if (textBoxNumeroBusE.Text == "")
            {
                ErrorID.SetError(textBoxNumeroBusE, "Ingrese el numero del bus");

                noError = false;
            }

            if (textBoxPlacaBusE.Text == "")
            {
                ErrorID.SetError(textBoxPlacaBusE, "Ingrese la placa del bus");

                noError = false;
            }



            return(noError);
        }
예제 #3
0
        public bool valid()
        {
            bool isError = false;

            if (txtID.Text.Equals(""))
            {
                ErrorID.SetError(txtID, "ID must not be empty!");
                isError = true;
            }

            if (txtAlbum.Text.Equals(""))
            {
                ErrorAlbum.SetError(txtAlbum, "Album must not be empty!");
                isError = true;
            }
            if (txtSinger.Text.Equals(""))
            {
                ErrorSinger.SetError(txtSinger, "Singer must not be empty!");
                isError = true;
            }
            if (listSongs.Items.Count == 0)
            {
                ErrorSong.SetError(listSongs, "You must add at least one song");
                isError = true;
            }


            if (isError)
            {
                return(false);
            }
            else
            {
                ErrorID.Clear(); ErrorAlbum.Clear(); ErrorDuration.Clear();
                ErrorSinger.Clear(); ErrorSong.Clear();
                return(true);
            }
        }//end of valid()