コード例 #1
0
        public String deleteEmployee(String selectedID)
        {
            String dataPermissions       = Session["Permissions"].ToString();
            String dataPermissionsClient = Session["PermissionsClient"].ToString();
            bool   access       = false;
            bool   accessClient = false;

            //  access = getpermissions("users", "r");
            access       = validatepermissions.getpermissions("employee", "d", dataPermissions);
            accessClient = validatepermissions.getpermissions("employee", "d", dataPermissionsClient);

            string  employeestring = employeetable.GetRow(selectedID);
            JObject employee       = JsonConvert.DeserializeObject <JObject>(employeestring);

            //if (access == true && accessClient == true)
            if (true)
            {
                if (this.Request.IsAjaxRequest()) //only available with AJAX
                {
                    try
                    {
                        employeetable.deleteRow(selectedID); //deletes the selected document
                        //Notificate the action
                        Notificate.saveNotification("Employess", "Delete", "Un Empleado ha sido borrado");
                        _logTable.SaveLog(Session["_id"].ToString(), "Empleados", "Delete: " + employee["employee"].ToString(), "Employess", DateTime.Now.ToString());
                        return("Registro Borrado");
                    }
                    catch (Exception e)
                    {
                        return("Ha ocurrido un error");
                    }
                }
                return(null);
            }
            else
            {
                return(null);
            };
        }