Ejemplo n.º 1
0
 public bool AddLabInvestigation(LabInvestigation labinvestigation)
 {
     try
     {
         entities.LabInvestigations.Add(labinvestigation);
         entities.SaveChanges();
         return true;
     }
     catch (Exception x)
     {
         throw x;
     }
 }
Ejemplo n.º 2
0
        private void btnAddInvestigation_Click(object sender, EventArgs e)
        {
            string name = txtInvestigationName.Text.Trim();
            string value = txtInvestigationValue.Text.Trim();

            if (name == "" || value == "")
            {
                MessageBox.Show("Enter name and value");
                return;
            }
            else
            {
                LabInvestigation labinvestigation = new LabInvestigation () { LabInvestigationName = name, NormalValue = value, CreatedOn = DateTime.Now };
                bool result = new MasterData().AddLabInvestigation(labinvestigation);
                if (result)
                {
                    txtInvestigationName.Text = "";
                    txtInvestigationValue.Text = "";
                    MessageBox.Show("Lab Investigation added successfully");
                }
                else
                {
                    MessageBox.Show("Cannot add Lab Investigation : contact Admin");
                }
            }
        }