public static bool AddDatasets(IBindingList datasetBindingList, IList <int> selectedDatasets, string providerUrl, string userName, string password) { using (var localDb = new GeosyncDbEntities()) { foreach (var selected in selectedDatasets) { var ds = (Dataset)datasetBindingList[selected]; try { ds.LastIndex = 0; ds.ClientWfsUrl = ""; ds.UserName = userName; ds.Password = password; ds.SyncronizationUrl = providerUrl; localDb.AddObject(ds); localDb.SaveChanges(); } catch (Exception ex) { Logger.Error(ex, "Error saving selected datasets!"); return(false); } } } return(true); }
public static bool AddEmptyDataset() { using (var localDb = new GeosyncDbEntities()) { var ds = new Dataset(); try { ds.LastIndex = 0; ds.ClientWfsUrl = ""; localDb.AddObject(ds); localDb.SaveChanges(); } catch (Exception ex) { Logger.Error(ex, "Error saving selected datasets!"); return(false); } } return(true); }