コード例 #1
0
        private void btnAgregarRestriccion_Click(object sender, EventArgs e)
        {
            var x = (KeyValueDTO)ddlComponentId.SelectedItem;


            if (x.Value4 == 0.0)
            {
                MessageBox.Show("Por favor seleccione un consultorio", "Error de validación", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }
            var frm = new frmMasterRecommendationRestricction("Restricciones", (int)Typifying.Restricciones, ModeOperation.Total);

            frm.ShowDialog();

            if (_tmpRestrictionList == null)
            {
                _tmpRestrictionList = new List <RestrictionList>();
            }

            var restrictionId   = frm._masterRecommendationRestricctionId;
            var restrictionName = frm._masterRecommendationRestricctionName;

            if (restrictionId != null && restrictionName != null)
            {
                var restriction = _tmpRestrictionList.Find(p => p.v_MasterRestrictionId == restrictionId);

                if (restriction == null)   // agregar con normalidad [insert]  a la bolsa
                {
                    // Agregar restricciones a la Lista
                    RestrictionList restrictionByDiagnostic = new RestrictionList();

                    restrictionByDiagnostic.v_RestrictionByDiagnosticId = Guid.NewGuid().ToString();
                    restrictionByDiagnostic.v_DiagnosticRepositoryId    = Guid.NewGuid().ToString();
                    restrictionByDiagnostic.v_MasterRestrictionId       = restrictionId;
                    restrictionByDiagnostic.v_ServiceId       = _serviceId;
                    restrictionByDiagnostic.v_ComponentId     = _componentId;
                    restrictionByDiagnostic.v_RestrictionName = restrictionName;
                    restrictionByDiagnostic.i_RecordStatus    = (int)RecordStatus.Agregado;
                    restrictionByDiagnostic.i_RecordType      = (int)RecordType.Temporal;
                    restrictionByDiagnostic.v_ComponentId     = _componentIds[0];

                    _tmpRestrictionList.Add(restrictionByDiagnostic);
                }
                else    // La restriccion ya esta agregado en la bolsa
                {
                    MessageBox.Show("Por favor seleccione otra Restriccón. ya existe", "Error de validación", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    return;
                }
            }

            // Cargar grilla
            grdRestricciones.DataSource = new RestrictionList();
            grdRestricciones.DataSource = _tmpRestrictionList;
            grdRestricciones.Refresh();
            lblRecordCountRecomendaciones_AnalisisDx.Text = string.Format("Se encontraron {0} registros.", _tmpRestrictionList.Count());
        }
コード例 #2
0
        private void btnRecomendaciones_Click(object sender, EventArgs e)
        {
            var frm = new frmMasterRecommendationRestricction("Recomendaciones", (int)Typifying.Recomendaciones, ModeOperation.Total);

            frm.ShowDialog();

            if (_tmpExamDiagnosticComponentList == null)
            {
                _tmpExamDiagnosticComponentList = new List <DiagnosticRepositoryList>();
            }

            if (_tmpRecomendationList == null)
            {
                _tmpRecomendationList = new List <RecomendationList>();
            }

            var recomendationId    = frm._masterRecommendationRestricctionId;
            var recommendationName = frm._masterRecommendationRestricctionName;

            if (recomendationId != null && recommendationName != null)
            {
                var recomendation = _tmpRecomendationList.Find(p => p.v_MasterRecommendationId == recomendationId);

                if (_mode == "New" || _mode == "Edit")
                {
                    if (recomendation == null)   // agregar con normalidad [insert]  a la bolsa
                    {
                        // Agregar restricciones a la Lista
                        RecomendationList recomendationList = new RecomendationList();

                        recomendationList.v_RecommendationId       = Guid.NewGuid().ToString();
                        recomendationList.v_DiagnosticRepositoryId = Guid.NewGuid().ToString();
                        recomendationList.v_MasterRecommendationId = recomendationId;
                        recomendationList.v_ServiceId          = _serviceId;
                        recomendationList.v_ComponentId        = ddlComponentId.SelectedValue.ToString(); //_componentId;
                        recomendationList.v_RecommendationName = recommendationName;
                        recomendationList.i_RecordStatus       = (int)RecordStatus.Agregado;
                        recomendationList.i_RecordType         = (int)RecordType.Temporal;

                        _tmpRecomendationList.Add(recomendationList);
                    }
                    else    // La restriccion ya esta agregado en la bolsa hay que actualizar su estado
                    {
                        if (recomendation.i_RecordStatus == (int)RecordStatus.EliminadoLogico)
                        {
                            if (recomendation.i_RecordType == (int)RecordType.NoTemporal)   // El registro Tiene in ID de BD
                            {
                                recomendation.v_MasterRecommendationId = recomendationId;
                                recomendation.v_RecommendationName     = recommendationName;
                                recomendation.i_RecordStatus           = (int)RecordStatus.Grabado;
                            }
                            else if (recomendation.i_RecordType == (int)RecordType.Temporal)   // El registro tiene un ID temporal [GUID]
                            {
                                recomendation.v_MasterRecommendationId = recomendationId;
                                recomendation.v_RecommendationName     = recommendationName;
                                recomendation.i_RecordStatus           = (int)RecordStatus.Agregado;
                            }
                        }
                        else
                        {
                            MessageBox.Show("Por favor seleccione otra Recomendación. ya existe", "Error de validación", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                            return;
                        }
                    }
                }
            }

            var dataList = _tmpRecomendationList.FindAll(p => p.i_RecordStatus != (int)RecordStatus.EliminadoLogico);

            // Cargar grilla
            grdRecomendaciones.DataSource = new RecomendationList();
            grdRecomendaciones.DataSource = dataList;
            grdRecomendaciones.Refresh();
            lblRecordCountRecomendaciones.Text = string.Format("Se encontraron {0} registros.", dataList.Count());
        }