Exemple #1
0
        private void Btn_Update_Click(object sender, EventArgs e)
        {
            int id   = Convert.ToInt32(Cmb_Perfil.SelectedValue);
            int ret2 = Funciones.EliminarAsigApp(id);

            if (ret2 != 0)
            {
                int        ret    = 0;
                AppDetalle appdet = new AppDetalle();
                appdet.id_Perfil = id;

                foreach (DataGridViewRow item in Dgv_Asignacion.Rows)
                {
                    appdet.id_app = Convert.ToInt32(item.Cells[0].Value);
                    bool create = Convert.ToBoolean(item.Cells[2].Value);
                    bool update = Convert.ToBoolean(item.Cells[3].Value);
                    bool delete = Convert.ToBoolean(item.Cells[4].Value);
                    if (create == true)
                    {
                        appdet.create = 1;
                    }
                    else
                    {
                        appdet.create = 0;
                    }
                    if (update == true)
                    {
                        appdet.update = 1;
                    }
                    else
                    {
                        appdet.update = 0;
                    }
                    if (delete == true)
                    {
                        appdet.delete = 1;
                    }
                    else
                    {
                        appdet.delete = 0;
                    }
                    ret = Funciones.IngresoDetalleApp(appdet);
                }
                if (ret != 0)
                {
                    MessageBox.Show("Actualizar Exitoso");
                    Funciones.IngresoBitacora("Actualizar", "Asignacion APP");
                }
                else
                {
                    MessageBox.Show("Error");
                }
            }
            else
            {
                MessageBox.Show("Error");
            }
        }
Exemple #2
0
        private void Btn_Guardar_Click(object sender, EventArgs e)
        {
            int        perfil = Cmb_Perfil.SelectedIndex;
            int        ret    = 0;
            AppDetalle appdet = new AppDetalle();

            appdet.id_Perfil = perfil;

            foreach (DataGridViewRow item in Dgv_Asignacion.Rows)
            {
                appdet.id_app = Convert.ToInt32(item.Cells[0].Value);
                bool create = Convert.ToBoolean(item.Cells[2].Value);
                bool update = Convert.ToBoolean(item.Cells[3].Value);
                bool delete = Convert.ToBoolean(item.Cells[4].Value);
                if (create == true)
                {
                    appdet.create = 1;
                }
                else
                {
                    appdet.create = 0;
                }
                if (update == true)
                {
                    appdet.update = 1;
                }
                else
                {
                    appdet.update = 0;
                }
                if (delete == true)
                {
                    appdet.delete = 1;
                }
                else
                {
                    appdet.delete = 0;
                }
                ret = Funciones.IngresoDetalleApp(appdet);
            }
            if (ret != 0)
            {
                MessageBox.Show("Ingreso Exitoso");
            }
            else
            {
                MessageBox.Show("Error");
            }
        }