Exemplo n.º 1
0
        /// <summary>
        /// When the create button is clicked, we inform the world to commit changes.
        /// </summary>
        private void ButtonCreate_Click(object sender, EventArgs e)
        {
            var lProject = new Project();
            lProject.Name = this.mTextBoxTitle.Name;
            lProject.Description = this.mTextPreviewViewBody.Text;
            lProject.CreationDateTIme = DateTime.UtcNow;

            using (var lDataContext = new IssueTrackerDataContext())
            {
                var lProjectUser = new ProjectUser();
                lProjectUser.Project = lProject;
                lProjectUser.User = lDataContext.CurrentUser;

                lDataContext.Projects.InsertOnSubmit(lProject);
                lDataContext.ProjectUsers.InsertOnSubmit(lProjectUser);

                lDataContext.SubmitChanges();
            }

            this.ProjectCreated.Fire(this, ReadOnlyValueEventArgs.Create(lProject));
        }
        private void ButtonUpdate_Click(object sender, EventArgs e)
        {
            using (var lDataContext = new IssueTrackerDataContext())
            {
                this.Issue = lDataContext.Issues.Single(x => x.Id == this.Issue.Id);
                this.Issue.LastUpdatedDateTime = DateTime.UtcNow;
                this.Issue.Title = this.mTextBoxTitle.Text;
                this.Issue.Body = this.mTextPreviewViewBody.Text;
                lDataContext.SubmitChanges();
            }

            this.mLabelTitle.Text = this.Issue.Title;
            this.mHtmlPanel.Text = MarkdownHelper.TranslateWithStyle(this.Issue.Body);
            this.mHtmlPanel.Visible = true;
        }
Exemplo n.º 3
0
        private void ButtonSubmit_Click(object sender, EventArgs e)
        {
            using (var lDataContext = new IssueTrackerDataContext())
            {
                var lIssue = new Issue();
                lIssue.ProjectId = this.Project.Id;
                lIssue.Title = this.mTextBoxTitle.Text;
                lIssue.Body = this.mTextPreviewViewBody.Text;
                lIssue.CreationDateTime = DateTime.UtcNow;
                lIssue.LastUpdatedDateTime = DateTime.UtcNow;
                lIssue.OpenedByUser = lDataContext.CurrentUser;
                lIssue.IsOpen = true;
                lDataContext.Issues.InsertOnSubmit(lIssue);

                foreach (var lLabel in this.mSelectedLabels)
                {
                    var lIssueLabel = new IssueLabel();
                    lIssueLabel.Issue = lIssue;
                    lIssueLabel.LabelId = lLabel.Id;

                    lDataContext.IssueLabels.InsertOnSubmit(lIssueLabel);
                }

                lDataContext.SubmitChanges();

                this.IssueCreated.Fire(this, ReadOnlyValueEventArgs.Create(lIssue));
            }
        }