Exemplo n.º 1
0
        /// <summary>
        /// Guarda la informacion del formulario en GIT_Config_Logica
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnGuardar_Click(object sender, EventArgs e)
        {
            try
            {
                using (var context = new Profit_RGEntities())
                {
                    Boolean buscar98 = false;
                    //  Boolean buscar90 = false;

                    foreach (var item in CLO)
                    {
                        buscar98 = context.pConf_LogicaDGV(activo).Count(u => u.Rowguid.ToString().ToUpper() == item.Rowguid.ToUpper()) > 0;
                        // buscar90 = context.pSeleccionarGIT_Asign_Equipo(item.activo.Trim ()).Count(u => u.Rowguid.ToString () == item.Rowguid.ToUpper ()) > 0;
                        if (buscar98)
                        {
                            context.pGIT_Config_LogicaActualizar(radTxt_activo.Text, item.campo, item.descripcion, Guid.Parse(item.Rowguid));
                        }
                        else
                        {
                            context.pGIT_Config_LogicaInsertar(radTxt_activo.Text, item.campo, item.descripcion);
                        }
                    }
                }
                MessageBox.Show(this, "Se ha guardado la información satisfactoriamente.", "Profit Expansion", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            catch (EntityException ex)
            {
                MessageBox.Show(ex.InnerException.Message, "Profit Expansion", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            catch (Exception ex1)
            {
                MessageBox.Show(ex1.Message, "Profit Expansion", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// Valida si hay datos repetidos en la tabla GIT_Config_Logica y carga el formulario..
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        void CargarDG()

        {
            using (var context = new Profit_RGEntities())
            {
                var T = context.pConf_LogicaDGV(activo.Trim()).ToList();
                CLO.Clear();

                foreach (var item in T)
                {
                    CLO.Add(new Conf_LogicaDG
                    {
                        activo      = item.id_activo,
                        campo       = item.co_campo,
                        descripcion = item.valor,
                        Rowguid     = item.Rowguid.ToString(),
                    });

                    grd_CL.DataSource          = "";
                    grd_CL.DataSource          = CLO;
                    grd_CL.AutoGenerateColumns = false;
                    grd_CL.Refresh();
                }
            }
        }