private void button1_Click(object sender, EventArgs e)
        {
            string GroupName             = grdDataCommponentField.Rows[0].Cells[2].Value.ToString();
            frmGroupMedicalExamField frm = new frmGroupMedicalExamField(GroupName);

            frm.ShowDialog();

            if (frm.DialogResult == System.Windows.Forms.DialogResult.OK)
            {
                if (_objComponentFieldsamc.i_RecordType == (int)RecordType.Temporal)
                {
                    _objComponentFieldsamc.i_RecordStatus = (int)RecordStatus.Agregado;
                }
                else if (_objComponentFieldsamc.i_RecordType == (int)RecordType.NoTemporal)
                {
                    _objComponentFieldsamc.i_RecordStatus = (int)RecordStatus.Modificado;
                }


                _objComponentFieldsamc.v_Group = frm._GroupName;

                _TempComponentFieldsList[_IndexList] = _objComponentFieldsamc;

                // Cargar grilla
                grdDataCommponentField.DataSource = new ComponentFieldsList();
                grdDataCommponentField.DataSource = _TempComponentFieldsList;
                grdDataCommponentField.Refresh();
            }
        }
        private void btnMoveCommponet_Click(object sender, EventArgs e)
        {
            OperationResult     objOperationResult = new OperationResult();
            ComponentFieldsList objComponentFields;


            if (checkedListBox1.Items.Count == 0)
            {
                return;
            }

            //Si la lista temporal es null se la setea con una lista vacia
            if (_TempComponentFieldsList == null)
            {
                _TempComponentFieldsList = new List <ComponentFieldsList>();
            }

            frmGroupMedicalExamField frm = new frmGroupMedicalExamField("");

            frm.ShowDialog();
            if (frm.DialogResult == System.Windows.Forms.DialogResult.OK)
            {
                for (int i = 0; i < checkedListBox1.CheckedItems.Count; i++)
                {
                    objComponentFields = new ComponentFieldsList();

                    KeyValueDTO obj = (KeyValueDTO)checkedListBox1.CheckedItems[i];
                    string      ComponentFieldId   = obj.Id;
                    string      ComponentFieldName = obj.Value1;
                    //Busco en la lista temporal si ya se agrego el item seleccionado
                    var findResult = _TempComponentFieldsList.Find(p => p.v_ComponentFieldId == ComponentFieldId);
                    if (findResult == null)
                    {
                        objComponentFields.v_ComponentId      = _ComponentId;
                        objComponentFields.v_ComponentFieldId = ComponentFieldId;
                        objComponentFields.v_Group            = frm._GroupName;
                        objComponentFields.v_TextLabel        = ComponentFieldName;
                        objComponentFields.i_RecordStatus     = (int)RecordStatus.Agregado;
                        objComponentFields.i_RecordType       = (int)RecordType.Temporal;
                        _TempComponentFieldsList.Add(objComponentFields);
                    }
                    else
                    {
                        if (findResult.i_RecordStatus == (int)RecordStatus.EliminadoLogico)
                        {
                            if (findResult.i_RecordType == (int)RecordType.NoTemporal)// El registro Tiene in ID de BD
                            {
                                findResult.v_ComponentId       = _ComponentId;
                                findResult.v_ComponentFieldId  = ComponentFieldId;
                                findResult.v_Group             = frm._GroupName;
                                objComponentFields.v_TextLabel = ComponentFieldName;
                                findResult.i_RecordStatus      = (int)RecordStatus.Grabado;
                            }
                            else if (findResult.i_RecordType == (int)RecordType.Temporal) // El registro tiene un ID temporal [GUID]
                            {
                                findResult.v_ComponentId       = _ComponentId;
                                findResult.v_ComponentFieldId  = ComponentFieldId;
                                findResult.v_Group             = frm._GroupName;
                                objComponentFields.v_TextLabel = ComponentFieldName;
                                findResult.i_RecordStatus      = (int)RecordStatus.Agregado;
                            }
                        }
                        else
                        {
                            MessageBox.Show("El campo : " + findResult.v_TextLabel + " ya existe.", "Error de validación", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                            //return;
                        }
                    }
                }
                var dataList = _TempComponentFieldsList.FindAll(p => p.i_RecordStatus != (int)RecordStatus.EliminadoLogico);

                // Cargar grilla
                grdDataCommponentField.DataSource = new ComponentFieldsList();
                grdDataCommponentField.DataSource = dataList;
                grdDataCommponentField.Refresh();
            }
        }