private void SaveExecute(object parameter)
        {
            try
            {
                tblSector sectorInDb = sectorService.GetSectorByName(Sector.SectorName);

                if (sectorInDb != null)
                {
                    string str1 = string.Format("Sector with this name exists\n" +
                                                "Enter another sector name");
                    MessageBox.Show(str1);
                    return;
                }

                sectorService.AddSector(Sector);
                string str = string.Format("You added new sector");
                MessageBox.Show(str);
                view.Close();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
        }
Exemple #2
0
 private void SaveExecute()
 {
     try
     {
         List <tblSector> allsectors = Service.Service.GetSectorList();
         if (allsectors.Count < 15)
         {
             Service.Service.AddSector(sector);
             isUpdated = true;
             addSector.Close();
         }
         else
         {
             MessageBox.Show("Max number of sectors are 15!");
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.ToString());
     }
 }