Example #1
0
 public bool AddDosageDuration(DosageDuration dosageduration)
 {
     try
     {
         entities.DosageDurations.Add(dosageduration);
         entities.SaveChanges();
         return true;
     }
     catch (Exception x)
     {
         throw x;
     }
 }
Example #2
0
        private void btnAddDosageDuration_Click(object sender, EventArgs e)
        {
            string name = txtDosageDuration.Text.Trim();

            if (name == "")
            {
                MessageBox.Show("Enter dosage duration");
                return;
            }
            else
            {
                DosageDuration dosageduration = new DosageDuration() { DosageDurationName = name, CreatedOn = DateTime.Now };
                bool result = new MasterData().AddDosageDuration(dosageduration);
                if (result)
                {
                    txtDosageDuration.Text = "";
                    MessageBox.Show("Dosage duration added successfully");
                }
                else
                {
                    MessageBox.Show("Cannot add dosage duration : contact Admin");
                }
            }
        }