示例#1
0
 public bool AddOtherAdvise(OtherAdvise otheradvise)
 {
     try
     {
         entities.OtherAdvises.Add(otheradvise);
         entities.SaveChanges();
         return true;
     }
     catch (Exception x)
     {
         throw x;
     }
 }
示例#2
0
        private void btnAddOtherAdvise_Click(object sender, EventArgs e)
        {
            string name = txtOtherAdvise.Text.Trim();

            if (name == "")
            {
                MessageBox.Show("Enter advise");
                return;
            }
            else
            {
                OtherAdvise otheradvise = new OtherAdvise() { OtherAdviseName = name, CreatedOn = DateTime.Now };
                bool result = new MasterData().AddOtherAdvise(otheradvise);
                if (result)
                {
                    txtOtherAdvise.Text = "";
                    MessageBox.Show("Advise added successfully");
                }
                else
                {
                    MessageBox.Show("Cannot add advise : contact Admin");
                }
            }
        }