Пример #1
0
        private void buttonReturn_Click(object sender, EventArgs e)
        {
            if (tableLoanedCDs.SelectedItems.Length > 0)
            {
                LoanedCDDataSet.LoanedCDRow loanedCDRow = (LoanedCDDataSet.LoanedCDRow)tableLoanedCDs.SelectedItems[0].Tag;

                LoanedCDTableAdapter ta = new LoanedCDTableAdapter(dataBase);

                CDTableAdapter          cdta          = new CDTableAdapter(dataBase);
                PersonGroupTableAdapter personGroupta = new PersonGroupTableAdapter(dataBase);

                string artist = "";
                string title  = "";

                try
                {
                    CD cd = dataBase.GetCDById(loanedCDRow.CDID);

                    artist = cd.Artist;
                    title  = cd.Title;
                }
                catch
                {
                    artist = "<" + StringTable.Deleted + ">";
                    title  = "<" + StringTable.Deleted + ">";
                }
                string msg = String.Format(StringTable.ReturnLoanedCD, artist, title);
                if (MessageBox.Show(msg, Application.ProductName, MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                {
                    ta.Delete(loanedCDRow.CDID);
                    FillList();
                }
            }
        }
Пример #2
0
        public FormLoanProperties(DataBase dataBase, LoanedCDDataSet.LoanedCDRow loanedCD)
            : this()
        {
            loanedCDRow = loanedCD;

            CDTableAdapter          cdta          = new CDTableAdapter(dataBase);
            PersonGroupTableAdapter personGroupta = new PersonGroupTableAdapter(dataBase);

            CDDataSet.CDDataTable cd = cdta.GetDataById(loanedCDRow.CDID);
            PersonGroupDataSet.PersonGroupDataTable personGroup = personGroupta.GetDataById(cd[0].ArtistID);

            textBoxArtist.Text = personGroup[0].Name;
            textBoxTitle.Text  = cd[0].Title;

            comboBoxLoanedTo.Text = loanedCDRow.LoanedTo;

            checkBoxActivateBringBack.Checked = !loanedCDRow.IsReturnDateNull();
            if (!loanedCDRow.IsReturnDateNull())
            {
                dateTimePickerBringBack.Value = loanedCDRow.ReturnDate;
            }

            if (!loanedCDRow.IsLoanedDateNull())
            {
                dateTimePickerLoaned.Value = loanedCDRow.LoanedDate;
            }
            textBoxComment.Text = loanedCDRow.Comment;
        }
Пример #3
0
        private void buttonProperties_Click(object sender, EventArgs e)
        {
            if (tableLoanedCDs.SelectedItems.Length > 0)
            {
                LoanedCDDataSet.LoanedCDRow loanedCDRow = (LoanedCDDataSet.LoanedCDRow)tableLoanedCDs.SelectedItems[0].Tag;

                FormLoanProperties formLoanProperties = new FormLoanProperties(dataBase, loanedCDRow);

                if (formLoanProperties.ShowDialog(this) == DialogResult.OK)
                {
                    LoanedCDTableAdapter ta = new LoanedCDTableAdapter(dataBase);

                    ta.Update(loanedCDRow);
                    FillList();
                }
            }
        }