private void btnUpdate_Click(object sender, EventArgs e) { //bug Bug bug = new Bug { BugId = bugId, ProjectName = label1.Text, ClassName = textBox2.Text, MethodName = textBox3.Text, StartLine = Convert.ToInt16(textBox4.Text), EndLine = Convert.ToInt16(textBox5.Text), ProgrammerId = Login.userId, Status = "0" }; try { BugDAO bugDao = new BugDAO(); bugDao.Update(bug); } catch (Exception ex) { Console.WriteLine(ex.Message); } //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //image if (!string.IsNullOrEmpty(ImageName)) { string appPath = Path.GetDirectoryName(Application.ExecutablePath) + @"\code_image\"; Bug_Tracker.Model.Image image = new Bug_Tracker.Model.Image { ImageId = imageId, ImagePath = "code_image", ImageName = ImageName, BugId = bug.BugId }; try { ImageDAO codeDao = new ImageDAO(); codeDao.Update(image); File.Delete("code_image/" + currentImageName); File.Copy(imageName, appPath + ImageName); } catch (Exception ex) { Console.WriteLine(ex.Message); } } //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ////code string c = fastColoredTextBox1.Text; //Code code = new Code //{ // CodeId = codeId, // CodeFilePath = "code", // CodeFileName = codeFileName, // ProgrammingLanguage = programminLanguage, // BugId = bug.BugId //}; try { string path = @"code/" + codeFileName + ".txt"; using (StreamWriter sw = File.CreateText(path)) { sw.WriteLine(c); } } catch (Exception ex) { Console.WriteLine(ex.Message); } MessageBox.Show("Updated"); }