public void EditQualityMetric(DataGridViewRow dr, QualityMetric qm)
        {
            if (qm.SegmentId != QualitivityRevisionController.SelectedSegmentId && qm.ParagraphId != QualitivityRevisionController.SelectedParagraphId)
            {
                FindSegmentInEditor();
            }


            var f = new Dialogs.QualityMetrics.QualityMetric
            {
                Metric = qm,
                IsEdit = true
            };

            f.ShowDialog();
            if (!f.Saved)
            {
                return;
            }
            qm.Updated = true;
            if (qm.RecordId != -1)
            {
                //if the QM entry was created originally in a different session, then
                //a independant entry is always created with a new ID.

                //Note: only when the QM is belonging to the same edit session can it be
                //updated without creating a new entry in the database.
                qm.Id = Guid.NewGuid().ToString();
            }
            qm.Modified = DateTime.Now;
            qm.UserName = Tracked.Settings.UserProfile.UserName;

            UpdateQualityMetricInDataViewList(dr, qm);
        }
        public void AddNewQualityMetric(QualityMetric qm)
        {
            var f = new Dialogs.QualityMetrics.QualityMetric();

            qm.ParagraphId = QualitivityRevisionController.SelectedParagraphId;
            qm.SegmentId   = QualitivityRevisionController.SelectedSegmentId;
            qm.Id          = Guid.NewGuid().ToString();

            qm.Created  = DateTime.Now;
            qm.Modified = DateTime.Now;
            qm.UserName = Tracked.Settings.UserProfile.UserName;
            f.Metric    = qm;
            f.IsEdit    = false;
            f.ShowDialog();
            if (!f.Saved)
            {
                return;
            }
            qm.Updated = true;
            //add the new qm to the list
            AddQualityMetricToDataViewList(qm);
        }