Example #1
0
 // same but for forecolor
 private void CheckForeColor(ScoringEntity ent, DataGridViewRow row)
 {
     if (ent.GapType1 == ScoringEntity.GapType.High)
         row.Cells["CapabilityGapText"].Style.ForeColor = Color.Red;
     else if (ent.GapType1 == ScoringEntity.GapType.Middle)
         row.Cells["CapabilityGapText"].Style.ForeColor = Color.Orange;
     else if (ent.GapType1 == ScoringEntity.GapType.Low)
         row.Cells["CapabilityGapText"].Style.ForeColor = Color.DarkGreen;
     else
     {
         row.Cells["CapabilityGapText"].Style.BackColor = Color.LightGray;
         row.Cells["CapabilityGapText"].Style.ForeColor = Color.Black;
     }
 }
Example #2
0
        //Check if there needs to be a yellow exclamation point for a flag based on the updated values
        private void CheckFlags(ScoringEntity ent, DataGridViewRow row)
        {
            if (ent.Flagged)
            {

                DataGridViewImageCell cell = (DataGridViewImageCell)row.Cells["Flags"];
                cell.Value = Properties.Resources.exclamation;
            }
            else
            {

                DataGridViewImageCell cell = (DataGridViewImageCell)row.Cells["Flags"];
                cell.Style.NullValue = null;
                cell.Value = null;
            }
        }
Example #3
0
 private void loadSurveyFromDataGrid_CellMouseDown(object sender, DataGridViewCellMouseEventArgs e)
 {
     //Console.WriteLine(e.RowIndex.ToString());
     if (e.ColumnIndex == 1 && e.RowIndex >=0)
     {
         if (e.Button == MouseButtons.Right)
         {
             DataGridView.HitTestInfo hit = loadSurveyFromDataGrid.HitTest(e.X, e.Y);
             //Console.WriteLine(hit.RowIndex.ToString());
             loadSurveyFromDataGrid.Rows[e.RowIndex].Selected = true;
             ScoringEntity ent = loadSurveyFromDataGrid.SelectedRows[0].DataBoundItem as ScoringEntity;
             if (ent.Type == "attribute")
             {
                 ContextMenuStrip strip = new ContextMenuStrip();
                 ToolStripMenuItem addToDebate = new ToolStripMenuItem();
                 addToDebate.Text = "Add to Discussion";
                 currentEnt = ent;
                 addToDebate.Click += new EventHandler(this.AddToDebate);
                 strip.Items.Add(addToDebate);
                 strip.Show(loadSurveyFromDataGrid, e.Location, ToolStripDropDownDirection.BelowRight);
             }
         }
     }
 }
Example #4
0
 //check the UI backcolor of all the cells that need to be updated
 private void CheckBackColor(ScoringEntity ent, DataGridViewRow row)
 {
     if (ent.GapType1 == ScoringEntity.GapType.High)
         row.Cells["CapabilityGapText"].Style.BackColor = Color.IndianRed;
     else if (ent.GapType1 == ScoringEntity.GapType.Middle)
         row.Cells["CapabilityGapText"].Style.BackColor = Color.Yellow;
     else if (ent.GapType1 == ScoringEntity.GapType.Low)
         row.Cells["CapabilityGapText"].Style.BackColor = Color.LawnGreen;
     else
         row.Cells["CapabilityGapText"].Style.BackColor = Color.LightGray;
 }
Example #5
0
        public void ReadSurveyITCap(List <ScoringEntity> questions)
        {
            var FD = new System.Windows.Forms.FolderBrowserDialog();

            if (FD.ShowDialog() != System.Windows.Forms.DialogResult.OK)
            {
                return;
            }

            var files    = Directory.EnumerateFiles(FD.SelectedPath);
            var badFiles = 0;

            foreach (var file in files)
            {
                if (file.Contains("~$"))
                {
                    badFiles++;
                    continue;
                }
                //Start Word and open the word document.
                Word._Application oWord;
                Word._Document    oDoc;
                oWord         = new Word.Application();
                oWord.Visible = false;


                oDoc = oWord.Documents.Open(file, Type.Missing, Type.Missing, Type.Missing,
                                            Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing,
                                            Type.Missing, Type.Missing, false, Type.Missing, Type.Missing, Type.Missing, Type.Missing);
                //oWord.Activate();



                ScoringEntity currentQuestion = null;

                if (oDoc.Paragraphs.First.Range.Text != "IT Capability Assessment Survey\r")
                {
                    continue;
                }
                int q = 1, c = 1;
                foreach (Word.FormField form in oDoc.FormFields)
                {
                    if (form.Name != "Name")
                    {
                        foreach (var f in questions)
                        {
                            var asdfasdfasf = RemoveCharacters(TruncateLongString(f.Name, 19));
                        }
                        try
                        {
                            currentQuestion = questions.Where(x => RemoveCharacters(TruncateLongString(x.Name, 19)) == form.Name).First();
                        }
                        catch
                        {
                            continue;
                        }

                        ITCapQuestion temp = (ITCapQuestion)currentQuestion;

                        if (string.IsNullOrEmpty(form.Result) || string.IsNullOrWhiteSpace(form.Result))
                        {
                            if (c == 1)
                            {
                                c = 2;
                            }
                            else if (c == 2)
                            {
                                c = 3;
                            }
                            else if (c == 3)
                            {
                                c = 1;
                            }
                            continue;
                        }
                        else
                        {
                            if (c == 1)
                            {
                                temp.AddAsIsAnswer(Convert.ToSingle(form.Result.ToString()));

                                c = 2;
                            }
                            else if (c == 2)
                            {
                                temp.AddToBeAnswer(Convert.ToSingle(form.Result.ToString()));
                                c = 3;
                                q++;
                            }
                            else if (c == 3)
                            {
                                temp.AddComment(form.Result.ToString());
                                c = 1;
                                q++;
                            }
                        }
                    }
                }
                oDoc.Close(Word.WdSaveOptions.wdDoNotSaveChanges);
            }
        }