Ejemplo n.º 1
0
        public AddBookForm(Constants.LibraryMode libMode, Constants.AddBookMode addMode, string bookId)
        {
            _libraryMode = libMode;
            _addMode     = addMode;

            InitializeComponent();
            //this.chkAutoAdd.CheckedChanged += new EventHandler(chkAutoAdd_CheckedChanged);
            this.btnSave.Click   += new EventHandler(btnSave_Click);
            this.btnClear.Click  += new EventHandler(btnClear_Click);
            this.btnLookUp.Click += new EventHandler(btnLookUp_Click);
            this.cboLookupBy.Items.Add(new DDItem("ISBN", "isbn"));
            // TODO: Readd and test
            // this.cboLookupBy.Items.Add(new DDItem("Lib. Congr. #", "lcc_number"));
            this.cboLookupBy.SelectedIndex = 0;

            if (_addMode == Constants.AddBookMode.VIEWONLY)
            {
                this.chkAutoAdd.Visible     = false;
                this.btnClear.Visible       = false;
                this.btnLookUp.Visible      = false;
                this.btnSave.Visible        = false;
                this.txtAuthors.ReadOnly    = true;
                this.txtAwards.ReadOnly     = true;
                this.txtDewey.ReadOnly      = true;
                this.txtDeweyNorm.ReadOnly  = true;
                this.txtEdition.ReadOnly    = true;
                this.txtEditors.ReadOnly    = true;
                this.txtISBN.ReadOnly       = true;
                this.txtLanguage.ReadOnly   = true;
                this.txtLCC.ReadOnly        = true;
                this.txtLongTitle.ReadOnly  = true;
                this.txtNotes.ReadOnly      = true;
                this.txtPhysDesc.ReadOnly   = true;
                this.txtPublisher.ReadOnly  = true;
                this.txtShortTitle.ReadOnly = true;
                this.txtSubjects.ReadOnly   = true;
                this.txtSummary.ReadOnly    = true;
                this.txtURLs.ReadOnly       = true;
                this.txtNewPrice.ReadOnly   = true;
                this.txtUsedPrice.ReadOnly  = true;
                this.txtPricePaid.ReadOnly  = true;

                this.groupBox1.Text = "View Book";
            }
            else if (_addMode == Constants.AddBookMode.EDIT)
            {
                this.groupBox2.Enabled = false;
                this.btnClear.Enabled  = false;
            }

            this.toolTip1.SetToolTip(this.txtAuthors, "Put each author on a separate line, preferably in the format 'LastName, FirstName MI'");
            this.toolTip1.SetToolTip(this.txtEditors, "Put each editor on a separate line, preferably in the format 'LastName, FirstName MI'");
            this.toolTip1.SetToolTip(this.txtSubjects, "Put each subject on a separate line");

            _bookId = bookId;
        }
        public AddBookForm(Constants.LibraryMode libMode, Constants.AddBookMode addMode, string bookId)
        {
        	_libraryMode = libMode;
            _addMode = addMode;

            InitializeComponent();
            //this.chkAutoAdd.CheckedChanged += new EventHandler(chkAutoAdd_CheckedChanged);
            this.btnSave.Click += new EventHandler(btnSave_Click);
            this.btnClear.Click += new EventHandler(btnClear_Click);
            this.btnLookUp.Click += new EventHandler(btnLookUp_Click);
            this.cboLookupBy.Items.Add(new DDItem("ISBN","isbn"));
           	// TODO: Readd and test
            // this.cboLookupBy.Items.Add(new DDItem("Lib. Congr. #", "lcc_number"));
            this.cboLookupBy.SelectedIndex = 0;
            
            if (_addMode == Constants.AddBookMode.VIEWONLY)
            {
                this.chkAutoAdd.Visible = false;
                this.btnClear.Visible = false;
                this.btnLookUp.Visible = false;
                this.btnSave.Visible = false;
                this.txtAuthors.ReadOnly = true;
                this.txtAwards.ReadOnly = true;
                this.txtDewey.ReadOnly = true;
                this.txtDeweyNorm.ReadOnly = true;
                this.txtEdition.ReadOnly = true;
                this.txtEditors.ReadOnly = true;
                this.txtISBN.ReadOnly = true;
                this.txtLanguage.ReadOnly = true;
                this.txtLCC.ReadOnly = true;
                this.txtLongTitle.ReadOnly = true;
                this.txtNotes.ReadOnly = true;
                this.txtPhysDesc.ReadOnly = true;
                this.txtPublisher.ReadOnly = true;
                this.txtShortTitle.ReadOnly = true;
                this.txtSubjects.ReadOnly = true;
                this.txtSummary.ReadOnly = true;
                this.txtURLs.ReadOnly = true;
                this.txtNewPrice.ReadOnly = true;
                this.txtUsedPrice.ReadOnly = true;
                this.txtPricePaid.ReadOnly = true;

                this.groupBox1.Text = "View Book";
            }
            else if (_addMode == Constants.AddBookMode.EDIT)
            {
                this.groupBox2.Enabled = false;
                this.btnClear.Enabled = false;
            }

            this.toolTip1.SetToolTip(this.txtAuthors,"Put each author on a separate line, preferably in the format 'LastName, FirstName MI'");
            this.toolTip1.SetToolTip(this.txtEditors,"Put each editor on a separate line, preferably in the format 'LastName, FirstName MI'");
            this.toolTip1.SetToolTip(this.txtSubjects,"Put each subject on a separate line");
            
            _bookId = bookId;
        }