/// <summary> /// Delete Map layer and all associated dependencies & relationships /// </summary> /// <param name="layerNId"></param> public void DeleteMap(string layerNIds) { DevInfo.Lib.DI_LibDAL.Queries.Area.Delete AreaDelete = new DevInfo.Lib.DI_LibDAL.Queries.Area.Delete(new DITables(this.DBQueries.DataPrefix, this.DBQueries.LanguageCode)); //-- Delete all associated metadata icons DIIcons.DeleteIcon(this.DBConnection, this.DBQueries.DataPrefix, layerNIds, IconElementType.MetadataArea); //-- Delete all associated record from Metdata table (languages based tables) this.DeleteAreaMapMetaData(layerNIds); //-- Delete all associated record from AreaMap table this.DBConnection.ExecuteNonQuery(AreaDelete.DeleteAreaMap(layerNIds.ToString())); // TODO Area feature type - Not to be implemented now as there is no interface to enter records into Area_Feature_Type table // When a record is deleted in AreaMap table, get Area_Map.Feature_Type_NId // If Area_Map.Feature_Type_NId not associated to any other layer then delete record in Area_Feature_Type.Feature_Type_NId (language based table) //-- Delete layer record from AreaMapLayer master table this.DBConnection.ExecuteNonQuery(AreaDelete.DeleteAreaMapLayer(layerNIds.ToString())); }
/// <summary> /// Deletes area map associated for the given layerNid and areaNid /// </summary> /// <param name="layerNId"></param> /// <param name="areaNId"></param> public void DeleteMap(int layerNId, int areaNId) { string SqlQuery = string.Empty; DataView AreaMapDataView; DevInfo.Lib.DI_LibDAL.Queries.Area.Delete AreaDelete = new DevInfo.Lib.DI_LibDAL.Queries.Area.Delete(new DITables(this.DBQueries.DataPrefix, this.DBQueries.LanguageCode)); // step1: remove area and layer association SqlQuery = AreaDelete.DeleteAreaMap(layerNId, areaNId); this.DBConnection.ExecuteNonQuery(SqlQuery); // step2: delete map only if layer is not associated with other areas SqlQuery = this.DBQueries.Area.GetAreaMapByLayerNIds(layerNId.ToString(), true); AreaMapDataView = this.DBConnection.ExecuteDataTable(SqlQuery).DefaultView; if (AreaMapDataView.Count == 0) { //-- If this layer is not associated with any other area then drop this layer along with other dependencies and relationships this.DeleteMap(layerNId.ToString()); } }
/// <summary> /// Deletes area map associated for the given layerNid and areaNid /// </summary> /// <param name="layerNId"></param> /// <param name="areaNId"></param> public void DeleteMap(int layerNId,int areaNId) { string SqlQuery = string.Empty; DataView AreaMapDataView; DevInfo.Lib.DI_LibDAL.Queries.Area.Delete AreaDelete = new DevInfo.Lib.DI_LibDAL.Queries.Area.Delete(new DITables(this.DBQueries.DataPrefix, this.DBQueries.LanguageCode)); // step1: remove area and layer association SqlQuery= AreaDelete.DeleteAreaMap(layerNId, areaNId); this.DBConnection.ExecuteNonQuery(SqlQuery); // step2: delete map only if layer is not associated with other areas SqlQuery = this.DBQueries.Area.GetAreaMapByLayerNIds(layerNId.ToString(), true); AreaMapDataView= this.DBConnection.ExecuteDataTable(SqlQuery).DefaultView; if (AreaMapDataView.Count ==0) { //-- If this layer is not associated with any other area then drop this layer along with other dependencies and relationships this.DeleteMap(layerNId.ToString()); } }