// // NOTE2: Remove a PMD // static public Boolean RemovePMD(string imsi) { if (dbConn == null) { dbConn = GetDefaultSqlConnection(); if (dbConn == null) { return(false); } } SqlCommand cmd = new SqlCommand("PMDRemove", dbConn); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@pmdId", Utility.GetLast7Digits(imsi)); if (dbConn.State == ConnectionState.Closed) { dbConn.Open(); } Boolean status = DBExecuteNonQueryCommand(cmd); // If we sucessfully add the PMD, we send notification to cloud server if (status) { // Notify the change of configuration PMDConfiguration.SendNotificationToCloudServer(PMDConfiguration.TableID.PMD, PMDConfiguration.DatabaseOperationType.Delete, imsi); } return(status); }
// // NOTE2: Modify PMD // // (1) If there is no address, address parameter is set to null // (2) If there is no location, location parameter is set to null // In the PMD table, column 'Location' will store coordinate in X,Y format. // Location Format: CoordiateX,Coordinate Y (For example, 33.013444,-93.444444) // static public Boolean UpdatePMD(string pmdName, string imsi, string username, Boolean statsCollection, string location, string address) { if (dbConn == null) { dbConn = GetDefaultSqlConnection(); if (dbConn == null) { return(false); } } SqlCommand cmd = new SqlCommand("PMDUpdate", dbConn); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@pmdName", pmdName); cmd.Parameters.AddWithValue("@UserName", username); cmd.Parameters.AddWithValue("@StatsCollection", statsCollection); cmd.Parameters.AddWithValue("@pmdId", Utility.GetLast7Digits(imsi)); if (location != null || location != string.Empty) { cmd.Parameters.AddWithValue("@Location", location); } if (address != null || address != string.Empty) { cmd.Parameters.AddWithValue("@Address", address); } if (dbConn.State == ConnectionState.Closed) { dbConn.Open(); } Boolean status = DBExecuteNonQueryCommand(cmd); // If we sucessfully add the PMD, we send notification to cloud server if (status) { // Notify the change of configuration PMDConfiguration.SendNotificationToCloudServer(PMDConfiguration.TableID.PMD, PMDConfiguration.DatabaseOperationType.Update, imsi); } return(status); }