コード例 #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()
コード例 #4
0
        private void btnUpdate_Click(object sender, EventArgs e)
        {
            ErrorID.SetError(txtMa, "");
            if (txtMa.Text == "")
            {
                ErrorID.SetError(txtMa, "Xin nhập ID cần thay đổi");
                return;
            }
            errorTenDanhMuc.SetError(txtTenDM, "");
            if (txtTenDM.Text == "")
            {
                errorTenDanhMuc.SetError(txtTenDM, "Xin nhập tên Danh Mục cần thay đổi");
                return;
            }

            errorNoiDung.SetError(richNoiDungDM, "");
            if (richNoiDungDM.Text == "")
            {
                errorTenDanhMuc.SetError(richNoiDungDM, "Xin nhập nội dung cần thay đổi");
                return;
            }

            DanhMuc dm = new DanhMuc();

            dm.IdDanhMuc      = int.Parse(txtMa.Text);
            dm.TenDanhMuc     = txtTenDM.Text;
            dm.NoiDungDanhMuc = richNoiDungDM.Text;

            DanhMucBLL dmbll   = new DanhMucBLL();
            bool       capnhat = dmbll.CapNhatDanhMuc(dm);

            if (capnhat)
            {
                MessageBox.Show("Đã Thay Đổi Thành Công, Nhấn Cập Nhật Nhé ...", "Thông Báo");
                this.Close();
            }
        }