private void FetchNotes(int[] id) { Database_Manager db = new Database_Manager(); try { //for (int i = 0; i < 3; i++) //{ // notes[i] = db.FetchNote(id[0]); //} if (id[0] != 0) { notes[0] = db.FetchNote(id[0]); if (id[1] != 0) { notes[1] = db.FetchNote(id[1]); if (id[2] != 0) { notes[2] = db.FetchNote(id[2]); } } } } catch (Exception) { throw; } }
// member functions // This version of verifyFlower() will verify that the flower entry // passed as an argument does not exist within the database, rather than // comparing with the contents of a pseudo-database, or a dummy Flower instantiation, // like what was done for Iteration I. public string verifyFlower(string userEnteredEnglish, string userEnteredLatin, string userEnteredBotan, string userEnteredNote, string userEnteredImgPath) { string msgToDisplay; Database_Manager DBMngr = new Database_Manager(); // need to be able to get the flower entry from the database // which matches the id of 'customFlower' // if a change is made to the english name AND that change does not result in it being blank if ((userEnteredEnglish != DBMngr.FetchEnglish(flowerId)) && (userEnteredEnglish != "")) { DBMngr.changeEnglishName(userEnteredEnglish, flowerId); msgToDisplay = "Changes successfully saved!"; } else { msgToDisplay = "Changes unable to be saved: One of the three minimum attributes is missing."; } // same structure for latin name and botanical family if ((userEnteredLatin != DBMngr.FetchLatin(flowerId)) && (userEnteredLatin != "")) { DBMngr.changeLatinName(userEnteredLatin, flowerId); msgToDisplay = "Changes successfully saved!"; } else { msgToDisplay = "Changes unable to be saved: One of the three minimum attributes is missing."; } if ((userEnteredBotan != DBMngr.FetchBotan(flowerId)) && (userEnteredBotan != "")) { DBMngr.changeBotanicalFam(userEnteredBotan, flowerId); msgToDisplay = "Changes successfully saved!"; } else { msgToDisplay = "Changes unable to be saved: One of the three minimum attributes is missing."; } if (userEnteredNote != DBMngr.FetchNote(flowerId) && userEnteredNote != "") { DBMngr.changeNote(userEnteredNote, flowerId); msgToDisplay = "Changes successfully saved!"; } if (userEnteredImgPath != DBMngr.FetchFilePath(flowerId) && userEnteredImgPath != "") { userEnteredImgPath = ChangeFilePath(userEnteredImgPath); DBMngr.changeImgPath(userEnteredImgPath, flowerId); msgToDisplay = "Changes successfully saved!"; } return(msgToDisplay); }
private void ChangeToFlowerProfileBtn_Click(object sender, EventArgs e) { Database_Manager DBMngrInstance = new Database_Manager(); new flowerProfile(DBMngrInstance.FetchEnglish(copyOfFlowerId), DBMngrInstance.FetchLatin(copyOfFlowerId), DBMngrInstance.FetchBotan(copyOfFlowerId), DBMngrInstance.FetchNote(copyOfFlowerId), DBMngrInstance.FetchFilePath(copyOfFlowerId), copyOfFlowerId, userAcctType).Show(); this.Hide(); }