/// <summary>
        /// Allocates the new project criterion.
        /// </summary>
        /// <param name="projCritToAllocate">The proj crit to allocate.</param>
        /// <param name="index">The index.</param>
        /// Erstellt von Veit Berg, am 27.01.16
        public void AllocateNewProjectCriterion(ProjectCriterion projCritToAllocate, int index)
        {
            try{
            ProjCrits.Add(projCritToAllocate);
            projCritCont.ChangeAllocationOfProjectCriterionsInDb(ProjectId, ProjCrits);
             //          AllCrits.Remove((Criterion)projCritToAllocate);
            //foreach (ProjectCriterion projCrit in ProjCrits)
            //{
            //    Criterion allocatedCrit = AllCrits.Single(crit => crit.Criterion_Id == projCrit.Criterion_Id);
            //    AllCrits.Remove(allocatedCrit);
            //}

            using (CriterionController critCont = new CriterionController())
            {
                AllCrits = critCont.GetAllCriterionsFromDb();

                if (ProjCrits.Count != 0)
                {
                    foreach (ProjectCriterion projCrit in ProjCrits)
                    {
                        Criterion allocatedCrit = AllCrits.Single(crit => crit.Criterion_Id == projCrit.Criterion_Id);
                        AllCrits.Remove(allocatedCrit);
                    }
                }
            }

            using (ProjectCriterionController proCriCont = new ProjectCriterionController())
            {
                ProjCrits = proCriCont.GetAllProjectCriterionsForOneProject(ProjectId);

            }
            using (CriterionController critCont = new CriterionController())
            {
                AllCrits = critCont.GetAllCriterionsFromDb();

                if (ProjCrits.Count != 0)
                {
                    foreach (ProjectCriterion projCrit in ProjCrits)
                    {
                        Criterion allocatedCrit = AllCrits.Single(crit => crit.Criterion_Id == projCrit.Criterion_Id);
                        AllCrits.Remove(allocatedCrit);
                    }
                }
            }
            dataGridView_CritAvail.DataSource = null;
            dataGridView_CritAvail.DataSource = AllCrits;

            refreshGridL();
            }
            catch (Exception x)
            {
                MessageBox.Show(x.Message);
            }
        }
 /// <summary>
 /// Refreshes the list.
 /// für manuelles Refreshen
 /// </summary>
 /// Erstellt von Veit Berg, am 27.01.16
 public void RefreshList()
 {
     //List<Criterion> CritList = critCont.GetAllCriterionsFromDb();
     //var bindingList = new BindingList<Criterion>(CritList);
     //var source = new BindingSource(bindingList, null);
     //dataGridView_Crits.DataSource = CritList;
     try
     {
         using (CriterionController CritRefr = new CriterionController())
         {
             List<Criterion> CritList = CritRefr.GetAllCriterionsFromDb();
             var bindingList = new BindingList<Criterion>(CritList);
             var source = new BindingSource(bindingList, null);
             dataGridView_Crits.DataSource = CritList;
         }
     }
     catch (Exception x)
     {
         MessageBox.Show(x.Message);
     }
 }
        /// <summary>
        /// Handles the Load event of the ProjCritAssign_Form control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
        /// Erstellt von Veit Berg, am 27.01.16
        private void ProjCritAssign_Form_Load(object sender, EventArgs e)
        {
            try{
            using (ProjectCriterionController proCriCont = new ProjectCriterionController())
            {
                ProjCrits = proCriCont.GetAllProjectCriterionsForOneProject(ProjectId);

            }
            using (CriterionController critCont = new CriterionController())
            {
                AllCrits = critCont.GetAllCriterionsFromDb();

                if (ProjCrits.Count != 0)
                {
                    foreach (ProjectCriterion projCrit in ProjCrits)
                    {
                        Criterion allocatedCrit = AllCrits.Single(crit => crit.Criterion_Id == projCrit.Criterion_Id);
                        AllCrits.Remove(allocatedCrit);
                    }
                }
            }
            dataGridView_CritAvail.Rows.Clear();
            var CritBindingList = new BindingList<Criterion>(AllCrits);
            var CritSource = new BindingSource(CritBindingList, null);
            dataGridView_CritAvail.DataSource = AllCrits;
            dataGridView_CritAvail.Columns[0].HeaderText = "ID";
            dataGridView_CritAvail.Columns[0].Width = 30;
            dataGridView_CritAvail.Columns[1].Width = 200;
            dataGridView_CritAvail.Columns[2].Width = 240;
            dataGridView_CritAvail.Columns["Description"].HeaderText = "Beschreibung";
            dataGridView_CritAvail.Columns[0].ReadOnly = true;
            dataGridView_CritAvail.Columns[1].ReadOnly = true;
            dataGridView_CritAvail.Columns[2].ReadOnly = true;
            dataGridView_ProjCrits.Rows.Clear();
              using(CriterionController critCon = new CriterionController())
              {
            foreach (ProjectCriterion projCrit in ProjCrits)
            {
              var singleCritId = critCon.GetCriterionById(projCrit.Criterion_Id);
              projCrit.Name = singleCritId.Name.ToString();
            }
              }

            var ProjCritBindingList = new BindingList<ProjectCriterion>(ProjCrits);
            var projCritSource = new BindingSource(ProjCritBindingList, null);
            dataGridView_ProjCrits.DataSource = ProjCrits;
            dataGridView_ProjCrits.Columns.Remove("Project_Id");
            dataGridView_ProjCrits.Columns.Remove("Layer_Depth");
            dataGridView_ProjCrits.Columns.Remove("Weighting_Cardinal");
            dataGridView_ProjCrits.Columns.Remove("Weighting_Percentage_Layer");
            dataGridView_ProjCrits.Columns.Remove("Weighting_Percentage_Project");
            dataGridView_ProjCrits.Columns.Remove("Criterion");
            dataGridView_ProjCrits.Columns.Remove("ParentCriterion");
            dataGridView_ProjCrits.Columns.Remove("Project");
            dataGridView_ProjCrits.Columns.Add("Beschreibung", "Beschreibung");
            int i = 0;
            foreach (ProjectCriterion ProCri in ProjCrits)
            {

                dataGridView_ProjCrits["Beschreibung", i].Value = ProCri.Criterion.Description;
                i++;
            }
            dataGridView_ProjCrits.Columns[0].HeaderText = "ID";
            dataGridView_ProjCrits.Columns[0].Width = 40;
            dataGridView_ProjCrits.Columns[1].HeaderText = "P-ID";
            dataGridView_ProjCrits.Columns[1].Width = 40;
            dataGridView_ProjCrits.Columns[2].Width = 200;
            dataGridView_ProjCrits.Columns[3].Width = 190;
            dataGridView_ProjCrits.Columns[0].ReadOnly = true;
            dataGridView_ProjCrits.Columns[1].ReadOnly = true;
            dataGridView_ProjCrits.Columns[2].ReadOnly = true;
            dataGridView_ProjCrits.Columns[3].ReadOnly = true;
            this.FormClosing += new FormClosingEventHandler(ProjCritAssign_View_FormClosing);
            }
            catch (Exception i)
            {
                MessageBox.Show(i.Message);
            }
        }
        /// <summary>
        /// Handles the Click event of the btn_CritToPool control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
        /// Erstellt von Veit Berg, am 27.01.16
        private void btn_CritToPool_Click(object sender, EventArgs e)
        {
            try{
            if ((int)dataGridView_ProjCrits.SelectedRows[0].Index >= 0)
            {
                DataGridViewRow row = dataGridView_ProjCrits.SelectedRows[0];
                int CritId = (int)row.Cells["Criterion_Id"].Value;
                int index = dataGridView_ProjCrits.CurrentCell.RowIndex;
                ProjCrits.RemoveAt(index);
                projCritCont.ChangeAllocationOfProjectCriterionsInDb(ProjectId, ProjCrits);
                using (ProjectCriterionController proCriCont = new ProjectCriterionController())
                {
                    ProjCrits = proCriCont.GetAllProjectCriterionsForOneProject(ProjectId);

                }
                using (CriterionController critCont = new CriterionController())
                {
                    AllCrits = critCont.GetAllCriterionsFromDb();

                    if (ProjCrits.Count != 0)
                    {
                        foreach (ProjectCriterion projCrit in ProjCrits)
                        {
                            Criterion allocatedCrit = AllCrits.Single(crit => crit.Criterion_Id == projCrit.Criterion_Id);
                            AllCrits.Remove(allocatedCrit);
                        }
                    }
                }

                dataGridView_CritAvail.DataSource = null;
                dataGridView_CritAvail.DataSource = AllCrits;
                refreshGridL();
            }
            else
            {
                MessageBox.Show("Bitte erst eine Zeile auswählen");
            }
            }
            catch (Exception x)
            {
                MessageBox.Show(x.Message);
            }
        }