Ejemplo n.º 1
0
        protected void rgPuesto_DeleteCommand(object sender, GridCommandEventArgs e)
        {
            var             editableItem = ((GridEditableItem)e.Item);
            Nullable <Guid> ID;
            int             validarEliminar = 0;
            BL_PERSONAL     BL_PERSONAL     = new BL_PERSONAL();
            BL_PUESTO       BL_PUESTO       = new BL_PUESTO();

            if (editableItem.GetDataKeyValue("ID") != null)
            {
                ID = Guid.Parse(editableItem.GetDataKeyValue("ID").ToString());
            }
            else
            {
                ID = Guid.Empty;
            }

            //Validar que el área a eliminar no esté asociada a ninguna personal
            List <BE_PERSONAL> lstPersonal = BL_PERSONAL.SeleccionarPersonalPorArea((Guid)ID);

            if (lstPersonal == null || lstPersonal.Count == 0)
            {
                validarEliminar += 1;
            }

            if (validarEliminar > 0)
            {
                BL_PUESTO.EliminarPuesto((Guid)ID);
                rgPuesto.DataBind();
            }
            else
            {
                string message        = "'No puede eliminar un Puesto asociada a una o más Personas'";
                string javaScriptCode = "Sys.Application.add_load(function() {showRadConfirm(" + message + ");});";
                ScriptManager.RegisterStartupScript(this, this.GetType(), "RadConfirmStart", javaScriptCode, true);
            }
        }
Ejemplo n.º 2
0
 public List <BE_PERSONAL> SeleccionarPersonalPorArea(Guid area_id)
 {
     return(BL_PERSONAL.SeleccionarPersonalPorArea(area_id));
 }