/// <summary> /// Clear all map and their dependencies & relationship from database /// </summary> public void ClearMap() { DevInfo.Lib.DI_LibDAL.Queries.Area.Delete AreaDelete = new DevInfo.Lib.DI_LibDAL.Queries.Area.Delete(new DITables(this.DBQueries.DataPrefix, this.DBQueries.LanguageCode)); //-- Clear all associated metadata icons DIIcons.ClearIcon(this.DBConnection, this.DBQueries.DataPrefix, IconElementType.MetadataArea); //-- Clear all record from Area_Map_Metadata table (languages based tables) this.ClearAreaMapMetadata(); //-- Clear all associated record from Area_Map table this.DBConnection.ExecuteNonQuery(AreaDelete.ClearAreaMap()); //-- Clear all records from Area_Feature_Type table this.DBConnection.ExecuteNonQuery(AreaDelete.ClearAreaFeatureType()); //-- Clear layer record from Area_Map_Layer master table this.DBConnection.ExecuteNonQuery(AreaDelete.ClearAreaMapLayer()); }
/// <summary> /// Clear all map and their dependencies & relationship from database /// </summary> public void ClearMap() { DevInfo.Lib.DI_LibDAL.Queries.Area.Delete AreaDelete = new DevInfo.Lib.DI_LibDAL.Queries.Area.Delete(new DITables(this.DBQueries.DataPrefix, this.DBQueries.LanguageCode)); //-- Clear all associated metadata icons DIIcons.ClearIcon(this.DBConnection, this.DBQueries.DataPrefix, IconElementType.MetadataArea); //-- Clear all record from Area_Map_Metadata table (languages based tables) this.ClearAreaMapMetadata(); //-- Clear all associated record from Area_Map table this.DBConnection.ExecuteNonQuery(AreaDelete.ClearAreaMap()); //-- Clear all records from Area_Feature_Type table this.DBConnection.ExecuteNonQuery(AreaDelete.ClearAreaFeatureType()); //-- Clear layer record from Area_Map_Layer master table this.DBConnection.ExecuteNonQuery(AreaDelete.ClearAreaMapLayer()); }
/// <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> /// Delete map layers based on selected area nids /// </summary> /// <param name="areaNIds"></param> public void DeleteMapByAreaNIds(string areaNIds) { //-- Validate for valid argument value if (!string.IsNullOrEmpty(areaNIds)) { DevInfo.Lib.DI_LibDAL.Queries.Area.Delete AreaDelete = new DevInfo.Lib.DI_LibDAL.Queries.Area.Delete(new DITables(this.DBQueries.DataPrefix, this.DBQueries.LanguageCode)); string[] ArrAreaNId = areaNIds.Split(",".ToCharArray(), StringSplitOptions.RemoveEmptyEntries); string sSql = string.Empty; DataView dvAreaMapInfo; DataView dvAreaMapInfo2; int LayerNId = -1; //-- Iterate for each AreaNId for (int i = 0; i < ArrAreaNId.Length; i++) { //-- Get all layer associated with AreaNId sSql = this.DBQueries.Area.GetAreaMapByAreaNIds(ArrAreaNId[i], true); dvAreaMapInfo = this.DBConnection.ExecuteDataTable(sSql).DefaultView; //-- Iterate each layer associated with Area foreach (DataRowView drv in dvAreaMapInfo) { LayerNId = (int)drv[Area_Map_Layer.LayerNId]; //-- Check whether this layer is associated with any other area sSql = this.DBQueries.Area.GetAreaMapByLayerNIds(LayerNId.ToString(), true); dvAreaMapInfo2 = this.DBConnection.ExecuteDataTable(sSql).DefaultView; if (dvAreaMapInfo2.Count > 1) { //-- If this layer is associated with any other area then just drop the realtionship between Area and Layer this.DBConnection.ExecuteNonQuery(AreaDelete.DeleteAreaMapByAreaNIds(ArrAreaNId[i])); } else { //-- 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()); } }
/// <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> /// Delete map layers based on selected area nids /// </summary> /// <param name="areaNIds"></param> public void DeleteMapByAreaNIds(string areaNIds) { //-- Validate for valid argument value if (!string.IsNullOrEmpty(areaNIds)) { DevInfo.Lib.DI_LibDAL.Queries.Area.Delete AreaDelete = new DevInfo.Lib.DI_LibDAL.Queries.Area.Delete(new DITables(this.DBQueries.DataPrefix, this.DBQueries.LanguageCode)); string[] ArrAreaNId = areaNIds.Split(",".ToCharArray(), StringSplitOptions.RemoveEmptyEntries); string sSql = string.Empty; DataView dvAreaMapInfo; DataView dvAreaMapInfo2; int LayerNId = -1; //-- Iterate for each AreaNId for (int i = 0; i < ArrAreaNId.Length; i++) { //-- Get all layer associated with AreaNId sSql = this.DBQueries.Area.GetAreaMapByAreaNIds(ArrAreaNId[i], true); dvAreaMapInfo = this.DBConnection.ExecuteDataTable(sSql).DefaultView; //-- Iterate each layer associated with Area foreach (DataRowView drv in dvAreaMapInfo) { LayerNId = (int)drv[Area_Map_Layer.LayerNId]; //-- Check whether this layer is associated with any other area sSql = this.DBQueries.Area.GetAreaMapByLayerNIds(LayerNId.ToString(), true); dvAreaMapInfo2 = this.DBConnection.ExecuteDataTable(sSql).DefaultView; if (dvAreaMapInfo2.Count > 1) { //-- If this layer is associated with any other area then just drop the realtionship between Area and Layer this.DBConnection.ExecuteNonQuery(AreaDelete.DeleteAreaMapByAreaNIds(ArrAreaNId[i])); } else { //-- 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()); } }