Ejemplo n.º 1
0
        public void SaveOrEdit()
        {
            try
            {
                if (txtJournalName.Text == string.Empty)
                {
                    MessageBox.Show("Enter a journal name");
                }

                else if (txtAbbreviation.Text == string.Empty)
                {
                    MessageBox.Show("Enter an abbreviation");
                }

                else
                {
                    JournalTypeInfo journalTypeInfo = new JournalTypeInfo();
                    JournalSP       spJournal       = new JournalSP();
                    journalTypeInfo.JournalTypeName = txtJournalName.Text.Trim();
                    journalTypeInfo.Abbreviation    = txtAbbreviation.Text.Trim();
                    journalTypeInfo.Narration       = txtNarration.Text.Trim();
                    journalTypeInfo.Heading1        = txtHeading1.Text.Trim();
                    journalTypeInfo.Heading2        = txtHeading2.Text.Trim();
                    journalTypeInfo.IsActive        = cbxActive.Checked ? true : false;


                    if (btnSave.Text == "Save")
                    {
                        if (Messages.SaveConfirmation())
                        {
                            spJournal.JournalTypeAdd(journalTypeInfo);
                            Messages.SavedMessage();
                            ClearFunction();
                        }
                    }
                    else
                    {
                        if (Messages.UpdateMessage())
                        {
                            journalTypeInfo.JournalTypeId = journalId;
                            spJournal.JournalTypeUpdate(journalTypeInfo);
                            Messages.UpdatedMessage();
                            ClearFunction();
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Ejemplo n.º 2
0
 public void FillControls()
 {
     try
     {
         JournalTypeInfo journalTypeInfo = new JournalTypeInfo();
         JournalSP       spJournal       = new JournalSP();
         journalTypeInfo      = spJournal.JournalTypeViewOne(journalId);
         txtJournalName.Text  = journalTypeInfo.JournalTypeName;
         txtAbbreviation.Text = journalTypeInfo.Abbreviation;
         cbxActive.Checked    = Convert.ToBoolean(journalTypeInfo.IsActive) ? true : false;
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }