Beispiel #1
0
 public bool AddDosageFrequency(DosageFrequency dosagefrequency)
 {
     try
     {
         entities.DosageFrequencies.Add(dosagefrequency);
         entities.SaveChanges();
         return true;
     }
     catch (Exception x)
     {
         throw x;
     }
 }
Beispiel #2
0
        private void btnAddDosageFrequency_Click(object sender, EventArgs e)
        {
            string name = txtDosageFrequency.Text.Trim();

            if (name == "")
            {
                MessageBox.Show("Enter dosage frequency");
                return;
            }
            else
            {
                DosageFrequency dosagefrequency = new DosageFrequency() { DosageFrequencyName = name, CreatedOn = DateTime.Now };
                bool result = new MasterData().AddDosageFrequency(dosagefrequency);
                if (result)
                {
                    txtDosageFrequency.Text = "";
                    MessageBox.Show("Dosage frequency added successfully");
                }
                else
                {
                    MessageBox.Show("Cannot add dosage frequency : contact Admin");
                }
            }
        }