Exemplo n.º 1
0
        private void artistTable_CellPropertyChanged(object sender, XPTable.Events.CellEventArgs e)
        {
            try
            {
                PersonGroupDataSet.PersonGroupRow personGroupRow = (PersonGroupDataSet.PersonGroupRow)personGroupTable.TableModel.Rows[e.Row].Tag;

                switch (e.Column)
                {
                case 0:
                    personGroupRow.Name = e.Cell.Text;
                    break;

                case 1:
                    personGroupRow.SaveAs = e.Cell.Text;
                    break;

                case 4:
                    personGroupRow.Country = e.Cell.Text;
                    break;

                case 7:
                    personGroupRow.URL = e.Cell.Text;
                    break;

                case 8:
                    personGroupRow.ImageFilename = e.Cell.Text;
                    break;

                case 9:
                    personGroupRow.Comment = e.Cell.Text;
                    break;
                }

                personGroupRow.EndEdit();
                personGroupAdapter.Update(personGroupRow);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
Exemplo n.º 2
0
        private void buttonOK_Click(object sender, EventArgs e)
        {
            if (String.Compare(originalArtistName, textBoxName.Text, true) != 0)
            {
                // JUS 16.10.2004: Prüfen, ob Interpret schon vorhanden
                PersonGroupDataSet.PersonGroupRow row = dataBase.GetPersonGroupRowByName(textBoxName.Text, false);

                if (row != null)
                {
                    String str;

                    if (personType == PersonType.Artist)
                    {
                        str = String.Format(StringTable.ArtistAlreadyExists, textBoxName.Text);
                    }
                    else
                    {
                        str = String.Format(StringTable.ComposerAlreadyExists, textBoxName.Text);
                    }

                    MessageBox.Show(str, Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Information);
                    DialogResult = DialogResult.None;
                    return;
                }
            }

            DialogResult = DialogResult.OK;

            thePersonGroupRow.EndEdit();

            if (!string.IsNullOrEmpty(choosePictureButton.ImageFilename))
            {
                thePersonGroupRow.ImageFilename = choosePictureButton.ImageFilename;
            }
            else
            {
                thePersonGroupRow.SetImageFilenameNull();
            }
        }
Exemplo n.º 3
0
        private void artistTable_EditingStopped(object sender, XPTable.Events.CellEditEventArgs e)
        {
            PersonGroupDataSet.PersonGroupRow personGroupRow = (PersonGroupDataSet.PersonGroupRow)personGroupTable.TableModel.Rows[e.Row].Tag;

            switch (e.Column)
            {
            case 2:
                personGroupRow.Type = ((XPTable.Editors.ComboBoxCellEditor)e.Editor).SelectedIndex;
                personGroupRow.EndEdit();
                personGroupAdapter.Update(personGroupRow);
                break;

            case 3:
                personGroupRow.Sex = ((XPTable.Editors.ComboBoxCellEditor)e.Editor).SelectedIndex;
                personGroupRow.EndEdit();
                personGroupAdapter.Update(personGroupRow);
                break;

            case 5:
            {
                string newValue = ((XPTable.Editors.TextCellEditor)e.Editor).TextBox.Text;
                try
                {
                    if (newValue.Length > 0)
                    {
                        personGroupRow.BirthDay = Misc.ParseDate(newValue);
                        // Das richtig formatierte Datum anzeigen
                        ((XPTable.Editors.TextCellEditor)e.Editor).TextBox.Text = Misc.FormatDate(personGroupRow.BirthDay);
                        e.Cell.Data = personGroupRow.BirthDay;
                    }
                    else
                    {
                        personGroupRow.SetBirthDayNull();
                        e.Cell.Data = null;
                    }
                }
                catch
                {
                    MessageBox.Show(StringTable.InvalidDateValue, Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Information);
                    e.Cancel = true;
                }
                break;
            }

            case 6:
            {
                string newValue = ((XPTable.Editors.TextCellEditor)e.Editor).TextBox.Text;
                try
                {
                    if (newValue.Length > 0)
                    {
                        personGroupRow.DayOfDeath = Misc.ParseDate(newValue);
                        // Das richtig formatierte Datum anzeigen
                        ((XPTable.Editors.TextCellEditor)e.Editor).TextBox.Text = Misc.FormatDate(personGroupRow.DayOfDeath);
                        e.Cell.Data = personGroupRow.DayOfDeath;
                    }
                    else
                    {
                        personGroupRow.SetDayOfDeathNull();
                        e.Cell.Data = null;
                    }
                }
                catch
                {
                    MessageBox.Show(StringTable.InvalidDateValue, Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Information);
                    e.Cancel = true;
                }
                break;
            }
            }
        }