예제 #1
0
        internal void BindData(ref SqlSyncBuildData buildData, ref SqlSyncBuildData.ScriptRow scriptRow, string scriptText, string lastEditor)
        {
            this.startingScriptText = scriptText;

            //Can't create a new review for yourself unless you are a "SelfReviewer"
            var isSelfReviewer = from s in EnterpriseConfigHelper.EnterpriseConfig.CodeReviewConfig.SelfReviewer
                                 where s.LoginId.ToLower() == lastEditor.ToLower()
                                 select s.LoginId;

            if ((lastEditor.Length == 0 || lastEditor.Trim().ToLower() == System.Environment.UserName.ToLower().Trim()) && !isSelfReviewer.Any())
            {
                this.Height = collapsedHeight;
                this.tblPanel.Controls.Clear();
                if (lastEditor.Length > 0)
                {
                    lblLastEditor.Visible = true;
                }
            }


            this.scriptRow = scriptRow;
            this.buildData = buildData;

            SqlSyncBuildData.CodeReviewRow[] rows = scriptRow.GetCodeReviewRows();
            if (rows != null && rows.Length > 0)
            {
                var sorted = from r in rows
                             orderby r.ReviewDate descending
                             select r;

                foreach (SqlSyncBuildData.CodeReviewRow row in sorted)
                {
                    if (!CodeReviewManager.ValidateReviewCheckSum(row, scriptText))
                    {
                        row.ReviewStatus = (short)CodeReviewStatus.OutOfDate;;
                        this.buildData.AcceptChanges();
                    }

                    CodeReviewItemControl itemCtrl = new CodeReviewItemControl(row);
                    itemCtrl.Dock = DockStyle.Fill;
                    this.tblPanel.Controls.Add(itemCtrl);
                    this.Height = this.Height + itemCtrl.Height + 7;
                }
            }
            this.fullHeight = this.Height;
        }