Example #1
0
        void ObjectsItemEndEdit(IEditableObject sender)
        {
            EspecialZoneViewModel UIObject = sender as EspecialZoneViewModel;

            try
            {
                if (UIObject.Name != null)
                {
                    int id = EspecialZonesDataAccess.UpdateZone(UIObject.GetDataObject());
                    if (id != -1)
                    {
                        UIObject.Id = id;
                    }
                }
            }
            catch (Exception ex)
            {
                log.Error(ex.StackTrace);
                UIObjects.Remove(UIObject);
                RadWindow.Alert(new DialogParameters
                {
                    Content = MessageUtil.FormatMessage("ERROR.DuplicatedZone", UIObject.Name, UIObject.Name)
                });
            }
        }
Example #2
0
 void ObjectsCollectionChanged(object sender, NotifyCollectionChangedEventArgs e)
 {
     if (e.Action == NotifyCollectionChangedAction.Remove)
     {
         try
         {
             foreach (object item in e.OldItems)
             {
                 EspecialZoneViewModel UIObject = item as EspecialZoneViewModel;
                 EspecialZonesDataAccess.DeleteZone(UIObject.GetDataObject());
             }
         }
         catch (Exception ex)
         {
             log.Error(ex.StackTrace);
         }
     }
 }
Example #3
0
        public EspecialZonesDataGrid(EntitiesCollections entitiesCollections) : base(entitiesCollections)
        {
            InitializeComponent();


            string query    = null;
            string Contract = null;


            List <string> listazonas = new List <string>();

            query  = "SELECT DISTINCT(Nombre) FROM ZonaBasica";
            reader = DataBaseManager.ReadData(query);
            while (reader.Read())
            {
                Contract = (reader.GetString(0));

                listazonas.Add(Contract);
            }
            DataBaseManager.DbConnection.Close();
            // Contrato.DataContext = lista;
            (NameColumn).ItemsSource = listazonas;  // Country.GetCountries();



            EspecialZonesCollectionViewModel items = ItemsSource as EspecialZonesCollectionViewModel;

            if (items.Count == 1)
            {
                EspecialZoneViewModel item = items[0] as EspecialZoneViewModel;
                if (item.Name == null)
                {
                    CurrentColumn              = NameColumn;
                    NameColumn.IsReadOnly      = false;
                    IndiceIniColumn.IsReadOnly = false;
                    IndiceFinColumn.IsReadOnly = false;
                }
            }
        }