
function onErrorPeople(args) {
    var grid = $("#EntityGrid").data("kendoGrid");
    error(args, grid);
}

function error(args, grid) {

    if (args.errors) {
        grid.one("dataBinding", function (e) {
            e.preventDefault();   // cancel grid rebind if error occurs

            for (var error in args.errors) {
                showMessage(grid.editable.element, error, args.errors[error].errors);
            }
        });
    }
    else {
        if (args.status === "error") {
            alert(args.errorThrown);
        } else {
            alert("Unknown Error");
        }
    }
}

function getCriteriaDataSource() {
    var combo = $('#CimOrganizationComboBox').data("kendoComboBox");
    var cimIdSelected = "";
    if (combo != null) {
        cimIdSelected = combo.value();
    }
    var obj = {
        cimId: cimIdSelected
    };
    return obj;
}

function onChangeCompanySelection(e) {
    var grid = $("#PeopleGrid").data("kendoGrid");
    grid.dataSource.read();
    grid.refresh();
}
