Ejemplo n.º 1
0
        private void CreateCroolProject(string friendlyName)
        {
            try
            {
                var croolProject = new Business.Entities.CroolProject
                {
                    Name = friendlyName
                };

                foreach (Project p in this.Application.Solution.Projects)
                {
                    this.AddProjectToCroolProject(croolProject, p);
                }

                using (var context = new CroolContext(Config.ConnectionString))
                {
                    context.CroolProjects.Add(croolProject);
                    context.SaveChanges();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("Something went wrong.\nException message:" + ex.Message);
            }
        }
Ejemplo n.º 2
0
        private void btnSaveReview_Click(object sender, EventArgs e)
        {
            if (this.Application.ActiveDocument != null)
            {
                dynamic selection = this.Application.ActiveDocument.Selection;
                var file = GetLinkedFile(this.Application.ActiveDocument);

                using (var context = new CroolContext(Config.ConnectionString))
                {
                    var review = new Business.Entities.Review
                    {
                        Text = this.txtReviewText.Text,
                        From = this.txtFrom.Text,
                        To = this.txtTo.Text,
                        StartLine = selection.CurrentLine,
                        EndLine = selection.BottomLine,
                        File_Id = file.Id
                    };

                    context.Reviews.Add(review);
                    context.SaveChanges();
                }

                this.tabControl1.SelectTab(0);
                this.LoadReviews(file);
            }
        }