Ejemplo n.º 1
0
        public ActionResult Index()
        {
            List <Bug>          bugs    = BugDAL.GetAllBugs();
            List <BugViewModel> allBugs = new List <BugViewModel>();

            foreach (var item in bugs)
            {
                string       owner = item.UserId == null ? "None" : item.UserProfile.UserName;
                BugViewModel bug   = new BugViewModel()
                {
                    ProjectName       = item.Project.ProjectName,
                    Desctiption       = item.BugDescription,
                    Owner             = owner,
                    Priority          = item.Priority,
                    Status            = item.Status,
                    BugId             = item.BugId,
                    ProjectId         = item.Project.ProjectId,
                    DateOfFirstSubmit = item.DateOfFirstSubmit
                };
                allBugs.Add(bug);
            }
            if (User.Identity.IsAuthenticated)
            {
                UserDAL.AddActivity(User.Identity.Name);
            }

            return(View(allBugs));
        }
Ejemplo n.º 2
0
        public async Task <JsonResult> CreateBug(BugViewModel bugToCreate)
        {
            var dbBug = BugViewModelHelpers.ConvertToDatabaseModel(bugToCreate);
            var newId = await _bugService.CreateBug(dbBug);

            return(MessageResult($"Create bug action completed, new Id: {newId}", newId > 0));
        }
Ejemplo n.º 3
0
        public IHttpActionResult GetBugById(int id)
        {
            var bug = this.Data.Bugs.GetById(id);

            if (bug == null)
            {
                return(this.NotFound());
            }

            var bugViewModel = new BugViewModel()
            {
                Id          = bug.Id,
                Title       = bug.Title,
                Description = bug.Description,
                Status      = bug.Status.ToString(),
                Author      = bug.Author == null ? null : bug.Author.UserName,
                DateCreated = bug.DateCreated,
                Comments    = bug.Comments
                              .Select(c => new CommentViewModel()
                {
                    Id          = c.Id,
                    Text        = c.Text,
                    Author      = c.Author == null ? null : c.Author.UserName,
                    DateCreated = c.DateCreated
                })
                              .OrderByDescending(c => c.DateCreated)
            };

            return(this.Ok(bugViewModel));
        }
        public IActionResult Details(int id)
        {
            IEnumerable <BugModel> bugs = (IEnumerable <BugModel>)bugRepository.GetBugs(0, 0, string.Concat(id));
            BugModel     fetched        = bugs.FirstOrDefault(x => x.BugId == id);
            BugViewModel bugViewModel   = new BugViewModel
            {
                BugId    = fetched.BugId,
                ManualId = fetched.id,
                Assignee = fetched.AssigneeName,

                Products    = fetched.ProductName,
                Component   = fetched.ComponentName,
                Status      = fetched.Status,
                Summery     = fetched.Summary,
                Saverity    = fetched.Severity,
                Priority    = fetched.Priority,
                Description = fetched.Description,
                Hardware    = fetched.HardwareName,
                KeyWords    = fetched.KeyWords,
                version     = fetched.version,
                Changed     = fetched.Changed
            };

            return(View(bugViewModel));
        }
Ejemplo n.º 5
0
        public object ChangeStatus(ChangeStatus model)
        {
            ResponseDetails responseDetails = new ResponseDetails();

            try
            {
                BugViewModel bug = bugService.Get(model.Id);
                bug.StatusId = model.StatusId;

                if (model.StatusId == 2004)
                {
                    // if you are changing bug status to open => we need to change project status to under development
                    ProjectViewModel project = projectService.Get(bug.ProjectId);
                    project.ProjectStatusId = 1004;
                    projectService.Update(project);
                }
                else if (model.StatusId == 2005)
                {
                    // if you are changing bug status to Fixed => we need to change project status to under finished
                    ProjectViewModel project = projectService.Get(bug.ProjectId);
                    project.ProjectStatusId = 1007;
                    projectService.Update(project);
                }

                bugService.Update(bug);

                responseDetails = Helper.SetResponseDetails("Bug status updated successfully.", true, null, MessageType.Success);
            }
            catch (Exception ex)
            {
                responseDetails = Helper.SetResponseDetails("Exception encountered : " + ex.Message, false, ex, MessageType.Error);
            }

            return(responseDetails);
        }
Ejemplo n.º 6
0
        //GET: Bug/Edit
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }

            using (var database = new BugsTrackerDbContext())
            {
                var bug = database.Bugs
                          .Where(b => b.Id == id)
                          .First();

                if (bug == null)
                {
                    return(HttpNotFound());
                }

                var model = new BugViewModel();
                model.Id          = bug.Id;
                model.Title       = bug.Title;
                model.Description = bug.Description;
                model.State       = bug.State;
                model.RadioButton = bug.RadioButton;

                return(View(model));
            }
        }
Ejemplo n.º 7
0
        public ActionResult ProjectBugs(int ProjectId = 0)
        {
            List <BugViewModel> bugsForProject = new List <BugViewModel>();

            if (ProjectId == 0)
            {
                ViewBag.Projects = new SelectList(db.Projects.OrderBy(x => x.ProjectName)
                                                  .Select(x => x), "ProjectId", "ProjectName");
                return(View(bugsForProject));
            }
            ViewBag.Projects = new SelectList(db.Projects.OrderBy(x => x.ProjectName)
                                              .Select(x => x), "ProjectId", "ProjectName", ProjectId);
            var bugs = BugDAL.SelectAllBugsFromProject(ProjectId);

            foreach (var item in bugs)
            {
                string       owner = item.UserId == null ? "None" : item.UserProfile.UserName;
                BugViewModel bug   = new BugViewModel()
                {
                    Owner             = owner,
                    Desctiption       = "",
                    Priority          = item.Priority,
                    Status            = item.Status,
                    BugId             = item.BugId,
                    ProjectId         = ProjectId,
                    ProjectName       = item.Project.ProjectName,
                    DateOfFirstSubmit = item.DateOfFirstSubmit,
                };
                bugsForProject.Add(bug);
            }

            return(View(bugsForProject));
        }
Ejemplo n.º 8
0
        private BugViewModel MapBug(Bug model)
        {
            BugViewModel modelMapping = Mapper.Map <Bug, BugViewModel>(model);

            modelMapping.ProjectViewModel = Mapper.Map <Project, ProjectViewModel>(model.Project);

            return(modelMapping);
        }
Ejemplo n.º 9
0
        private BugViewModel MapBug(Bug model)
        {
            BugViewModel modelMapping = Mapper.Map <Bug, BugViewModel>(model);

            modelMapping.UserViewModel = Mapper.Map <User, UserViewModel>(model.User);

            return(modelMapping);
        }
Ejemplo n.º 10
0
        public BugPage(string title, string description, Exception exception)
        {
            InitializeComponent();

            _viewModel          = new BugViewModel(title, description, exception);
            this.BindingContext = _viewModel;

            Title = Droid.Resources.Messages.BugPage_Title;
        }
Ejemplo n.º 11
0
 public void Create(BugViewModel model)
 {
     using (unitOfWork = new UnitOfWork())
     {
         Bug modelMapping = Mapper.Map <BugViewModel, Bug>(model);
         unitOfWork.BugRepository.Insert(modelMapping);
         unitOfWork.BugRepository.Save();
     }
 }
Ejemplo n.º 12
0
 public static Bug ConvertToDatabaseModel(BugViewModel viewModel)
 {
     return(new Bug
     {
         Title = viewModel.Title,
         Description = viewModel.Description,
         AssignedUserId = viewModel.AssignedUser.Id
     });
 }
Ejemplo n.º 13
0
        public BugPanelViewModel CreateBugViewPanel(ProjectViewModel project, BugViewModel bug)
        {
            ParameterOverrides parameters = new ParameterOverrides()
            {
                { "activeProj", project },
                { "selectedBug", bug }
            };

            return(_Container.Resolve <BugPanelViewModel>("ViewPanel", parameters));
        }
Ejemplo n.º 14
0
        public IActionResult Create(BugViewModel model)
        {
            ViewBag.Message = "Bug cadastrado com sucesso";

            var publish = new Publisher();

            publish.SendMessage(model);

            return(View());
        }
Ejemplo n.º 15
0
        private BugViewModel MapBugModel(Bug model)
        {
            BugViewModel modelMapping = Mapper.Map <Bug, BugViewModel>(model);

            modelMapping.Bug_PrioritiesViewModel = Mapper.Map <Bug_priorities, Bug_PrioritiesViewModel>(model.Bug_priorities);
            modelMapping.Bug_StatusViewModel     = Mapper.Map <Bug_Status, Bug_StatusViewModel>(model.Bug_Status);
            modelMapping.ProjectViewModel        = MapProject(model.Project);
            modelMapping.UserViewModel           = Mapper.Map <User, UserViewModel>(model.User);

            return(modelMapping);
        }
 public async Task SendMessage(BugViewModel model)
 {
     try
     {
         var body    = JsonConvert.SerializeObject(model);
         var message = new Message(Encoding.UTF8.GetBytes(body));
         await this.queueClient.SendAsync(message);
     }
     catch (Exception exception)
     {
         Console.WriteLine($"{DateTime.Now} :: Exception: {exception.Message}");
     }
 }
Ejemplo n.º 17
0
        public object Get(int id)
        {
            ResponseDetails responseDetails = new ResponseDetails();

            try
            {
                BugViewModel bugList = bugService.Get(id);
                responseDetails = Helper.SetResponseDetails("", true, bugList, MessageType.Success);
            }
            catch (Exception ex)
            {
                responseDetails = Helper.SetResponseDetails("Exception encountered : " + ex.Message, false, ex, MessageType.Error);
            }

            return(responseDetails);
        }
Ejemplo n.º 18
0
        public object Update(BugViewModel model)
        {
            ResponseDetails responseDetails = new ResponseDetails();

            try
            {
                bugService.Update(model);
                responseDetails = Helper.SetResponseDetails("Bug updated successfully.", true, null, MessageType.Success);
            }
            catch (Exception ex)
            {
                responseDetails = Helper.SetResponseDetails("Exception encountered : " + ex.Message, false, ex, MessageType.Error);
            }

            return(responseDetails);
        }
Ejemplo n.º 19
0
        public static BugViewModel ConvertToViewModel(Bug dbModel)
        {
            var viewModel = new BugViewModel
            {
                Id          = dbModel.Id,
                Description = dbModel.Description,
                Title       = dbModel.Title,
                Status      = ConvertDbStatusToViewModelStatus(dbModel.Status),
                Created     = dbModel.Created
            };

            if (dbModel.AssignedUser != null)
            {
                viewModel.AssignedUser = UserViewModelHelpers.ConvertToViewModel(dbModel.AssignedUser);
            }

            return(viewModel);
        }
Ejemplo n.º 20
0
        public async Task <JsonResult> SendBugReport(BugViewModel viewModel)
        {
            //Process Form
            //return NotFound();
            string message;
            bool   isError;

            if (viewModel.Description == "111")
            {
                message = "success";
                isError = false;
            }
            else
            {
                message = "error";
                isError = true;
            }

            return(Json(new { message, isError }));
            //return PartialView("BugModal", viewModel);
        }
Ejemplo n.º 21
0
        public ActionResult Edit(BugViewModel model)
        {
            if (ModelState.IsValid)
            {
                using (var database = new BugsTrackerDbContext())
                {
                    var bug = database.Bugs
                              .FirstOrDefault(b => b.Id == model.Id);

                    bug.Title       = model.Title;
                    bug.Description = model.Description;
                    bug.State       = model.State;
                    bug.RadioButton = model.RadioButton;

                    database.Entry(bug).State = EntityState.Modified;
                    database.SaveChanges();

                    return(RedirectToAction("Index"));
                }
            }
            return(View(model));
        }
        public IActionResult Create(BugViewModel bug)
        {
            if (ModelState.IsValid)
            {
                string summaryAndDesc = bug.Summery + " " + bug.Description;
                string colValue       = summaryAndDesc.Replace("\'", String.Empty).Replace("{", string.Empty).Replace("}", string.Empty).Replace("\"", String.Empty);

                var keywords = TextFormaterTool.DataPreprocess(colValue);

                BugModel bugprofile = new BugModel
                {
                    id            = bug.Id,
                    AssigneeName  = bug.Assignee,
                    ProductName   = bug.Products,
                    ComponentName = bug.Component,
                    HardwareName  = bug.Hardware,
                    Severity      = bug.Saverity,
                    Priority      = bug.Priority,
                    Summary       = bug.Summery,
                    KeyWords      = keywords,
                    Status        = "New",
                    Description   = bug.Description,
                    Changed       = "",
                    Source        = "Bug Triage"
                };
                bool returnVal = (bool)bugRepository.SaveBugProfile(bugprofile);
                if (returnVal)
                {
                    return(RedirectToAction("ResolvedBugs"));
                }
                else
                {
                    ModelState.AddModelError("db", "Cannot be saved");
                }
            }


            return(View(bug));
        }
Ejemplo n.º 23
0
        public object CreateBug()
        {
            ResponseDetails responseDetails = new ResponseDetails();

            try
            {
                BugViewModel model = Helper.SaveBugImage(HttpContext.Current.Request);
                bugService.Create(model);

                // when creating bug we need to change project status to under development
                ProjectViewModel project = projectService.Get(model.ProjectId);
                project.ProjectStatusId = 1004;
                projectService.Update(project);

                responseDetails = Helper.SetResponseDetails("Bug created successfully.", true, null, MessageType.Success);
            }
            catch (Exception ex)
            {
                responseDetails = Helper.SetResponseDetails("Exception encountered : " + ex.Message, false, ex, MessageType.Error);
            }

            return(responseDetails);
        }
Ejemplo n.º 24
0
        private void updatebtn_Click(object sender, EventArgs e)
        {
            //bug
            BugViewModel bug = new BugViewModel
            {
                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.PictureViewModel image = new Bug_Tracker.Model.PictureViewModel
                {
                    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");
        }
Ejemplo n.º 25
0
        public IHttpActionResult SubmitNewBug(BugBindingModel bugModel)
        {
            if (bugModel.Title == null)
            {
                return(BadRequest("Invalid bug title"));
            }

            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            var currentUserId = User.Identity.GetUserId();
            var user          = db.Users.FirstOrDefault(u => u.Id == currentUserId);

            var bug = new Bug()
            {
                Title       = bugModel.Title,
                Description = bugModel.Description,
                Status      = Status.Open,
                SubmitDate  = DateTime.Now,
                Author      = user != null ? user : null
            };

            db.Bugs.Add(bug);
            db.SaveChanges();

            var bugOutput = new BugViewModel()
            {
                Id          = bug.Id,
                Author      = bug.Author != null ? bug.Author.UserName : null,
                Status      = bug.Status.ToString(),
                Title       = bug.Title,
                DateCreated = bug.SubmitDate
            };

            if (currentUserId != null)
            {
                bugOutput.Author = bug.Author.UserName;
                return(CreatedAtRoute(
                           "DefaultApi",
                           new
                {
                    id = bugOutput.Id,
                    Author = bugOutput.Author,
                    Message = "User bug submitted."
                },
                           new
                {
                    id = bugOutput.Id,
                    Author = bugOutput.Author,
                    Message = "User bug submitted."
                }));
            }

            return(CreatedAtRoute(
                       "DefaultApi",
                       new
            {
                id = bugOutput.Id,
                Message = "Anonymous bug submitted."
            },
                       new
            {
                id = bugOutput.Id,
                Message = "Anonymous bug submitted."
            }));
        }
Ejemplo n.º 26
0
        private void UpdateBug_Load(object sender, EventArgs e)
        {
            bug = bugDAO.GetById(Program.bugId);
            this.StartPosition = FormStartPosition.CenterScreen;
            //this.FormBorderStyle = FormBorderStyle.None;
            this.WindowState = FormWindowState.Maximized;

            if (disableButtons)
            {
                textBox2.Enabled = false;
                textBox3.Enabled = false;
                textBox4.Enabled = false;
                textBox5.Enabled = false;
                button2.Hide();
                button3.Hide();
                updatebtn.Hide();
                button5.Show();
            }
            else
            {
                button5.Show();
            }



            //binding value to related labels and textbox
            label2.Text         = bug.ProjectName;
            textBox2.Text       = bug.ClassName;
            textBox3.Text       = bug.MethodName;
            textBox4.Text       = bug.StartLine.ToString();
            textBox5.Text       = bug.EndLine.ToString();
            programmingLanguage = bug.Codes.ProgrammingLanguage;
            currentImageName    = bug.Images.ImageName;
            codeFileName        = bug.Codes.CodeFileName;
            //assiging related table's id
            bugId           = bug.BugId;
            codeId          = bug.Codes.CodeId;
            imageId         = bug.Images.ImageId;
            linkLabel1.Text = bug.SourceControl.Link;

            /*
             * Open the file to read from.
             * reading text from code file
             */
            string path = bug.Codes.CodeFilePath + "/" + bug.Codes.CodeFileName + ".txt";

            using (StreamReader sr = File.OpenText(path))
            {
                string s = "";
                while ((s = sr.ReadLine()) != null)
                {
                    fastColoredTextBox1.Text = fastColoredTextBox1.Text + Environment.NewLine + s;
                }
            }

            //assigning programming language for text box
            string pl = bug.Codes.ProgrammingLanguage;

            if (pl == "CSharp")
            {
                fastColoredTextBox1.Language = FastColoredTextBoxNS.Language.CSharp;
            }
            else if (pl == "HTML")
            {
                fastColoredTextBox1.Language = FastColoredTextBoxNS.Language.HTML;
            }
            else if (pl == "JavaScript")
            {
                fastColoredTextBox1.Language = FastColoredTextBoxNS.Language.JS;
            }
            else if (pl == "Lua")
            {
                fastColoredTextBox1.Language = FastColoredTextBoxNS.Language.Lua;
            }
            else if (pl == "PHP")
            {
                fastColoredTextBox1.Language = FastColoredTextBoxNS.Language.PHP;
            }
            else if (pl == "SQL")
            {
                fastColoredTextBox1.Language = FastColoredTextBoxNS.Language.SQL;
            }
            else if (pl == "VB")
            {
                fastColoredTextBox1.Language = FastColoredTextBoxNS.Language.VB;
            }
            else if (pl == "XML")
            {
                fastColoredTextBox1.Language = FastColoredTextBoxNS.Language.XML;
            }

            if (bug.Images.ImageName != "")
            {
                pictureBox1.Image    = new Bitmap(Path.Combine(bug.Images.ImagePath + "/", bug.Images.ImageName));
                pictureBox1.SizeMode = PictureBoxSizeMode.StretchImage;
            }
        }
Ejemplo n.º 27
0
        private void button1_Click(object sender, EventArgs e)
        {
            //bug
            BugViewModel bug = new BugViewModel
            {
                ProjectName  = textBox1.Text,
                ClassName    = textBox2.Text,
                MethodName   = textBox3.Text,
                StartLine    = Convert.ToInt16(textBox4.Text),
                EndLine      = Convert.ToInt16(textBox5.Text),
                ProgrammerId = Login.userId
            };

            try
            {
                BugDAO bugDao = new BugDAO();
                bugDao.Insert(bug);
            } catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }
            ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
            //image


            string appPath = Path.GetDirectoryName(Application.ExecutablePath) + @"\code_image\";

            Bug_Tracker.Model.PictureViewModel image = new Bug_Tracker.Model.PictureViewModel
            {
                ImagePath = "code_image",
                ImageName = imageName,
                BugId     = bug.BugId
            };

            try
            {
                ImageDAO codeDao = new ImageDAO();
                codeDao.Insert(image);

                File.Copy(imageName, appPath + ImageName);
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }

            ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
            ////code
            string c            = fastColoredTextBox1.Text;
            string codeFileName = DateTime.Now.Second.ToString();

            CodeViewModel code = new CodeViewModel
            {
                CodeFilePath        = "code",
                CodeFileName        = codeFileName,
                ProgrammingLanguage = programminLanguage,
                BugId = bug.BugId
            };

            try
            {
                CodeDAO codeDao = new CodeDAO();
                codeDao.Insert(code);

                string path = "code/" + codeFileName + ".txt";
                if (!File.Exists(path))
                {
                    // Create a file to write to.
                    using (StreamWriter sw = File.CreateText(path))
                    {
                        sw.WriteLine(c);
                    }
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }


            //Bug bug = new Bug { BugId = }
        }
Ejemplo n.º 28
0
 public SaveCommand(BugViewModel viewModel)
 {
     _viewModel = viewModel;
 }
Ejemplo n.º 29
0
        private void button1_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(comboBox1.SelectedItem.ToString()) || string.IsNullOrEmpty(textBox2.Text) || string.IsNullOrEmpty(textBox3.Text) || string.IsNullOrEmpty(textBox4.Text) || string.IsNullOrEmpty(textBox5.Text) || string.IsNullOrEmpty(textBox1.Text) || string.IsNullOrEmpty(textBox6.Text) || string.IsNullOrEmpty(textBox7.Text))
            {
                MessageBox.Show("You must add all project information");
            }
            else if (string.IsNullOrEmpty(fastColoredTextBox1.Text))
            {
                MessageBox.Show("Code field cann't be null");
            }
            else
            {
                //bug
                BugViewModel bug = new BugViewModel
                {
                    ProjectName  = comboBox1.SelectedItem.ToString(),
                    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.Insert(bug);
                    inserted = true;
                }
                catch (Exception ex)
                {
                    Console.WriteLine(ex.Message);
                }
                ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
                //image

                if (!string.IsNullOrEmpty(imageName))
                {
                    string appPath = Path.GetDirectoryName(Application.ExecutablePath) + @"\code_image\";
                    Bug_Tracker.Model.PictureViewModel image = new Bug_Tracker.Model.PictureViewModel
                    {
                        ImagePath = "code_image",
                        ImageName = imageName,
                        BugId     = bug.BugId
                    };

                    try
                    {
                        ImageDAO codeDao = new ImageDAO();
                        codeDao.Insert(image);

                        File.Copy(imageName, appPath + ImageName);
                    }
                    catch (Exception ex)
                    {
                        Console.WriteLine(ex.Message);
                    }

                    ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
                    ////code
                    string c            = fastColoredTextBox1.Text;
                    string codeFileName = DateTime.Now.Second.ToString();

                    CodeViewModel code = new CodeViewModel
                    {
                        CodeFilePath        = "code",
                        CodeFileName        = codeFileName,
                        ProgrammingLanguage = programminLanguage,
                        BugId = bug.BugId
                    };

                    try
                    {
                        CodeDAO codeDao = new CodeDAO();
                        codeDao.Insert(code);

                        string path = "code/" + codeFileName + ".txt";
                        if (!File.Exists(path))
                        {
                            // Create a file to write to.
                            using (StreamWriter sw = File.CreateText(path))
                            {
                                sw.WriteLine(c);
                            }
                        }

                        inserted2 = true;
                    }
                    catch (Exception ex)
                    {
                        Console.WriteLine(ex.Message);
                    }
                    ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
                    ////Link

                    VersionControl sourceControl = new VersionControl
                    {
                        Link      = textBox1.Text,
                        StartLine = Convert.ToInt32(textBox6.Text),
                        EndLine   = Convert.ToInt32(textBox7.Text),
                        BugId     = bug.BugId
                    };

                    VersionControlDAO sourceControlDAO = new VersionControlDAO();

                    try
                    {
                        sourceControlDAO.Insert(sourceControl);
                        inserted3 = true;
                    }
                    catch (Exception ex)
                    {
                        Console.WriteLine(ex.Message);
                    }

                    MessageBox.Show("Added");
                }
            }
        }
Ejemplo n.º 30
0
 public SendCommand(BugViewModel viewModel)
 {
     _viewModel = viewModel;
 }