Пример #1
0
        protected void btnAgregar_Click(object sender, EventArgs e)
        {
            try
            {
                long personal = Convert.ToInt64(dplPersonal.SelectedValue);
                lbError.Visible = false;
                Adapter.AdapterPersonal adapter = new Adapter.AdapterPersonal();
                Boolean action = true;
                foreach (Adapter.AdapterPersonal item in listaPersonalActual)
                {
                    if (item._ID_PERSONA == personal)
                    {
                        lbError.Visible = true;
                        action          = false;
                    }
                }

                if (action == true)
                {
                    lbError.Visible = false;
                    adapter         = Controller.ControllerPersona.buscarPersonalId(personal);
                    listaPersonalAsignar.Add(adapter);
                }
                grAsignados.DataSource = listaPersonalAsignar;
                grAsignados.DataBind();
                dplPersonal.SelectedIndex = 0;
            }
            catch (Exception ex)
            {
                grAsignados.DataSource = null;
                grAsignados.DataBind();
                System.Diagnostics.Debug.WriteLine("Error: " + ex);
            }
        }
Пример #2
0
        protected void grPersonal_SelectedIndexChanged(object sender, EventArgs e)
        {
            int index = grPersonal.SelectedIndex;

            Adapter.AdapterPersonal aux = listaPersonalActual[index];
            if (option == true)
            {
                listaPersonalUpdate.Add(listaPersonalActual[index]);
                listaPersonalActual.RemoveAt(index);
                grPersonal.DataSource = listaPersonalActual;
                grPersonal.DataBind();
            }
            else if (option == false)
            {
                if (aux._DESCRIPCION_ROL.Equals("Administrador Condominio"))
                {
                    lbPersonal.Visible = true;
                }
                else
                {
                    listaPersonalActual.RemoveAt(index);
                    listaPersonalUpdate.Add(listaPersonalActual[index]);
                    grPersonal.DataSource = listaPersonalActual;
                    grPersonal.DataBind();
                }
            }
        }